# Can get simple jsonPath check to work

**URL:** <https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308>\
**Category:** Gatling (Open-Source)\
**Created:** [May 20, 2015, 12:43pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308 "2015-05-20T12:43:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Pestano](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rafael\_Pestano](https://community.gatling.io/u/Rafael_Pestano)\
**Post date:** [May 20, 2015, 12:43pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/1 "2015-05-20T12:43:07Z")

</div>

Hi guys,

I’m trying to check a simple json response without success:

HTTP response:  
status=  
200 OK  
headers=  
Server: [Apache-Coyote/1.1]  
Content-Type: [application/json]  
Transfer-Encoding: [chunked]

body=  
[{“ctrDthAtu”:“2015-05-12T12:30:04.000+0000”,“nroIntTur”:11673,…other attrs}]

I’ve tried

jsonPath(“$.nroIntTur”).ofType[Int].saveAs(“nroIntTur”)

but got:

> KO jsonPath($.nroIntTur).find(0).exists, found nothing

as my response is an array of jsonObjects I’ve also tried the array notation:

jsonPath(“$[0].nroIntTur”).ofType[Int].saveAs(“nroIntTur”) but i get this stacktrace:

> Uncaught error from thread [GatlingSystem-akka.actor.default-dispatcher-5] shutting down JVM since ‘akka.jvm-exit-on-fatal-error’ is enabled for ActorSystem[GatlingSystem]  
> java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/HttpServlet  
> at java.lang.ClassLoader.defineClass1(Native Method)  
> at java.lang.ClassLoader.defineClass(ClassLoader.java:760)  
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)  
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)  
> at java.net.URLClassLoader.access$100(URLClassLoader.java:73)

Any help is appreciated

refs:  
[http://goessner.net/articles/JsonPath/](http://goessner.net/articles/JsonPath/)

> **[GitHub - gatling/jsonpath: A JSONPath interpretor in Scala](https://github.com/gatling/jsonpath)**
>
> A JSONPath interpretor in Scala. Contribute to gatling/jsonpath development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [May 20, 2015, 12:52pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/2 "2015-05-20T12:52:31Z")

</div>

Wat

Where does this HttpServlet thingy comes from? Gatling has nothing to do with servlets?  
Could you provide the full statcktrace, please?

---

<div class="post-metadata">

**Author:** ![Rafael\_Pestano](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rafael\_Pestano](https://community.gatling.io/u/Rafael_Pestano)\
**Post date:** [May 20, 2015, 12:53pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/3 "2015-05-20T12:53:59Z")

</div>

here we go:

2015-05-20 09:52:36 0s elapsed  
---- TurmaRestSimulation -------------------------------------------------------  
[] 0%  
waiting: 1 / active: 0 / done:0  
---- Requests ------------------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![Rafael\_Pestano](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rafael\_Pestano](https://community.gatling.io/u/Rafael_Pestano)\
**Post date:** [May 20, 2015, 1:05pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/4 "2015-05-20T13:05:22Z")

</div>

I also receive the same exception when the response is not an array, eg:

{“ctrDthAtu”:“2015-05-12T12:30:04.000+0000”,“nroIntTur”:11673…

and the check $.nroIntTur

---

<div class="post-metadata">

**Author:** ![Rafael\_Pestano](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rafael\_Pestano](https://community.gatling.io/u/Rafael_Pestano)\
**Post date:** [May 20, 2015, 1:08pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/5 "2015-05-20T13:08:18Z")

</div>

found the problem, maven dependency conflict, removing dep below solves the problem:

```auto
<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

```

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [May 20, 2015, 1:11pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/6 "2015-05-20T13:11:08Z")

</div>

[https://github.com/boonproject/boon/issues/317](https://github.com/boonproject/boon/issues/317)

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [May 20, 2015, 1:12pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/7 "2015-05-20T13:12:40Z")

</div>

Yep.

I’ll provide a fix for Boon, but until then, please remove the dep if you can. Or use another jar such as the JBoss/WildFly ones.

---

<div class="post-metadata">

**Author:** ![Rafael\_Pestano](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rafael\_Pestano](https://community.gatling.io/u/Rafael_Pestano)\
**Post date:** [May 20, 2015, 2:16pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/8 "2015-05-20T14:16:13Z")

</div>

Hi Stephane,

indeed jboss javaee6 api solved it:

org.jboss.spec jboss-javaee-6.0 3.0.3.Final pom

Note that using Javaee7-api gives a clear error:

javax javaee-api 7.0 provided

Uncaught error from thread [GatlingSystem-akka.actor.default-dispatcher-11] shutting down JVM since ‘akka.jvm-exit-on-fatal-error’ is enabled for ActorSystem[GatlingSystem]  
java.lang.ExceptionInInitializerError  
at java.lang.Class.forName0(Native Method)  
at java.lang.Class.forName(Class.java:264)  
at org.boon.core.Sys.detectContainer(Sys.java:207)  
at org.boon.core.Sys.(Sys.java:196)  
at org.boon.core.value.LazyValueMap.buildMap(LazyValueMap.java:225)  
at org.boon.core.value.LazyValueMap.entrySet(LazyValueMap.java:214)  
at java.util.AbstractMap.containsKey(AbstractMap.java:144)  
at io.gatling.jsonpath.JsonPathWalker.walk1(JsonPath.scala:63)  
at io.gatling.jsonpath.JsonPathWalker.io$gatling$jsonpath$JsonPathWalker$$walk(JsonPath.scala:52)  
at io.gatling.jsonpath.JsonPathWalker$$anonfun$io$gatling$jsonpath$JsonPathWalker$$walk$1.apply(JsonPath.scala:52)  
at io.gatling.jsonpath.JsonPathWalker$$anonfun$io$gatling$jsonpath$JsonPathWalker$$walk$1.apply(JsonPath.scala:52)  
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:396)  
at scala.collection.Iterator$$anon$1.hasNext(Iterator.scala:870)  
at scala.collection.Iterator$$anon$14.skip(Iterator.scala:476)  
at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:477)  
at scala.collection.Iterator$class.toStream(Iterator.scala:1188)  
at scala.collection.AbstractIterator.toStream(Iterator.scala:1202)  
at scala.collection.TraversableOnce$class.toSeq(TraversableOnce.scala:283)  
at scala.collection.AbstractIterator.toSeq(Iterator.scala:1202)  
at io.gatling.core.check.extractor.jsonpath.SingleJsonPathExtractor$$anonfun$extract$1.apply(JsonPathExtractor.scala:53)  
at io.gatling.core.check.extractor.jsonpath.SingleJsonPathExtractor$$anonfun$extract$1.apply(JsonPathExtractor.scala:53)  
at io.gatling.core.validation.Success.map(Validation.scala:32)  
at io.gatling.core.check.extractor.jsonpath.SingleJsonPathExtractor.extract(JsonPathExtractor.scala:53)  
at io.gatling.core.check.extractor.CriterionExtractor.apply(Extractor.scala:33)  
at io.gatling.core.check.CheckBase$$anonfun$check$2$$anonfun$apply$2$$anonfun$apply$4.apply(Check.scala:84)  
at io.gatling.core.check.CheckBase$$anonfun$check$2$$anonfun$apply$2$$anonfun$apply$4.apply(Check.scala:83)  
at io.gatling.core.validation.Success.flatMap(Validation.scala:33)  
at io.gatling.core.check.CheckBase$$anonfun$check$2$$anonfun$apply$2.apply(Check.scala:83)  
at io.gatling.core.check.CheckBase$$anonfun$check$2$$anonfun$apply$2.apply(Check.scala:82)  
at io.gatling.core.validation.Success.flatMap(Validation.scala:33)  
at io.gatling.core.check.CheckBase$$anonfun$check$2.apply(Check.scala:82)  
at io.gatling.core.check.CheckBase$$anonfun$check$2.apply(Check.scala:81)  
at io.gatling.core.validation.Success.flatMap(Validation.scala:33)  
at io.gatling.core.check.CheckBase.check(Check.scala:81)  
at io.gatling.http.check.HttpCheck.check(HttpCheck.scala:35)  
at io.gatling.http.check.HttpCheck.check(HttpCheck.scala:32)  
at io.gatling.core.check.Check$.checkRec$1(Check.scala:37)  
at io.gatling.core.check.Check$.check(Check.scala:59)  
at io.gatling.http.ahc.AsyncHandlerActor.checkAndProceed$1(AsyncHandlerActor.scala:281)  
at io.gatling.http.ahc.AsyncHandlerActor.io$gatling$http$ahc$AsyncHandlerActor$$processResponse(AsyncHandlerActor.scala:322)  
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$receive$1.applyOrElse(AsyncHandlerActor.scala:89)  
at akka.actor.Actor$class.aroundReceive(Actor.scala:467)  
at io.gatling.core.akka.BaseActor.aroundReceive(BaseActor.scala:22)  
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)  
at akka.actor.ActorCell.invoke(ActorCell.scala:487)  
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)  
at akka.dispatch.Mailbox.run(Mailbox.scala:221)  
at akka.dispatch.Mailbox.exec(Mailbox.scala:231)  
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)  
Caused by: java.util.MissingResourceException: Can’t find bundle for base name javax.servlet.LocalStrings, locale pt\_BR  
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)  
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)  
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)  
at javax.servlet.GenericServlet.(GenericServlet.java:95)  
… 52 more

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [May 20, 2015, 2:20pm UTC](https://community.gatling.io/t/can-get-simple-jsonpath-check-to-work/2308/9 "2015-05-20T14:20:05Z")

</div>

Thanks for the information!
