Gatling Error: Could not find or load main class Engine
Asked Answered
L

3

6

I installed the latest IntelliJ idea, latest maven 3.6.3, Java 1.8, set the JAVA_HOME / JRE_HOME env variables. Then generated a Gatling project using mvn archetype:generate -Dfilter=gatling. In summary, I followed the instruction here. I have installed the Scala plugin for IntelliJ idea as well. When I try to run the Gatling engine by right-clicking on the Engine class, I am getting below error. can someone tell me what's going on here? I tried all the suggestions online, but no luck so far. Thanks

"C:\Program Files (x86)\Java\jdk1.8.0_221\bin\java.exe".....

Error: Could not find or load main class Engine

Process finished with exit code 1 

Here is my POM file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.gatling</groupId>
  <artifactId>pert-tests</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <encoding>UTF-8</encoding>

    <gatling.version>3.2.1</gatling.version>
    <gatling-maven-plugin.version>3.0.3</gatling-maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>${gatling.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </build>
</project>
Leucopoiesis answered 30/9, 2019 at 14:20 Comment(0)
W
10

David Montaño... after manually marking src/test/scala as Test Sources Root, I got "Error:(11, 18) illegal cyclic inheritance" as mentioned by Rasika

I just found that scala 2.13.1 is not compatible with gatling. I removed scala 2.13.1 from global libraries list and added scala 2.12.10. Tests working fine now. Here are the steps

  1. Right click project folder in IntelliJ and choose 'Open Module Settings'

  2. Under 'Platform Settings' select 'Global Libraries'

  3. Here, remove scala-sdk-2.13.1 and add scala-sdk-2.12.10

  4. Rebuild the module

Wilda answered 5/1, 2020 at 7:7 Comment(1)
Been struggling with this issue on and off for ages with Gatling... this solution downgrading to 2.12 finally worked. Thanks!Israel
C
8

It worked for me when I manually marked the src/test/scala as Test Sources Root and rebuild the project.

Mark as Test Sources Root

It should be picked up automatically by IntelliJ but it wasn't the case.

Catchall answered 30/9, 2019 at 20:10 Comment(2)
Thanks for the reply, Still the same issue @David Montaño, The solution compiles fine, however when I have a look at the solution folders, I am unable to find any bin folder with complied binaries, Could that be the reason?Leucopoiesis
I tried adding scala SDK 2.13.1 to Global Libraries in project settings, now i m getting a compilation error as Error:(11, 18) illegal cyclic inheritance involving trait Iterable Gatling.fromMap(props.build)Leucopoiesis
P
0

Tied both : marked the src/test/scala as Test Sources Root and rebuild the project.

Mark as Test Sources Root And Under 'Platform Settings' select 'Global Libraries'

Here, remove scala-sdk-2.13.1 and add scala-sdk-2.12.10

then works.

Pistoia answered 28/7, 2020 at 18:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.