- In my local Gatling SCALA repository I have ran
mvn clean compile
to clear the target folder - Then ran
mvn gatling:enterprisePackage
to generate the jar file - Uploaded this JAR in Enterprise Cloud
- Created a simulation using this JAR
- When executing the Simulation it throws error as
Unable to execute Simulation due to Wrapped by: java.lang.IllegalArgumentException: User defined Simulation class could not be loaded
- But before uploading the JAR itself I have cross checked. All the test class are present in the Simulation folder
I tried to reproduce what you described like that:
-
Clone the maven scala demo project (as you mentioned
scala
andmvn
)$ git clone git@github.com:gatling/gatling-maven-plugin-demo-scala.git
-
Run
enterprisePackage
target:$ mvn gatling:enterprisePackage
-
Log into Gatling Enterprise Cloud
-
Create a new Simulation
-
Click on Save and launch
-
Wait for run initialization
-
Enjoy the result
So, I cannot reproduce.
But what I saw in your log is this part:
2024-02-10 15:29:21,593 [WARN ] a.u.ManifestInfo - Could not read manifest information. java.io.IOException: line too long (line 9)
So it seems that you have a long line in this file inside this META-INF/MANIFEST.MF
file in your package.
Do you have many simulations in this package? Do you have long package names?
I will dig deeper in that issue during work hours, but in the meantime, you may try to “hide” other Simulation classes (by moving them out of src/main/scala
for instance)
Can you provide your META-INF/MANIFEST.MF
for analyse?
If you don’t want it to be publicly visible, you can send it through our support portal: (create a ticket and then you will be able to upload files)
Cheers!
Hi @vigneshsrinivasan ,
I think you’re facing a bug that’s been fixed yesterday where the JVM can’t load the package when it contains too many simulations.
Please upgrade to the latest version of the build plugin you’re using and then re-generate and re-upload your package:
- maven: 4.8.2
- sbt: 4.8.1
- gradle: 3.10.3.3
Regards
@slandelle
Yes you are correct. I was having 35+ simulation under my simulations folder.
I have upgraded gatling-maven-plugin = 4.8.2
Rebuild the package and uploaded to Cloud
It did work
Thanks for your support @slandelle
Below is my pom.xml. Could be a reference
<?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>org.learning</groupId>
<artifactId>Gatling-Scala</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.10.3</gatling.version>
<gatling-maven-plugin.version>4.8.2</gatling-maven-plugin.version>
<scala-maven-plugin.version>4.8.1</scala-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>
<!-- https://mvnrepository.com/artifact/com.github.javafaker/javafaker -->
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin.version}</version>
<configuration>
<!-- ... -->
<runMultipleSimulations>true</runMultipleSimulations>
<includes>
<include>simulations.basics.AddPauseTest</include>
<include>simulations.basics.AssertResponseBody</include>
</includes>
<excludes>
<exclude>my.package.IgnoredSimulation</exclude>
</excludes>
<apiToken>D5W</apiToken>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<jvmArgs>
<jvmArg>-Xss100M</jvmArg>
</jvmArgs>
<args>
<arg>-deprecation</arg>
<arg>-feature</arg>
<arg>-unchecked</arg>
<arg>-language:implicitConversions</arg>
<arg>-language:postfixOps</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Great!
Then, you should definitely remove scala-maven-plugin
from the dependencies. It’s not a project dependency but a build plugin. You’re adding lots of dead weight and possibly creating conflicts.
@slandelle
Earlier I didnt add it. But when executing test via maven using mvn gatling:test
It throws error related to Scala
After lot of research found out its a compilation issue.
And thats where I have found this plugin mentioned in Gatling official page
Do you still recommend to remove those ?
Indeed, the scala-maven-plugin
is needed in order to compile scala. So you need to keep the mention in the project.build.plugins.plugin
node of your pom.xml
.
Only the mention in the project.dependencies.dependency
node, yes!
Cheers!
Thanks @sbrevet for the clear explanation
Removed the scala-maven-plugin from project.dependencies.dependency
node
Updated pom.xml
<?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>org.learning</groupId>
<artifactId>Gatling-Scala</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.10.3</gatling.version>
<gatling-maven-plugin.version>4.8.2</gatling-maven-plugin.version>
<scala-maven-plugin.version>4.8.1</scala-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>
<!-- https://mvnrepository.com/artifact/com.github.javafaker/javafaker -->
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin.version}</version>
<configuration>
<runMultipleSimulations>true</runMultipleSimulations>
<includes>
<include>simulations.basics.AddPauseTest</include>
<include>simulations.basics.AssertResponseBody</include>
</includes>
<excludes>
<exclude>my.package.IgnoredSimulation</exclude>
</excludes>
<apiToken>D5W</apiToken>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<jvmArgs>
<jvmArg>-Xss100M</jvmArg>
</jvmArgs>
<args>
<arg>-deprecation</arg>
<arg>-feature</arg>
<arg>-unchecked</arg>
<arg>-language:implicitConversions</arg>
<arg>-language:postfixOps</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>