I am trying to upgrade to the latest Gatling version. I am doing it step by step. My current version is 3.6.1 and I am trying to move to 3.7.6.
When running the simulation I get this error:
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @38af9828
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
at java.base/java.lang.reflect.Method.invoke(Method.java:558)
at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:375)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:366)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:294)
at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:88)
at io.netty.util.internal.ClassInitializerUtil.tryLoadClasses(ClassInitializerUtil.java:32)
at io.netty.channel.epoll.Native.<clinit>(Native.java:72)
at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:40)
at io.gatling.netty.util.Transports.newEventLoopGroup(Transports.java:40)
at io.gatling.app.Gatling$.start(Gatling.scala:83)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:49)
at io.gatling.app.Gatling$.main(Gatling.scala:38)
at io.gatling.app.Gatling.main(Gatling.scala)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.gatling.plugin.util.ForkMain.runMain(ForkMain.java:67)
at io.gatling.plugin.util.ForkMain.main(ForkMain.java:35)
11:36:01.405 [DEBUG] i.n.u.i.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
11:36:01.405 [DEBUG] i.n.u.i.PlatformDependent - sun.misc.Unsafe: available
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/C:/Users/ZZ00ET704/.m2/repository/io/netty/netty-common/4.1.74.Final/netty-common-4.1.74.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
I am using Java 11. The Maven version is 3.8.1.
Can you please help?
I tried doing this: mvn clean gatling:test --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Dgatling.simulationClass=AddToCartStressTestSimulation -DRAMP_DURATION_MINUTES=1 -DUSERS=1 -DPROXY_ENABLED=true -Dio.netty.tryReflectionSetAccessible=true
But it doesn’t work, I get the error: Unable to parse command line options: Unrecognized option: --add-opens...
This was a pretty big version change. Can you go through the list of changes here and make sure they’ve all been addressed? Gatling - Upgrading from 3.6 to 3.7
Hi @GatlingPete ,
I am aware of this list of changes and I have been doing my changes accordingly.
Not sure what I am missing here? Do you have any ideas?
Yes, this helped a lot, switching to the latest version and tweaking the pom.xml based on the demo Gatling project. Thanks!
One more question though,
I had before in the scala-maven-plugin the following:
<args>
<arg>-target:jvm-1.8</arg>
...
I removed it and everything seems to work fine. But I am afraid I will break something I don’t see currently since I don’t understand fully this argument for the plugin and I am not sure if I can safely remove it.
I can see this is not part of the pom.xml in the demo project. So can you please explain if it is necessary and why would it be necessary, in which cases? Or can I just remove it?
Before we only supported scala as a language to create Simulation. So we targeted the jvm 1.8 because scala doesn’t need anything else (and we didn’t want to play with the add-opens flags)
Now that we support java (and kotlin) as Simulation language, we (should?) fully support latest jvm.
For instance, we now aggressively test against java 20.
So, for gatling purpose, you can safely remove this flag.
Note: take care that this flag was not meant for your own libraries if you use any.
Thanks for the quick replies, along side Playwright community this is my number 1 community.
I feel in safe hands with you guys and would recommend Gatling as the tool of choice at any time.
Your support means a lot to us, little people
Keep up the good work!