Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gatling Error: Could not find or load main class Engine

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>
like image 883
Rasika Avatar asked Sep 30 '19 14:09

Rasika


2 Answers

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

like image 52
Ponson Thankavel Avatar answered Sep 18 '22 14:09

Ponson Thankavel


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.

like image 32
David Montaño Avatar answered Sep 21 '22 14:09

David Montaño