Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrecognized VM option 'AggressiveOpts'

I'm trying to run my gatling project in intelliJ using Java 8. I know that the VM option 'AggressiveOpts' is deprecated in Java 11 and removed in Java 12, but I was wondering why I am getting this error in Java 8?

I have updated my project SDK to be java 8 as well as updating my intelliJ boot runtime to also be Java 8 but this doesn't seem to work.

I have uninstalled Java and IntelliJ and clean installed them both again but that did not resolve the issue.

I have also tried using a different IDE which is VSC (Visual Studio Code) but I get the same errors as I did in intelliJ.

Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

My current version of Java is 1.8.0_181

My current version of Gatling is 3.3.1

If it helps I am using gradle and the version is 4.8.1

Can anyone help resolve this issue?

Edit: Added build.gradle code

please see the build.gradle here: https://pastebin.com/MigH0Gxz

like image 284
MxTxx Avatar asked Jul 03 '20 12:07

MxTxx


2 Answers

The only possible explanation is that you have multiple JDK version installed on your machine and that gradle doesn't pick 1.8.0_181 but 12+ when creating the forked Gatling process. Do you have JAVA_HOME env var defined and where does it point to?

like image 178
Stéphane LANDELLE Avatar answered Sep 23 '22 11:09

Stéphane LANDELLE


If what you have shown us is accurate, you don't mention AggressiveOpts at all in the Gradle file.

I found an issue in the Gatling issue tracker that mentions this is a problem when you try to run Gatling on newer JVMs. The implication of the issue is that Gatling is supplying the JVM option itself.

However:

  • The issue was apparently fixed in Gatling 3.3.0 (see issue 3807)
  • It should only affect you if Gatling is run using a Java 12+ JVM.

The latter suggests that (despite what you say that you are running your Gradle build using Java 8) Gatling is actually using a later version of Java.

For what it is worth, the changeset that fixes this problem simply removes the unknown flag from the gatling.bat and gatling.sh files. You could find and check whichever of those files is relevant to your platform and remove the unsupported option by hand. Or you could try to figure out how Gatling is deciding which JVM to use.

like image 30
Stephen C Avatar answered Sep 19 '22 11:09

Stephen C