Getting error "java.lang.ClassNotFoundException: com.fasterxml.jackson.core.StreamReadConstraints" on trying to test the simulations

I used the demo project for gatling with java - GitHub - gatling/gatling-maven-plugin-demo-java

I was able to do mvn gatling:test and test the simulation. I was also able to run Engine.java to test the simulation.

After adding gatling-kafka-plugin to pom.xml, unable to test the simulation using mvn gatling:test and on running Engine.java.

Getting error - Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/StreamReadConstraints

pom.xml

Error on mvn gatling:test

java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.gatling.plugin.util.ForkMain.runMain(ForkMain.java:67)
at io.gatling.plugin.util.ForkMain.main(ForkMain.java:35)
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/StreamReadConstraints
at io.gatling.core.json.Json$.(Json.scala:37)
at io.gatling.app.Analytics$.send(Analytics.scala:76)
at io.gatling.app.Runner.run(Runner.scala:55)
at io.gatling.app.Gatling$.start(Gatling.scala:92)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:54)
at io.gatling.app.Gatling$.main(Gatling.scala:42)
at io.gatling.app.Gatling.main(Gatling.scala)
… 6 more
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.StreamReadConstraints
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
… 13 more

Error on running Engine.java

Exception in thread “main” java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/StreamReadConstraints
at io.gatling.core.json.Json$.(Json.scala:37)
at io.gatling.app.Analytics$.send(Analytics.scala:76)
at io.gatling.app.Runner.run(Runner.scala:55)
at io.gatling.app.Gatling$.start(Gatling.scala:92)
at io.gatling.app.Gatling$.fromMap(Gatling.scala:46)
at io.gatling.app.Gatling.fromMap(Gatling.scala)
at Engine.main(Engine.java:12)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.StreamReadConstraints
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
… 7 more

Please help in resolving this error to proceed further.

Thank you!!

Hi,

This means that the third party plugin you’re using is pulling an outdated version of Jackson that overrides the ones used by Gatling.
You have to force the upgrade or the different jackson modules to 2.16.1 with a dependencyManagement block.

1 Like

This resolved the issue. Thank you!!