NoSuchMethodError HttpRequestActionBuilder.bodyParts(java.util.List)

Gatling version: 3.11.4 (must be up to date)
Gatling flavor: java kotlin scala javascript typescript
Gatling build tool: maven gradle sbt bundle npm

I read the guidelines and how to ask a question topics.
I provided a SSCCE (or at least, all information to help the community understand my topic)
I copied output I observe, and explain what I think should be.

Hello,

I’m trying to upgrade gatling from 3.10.5.1 to 3.11.4 on my Java project, built with gradle.
I’ve done a few modifications due to breaking changes : use --simulation parameter ; replace sse.connect() by sse.get().
But when I try to run my simulation, I get exceptions NoSuchMethodError HttpRequestActionBuilder.bodyParts(java.util.List). My IDE still shows me the method in the decompiled class, so I’m at loss what is going on. Any idea ?

java.lang.NoSuchMethodError: 'io.gatling.javaapi.http.HttpRequestActionBuilder io.gatling.javaapi.http.HttpRequestActionBuilder.bodyParts(java.util.List)'
        at xx.Endpoints.createBundleWithOauth2(Endpoints.java:87)
        at xx.ApiClient.createBundle(SignApiClient.java:77)
        at xx.Steps.signatures(EsigSteps.java:32)
        at xx.CommonSimulation.innerScenario(CommonSimulation.java:49)
        at xx.Simulation.<init>(BeeSimulation.java:23)
        at xx.Simulation.forMeta(BeeSimulation.java:19)
        at xx.MetaSimulation.<init>(MetaSimulation.java:21)
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
        ... 9 common frames omitted
Wrapped by: java.lang.reflect.InvocationTargetException: null
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at io.gatling.app.SimulationClass$Java.params(SimulationClass.scala:47)
        at io.gatling.app.Runner.load(Runner.scala:74)
        at io.gatling.app.Runner.run(Runner.scala:59)
        at io.gatling.app.Gatling$.start(Gatling.scala:86)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:48)
        at io.gatling.app.Gatling$.main(Gatling.scala:42)
        at io.gatling.app.Gatling.main(Gatling.scala)
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at io.gatling.app.SimulationClass$Java.params(SimulationClass.scala:47)
        at io.gatling.app.Runner.load(Runner.scala:74)
        at io.gatling.app.Runner.run(Runner.scala:59)
        at io.gatling.app.Gatling$.start(Gatling.scala:86)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:48)
        at io.gatling.app.Gatling$.main(Gatling.scala:42)
        at io.gatling.app.Gatling.main(Gatling.scala)
Caused by: java.lang.NoSuchMethodError: 'io.gatling.javaapi.http.HttpRequestActionBuilder io.gatling.javaapi.http.HttpRequestActionBuilder.bodyParts(java.util.List)'

You have some bytecode that is still compiled against Gatling 3.10.
The bodyParts method was moved in Gatling 3.10 into a parent class.

2 Likes

Thanks for the reply !
I found that I had a dependency to gatling-charts-highcharts that was still referring to 3.10 => upgrading it solved the issue.