# Invalid container object

**URL:** <https://community.gatling.io/t/invalid-container-object/890>\
**Category:** Gatling (Open-Source)\
**Created:** [March 20, 2014, 6:58pm UTC](https://community.gatling.io/t/invalid-container-object/890 "2014-03-20T18:58:23Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 20, 2014, 6:58pm UTC](https://community.gatling.io/t/invalid-container-object/890/1 "2014-03-20T18:58:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 20, 2014, 9:34pm UTC](https://community.gatling.io/t/invalid-container-object/890/2 "2014-03-20T21:34:41Z")

</div>

Hi,

This looks like a Jayway bug.

This project is not really maintained anymore:

- last commit was 5 months ago: [https://github.com/jayway/JsonPath/commits/master](https://github.com/jayway/JsonPath/commits/master)
- 11 pending Pull Requests: [https://github.com/jayway/JsonPath/pulls](https://github.com/jayway/JsonPath/pulls)  
Because of this, we ended up developing our own implementation.

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

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 20, 2014, 9:39pm UTC](https://community.gatling.io/t/invalid-container-object/890/3 "2014-03-20T21:39:09Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 20, 2014, 9:46pm UTC](https://community.gatling.io/t/invalid-container-object/890/4 "2014-03-20T21:46:47Z")

</div>

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](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](https://github.com/excilys/gatling/wiki/Continuous-Integration)

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 21, 2014, 12:53pm UTC](https://community.gatling.io/t/invalid-container-object/890/5 "2014-03-21T12:53:41Z")

</div>

Ok,

Thanks for the help.

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 21, 2014, 1:12pm UTC](https://community.gatling.io/t/invalid-container-object/890/6 "2014-03-21T13:12:04Z")

</div>

Still the same.

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 3:12pm UTC](https://community.gatling.io/t/invalid-container-object/890/7 "2014-03-24T15:12:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 3:20pm UTC](https://community.gatling.io/t/invalid-container-object/890/8 "2014-03-24T15:20:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 24, 2014, 3:30pm UTC](https://community.gatling.io/t/invalid-container-object/890/9 "2014-03-24T15:30:36Z")

</div>

atOnce is now atOnceUsers

repeat hasn’t changed, no

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 4:46pm UTC](https://community.gatling.io/t/invalid-container-object/890/10 "2014-03-24T16:46:29Z")

</div>

Does the whatever become dontValidate?

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [March 24, 2014, 4:50pm UTC](https://community.gatling.io/t/invalid-container-object/890/11 "2014-03-24T16:50:16Z")

</div>

Yup.

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 5:03pm UTC](https://community.gatling.io/t/invalid-container-object/890/12 "2014-03-24T17:03:01Z")

</div>

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) {  
^

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [March 24, 2014, 5:05pm UTC](https://community.gatling.io/t/invalid-container-object/890/13 "2014-03-24T17:05:42Z")

</div>

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.\_

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 6:01pm UTC](https://community.gatling.io/t/invalid-container-object/890/14 "2014-03-24T18:01:49Z")

</div>

They are like this and the error persists

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [March 24, 2014, 7:20pm UTC](https://community.gatling.io/t/invalid-container-object/890/15 "2014-03-24T19:20:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 7:30pm UTC](https://community.gatling.io/t/invalid-container-object/890/16 "2014-03-24T19:30:48Z")

</div>

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

Should I wrap this in a Int.box then?

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [March 24, 2014, 7:35pm UTC](https://community.gatling.io/t/invalid-container-object/890/17 "2014-03-24T19:35:18Z")

</div>

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

That should fix your issue then.

---

<div class="post-metadata">

**Author:** ![Augusto](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Augusto](https://community.gatling.io/u/Augusto)\
**Post date:** [March 24, 2014, 7:37pm UTC](https://community.gatling.io/t/invalid-container-object/890/18 "2014-03-24T19:37:43Z")

</div>

Thank you very much 🙂
