Invalid container object

Hi,

I’m trying to create a test but I’m facing a problem when I use jsonPath. First I would like to know if there’s some log where I can find what was returned on each request or somewhere I can find the reason of this error:

java.lang.IllegalArgumentException: Invalid container object
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:208)
at io.gatling.core.check.extractor.jsonpath.JsonPathExtractors$.io$gatling$core$check$extractor$jsonpath$JsonPathExtractors$$extractAll(JsonPathExtractors.scala:46)
at io.gatling.core.check.extractor.jsonpath.JsonPathExtractors$$anonfun$1$$anon$1.apply(JsonPathExtractors.scala:59)
at io.gatling.core.check.extractor.jsonpath.JsonPathExtractors$$anonfun$1$$anon$1.apply(JsonPathExtractors.scala:56)
at io.gatling.core.check.CheckBase$$anonfun$check$3$$anonfun$apply$4.apply(Check.scala:65)
at io.gatling.core.check.CheckBase$$anonfun$check$3$$anonfun$apply$4.apply(Check.scala:64)
at io.gatling.core.validation.Success.flatMap(Validation.scala:28)
at io.gatling.core.check.CheckBase$$anonfun$check$3.apply(Check.scala:64)
at io.gatling.core.check.CheckBase$$anonfun$check$3.apply(Check.scala:63)
at io.gatling.core.validation.Success.flatMap(Validation.scala:28)
at io.gatling.core.check.CheckBase.check(Check.scala:63)
at io.gatling.http.check.HttpCheck.check(HttpCheck.scala:30)
at io.gatling.http.check.HttpCheck.check(HttpCheck.scala:29)
at io.gatling.core.check.Checks$$anonfun$check$1$$anonfun$apply$1.apply(Check.scala:30)
at io.gatling.core.check.Checks$$anonfun$check$1$$anonfun$apply$1.apply(Check.scala:30)
at io.gatling.core.validation.Success.flatMap(Validation.scala:28)
at io.gatling.core.check.Checks$$anonfun$check$1.apply(Check.scala:30)
at io.gatling.core.check.Checks$$anonfun$check$1.apply(Check.scala:29)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
at scala.collection.immutable.List.foldLeft(List.scala:84)
at io.gatling.core.check.Checks$.check(Check.scala:29)
at io.gatling.http.ahc.AsyncHandlerActor.checkAndProceed$1(AsyncHandlerActor.scala:162)
at io.gatling.http.ahc.AsyncHandlerActor.io$gatling$http$ahc$AsyncHandlerActor$$processResponse(AsyncHandlerActor.scala:175)
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$receive$1.applyOrElse(AsyncHandlerActor.scala:55)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
at akka.actor.ActorCell.invoke(ActorCell.scala:386)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
at akka.dispatch.Mailbox.run(Mailbox.scala:212)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

I’ve written this test

exec(http(“add_product”)
.post("/Checkout")
.headers(headers_checkout)
.param(“Product”, code)
.check(jsonPath("$.success").saveAs(“canGoOn”)))

.pause(461 milliseconds)
.doIf("${canGoOn}", “true”){
// another tests
}

I’m sure the problem is with the jsonPath, but I don’t know what is causing this… This call returns a json like this: {success: true}
I’ve tried using exists and find functions, but the same error ocurred.

Can you help me with this?

Thanks in advance,

Augusto

Hi,

This looks like a Jayway bug.

This project is not really maintained anymore:

It’s in Scala, compiled against Scala 2.10, so it only works with Gatling 2. The good thing is that it’s twice faster.

I advice you upgrade to Gatling 2.

Cheers,

Stéphane

I'm using the version 2. How should I use this implementation (didn't find
in the docs)?

And is there any way to trace the response from my requests? And the
session?

Thanks,

Oh right, 2M3 still used jayway.
You can try your luck and upgrade to 0.9.1 that was released since: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.jayway.jsonpath%22

Otherwise, you can try Gatling 2 snapshot: https://github.com/excilys/gatling/wiki/Continuous-Integration

Ok,

Thanks for the help.

I’m downloading it… The extractor name is jsonPath? Or it changed?

Still the same.

Hi againt.
I’ve just updated to the snapshot you’ve mentioned and I’m having some issues with my simulation…
It seems atOnce and whatever has been moved (or removed).
What should I import to use them?

Thanks,

Augusto

Just saw my IDE removed the Expression import…
The atOnce is not a problem anymore, but does the repeat changed?

atOnce is now atOnceUsers

repeat hasn’t changed, no

Does the whatever become dontValidate?

Yup.

almost all problems solved. I’m having an issue with the repeat

Error:(74, 13) type mismatch;
found : Integer
required: io.gatling.core.session.Session => io.gatling.core.validation.Validation[Int]
.repeat(count) {
^

What are your imports ?
They should look like these:

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

import scala.concurrent.duration._

They are like this and the error persists

Are you using a Java “Integer”?
What does the declaration of “count” looks like?

I think thats the problem then…
val count = Integer.getInteger(“categoriesPerUser”, Random.nextInt(10) + 1)

Should I wrap this in a Int.box then?

val count:Int = Integer.getInteger(“categoriesPerUser”, Random.nextInt(10) + 1)

That should fix your issue then.

Thank you very much :slight_smile: