[Gatling 2.0.0.M3a] Action HttpRequestAction crashed

Hello:

I am using Gatling 2.0.0-M3a to record the script. When running the script, gatling report some error messages, How can i deal with it?

The recorded scripts looks like :

val httpProtocol = http
.baseURL(“https://xxx:9443”)
.acceptHeader("/")
.acceptCharsetHeader(“iso-8859-1,*,utf-8”)
.acceptEncodingHeader(“gzip,deflate,sdch”)
.acceptLanguageHeader(“zh-CN,zh;q=0.8”)
.connection(“keep-alive”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36”)

val headers_61 = Map(
“”“Accept”"" → “”“application/json”"",
“”“Content-Type”"" → “”“application/x-www-form-urlencoded”"",
“”“X-Requested-With”"" → “”“XMLHttpRequest”"")

… …

val chain_1 =
exec(http(“request_83”)
.get("""/rest/…""")
.headers(headers_61)
)

The Error Message looks like below:

[ERROR] [03/09/2014 23:29:50.178] [GatlingSystem-akka.actor.default-dispatcher-13] [akka://GatlingSystem/user/$o] null
java.lang.NullPointerException
at io.gatling.http.cookie.CookieJar$.domainMatches(CookieJar.scala:30)
at io.gatling.http.cookie.CookieJar.io$gatling$http$cookie$CookieJar$$matchSubDomain$1(CookieJar.scala:126)
at io.gatling.http.cookie.CookieJar$$anonfun$1$$anonfun$applyOrElse$1.apply(CookieJar.scala:129)
at io.gatling.http.cookie.CookieJar$$anonfun$1$$anonfun$applyOrElse$1.apply(CookieJar.scala:129)
at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263)
at scala.collection.AbstractTraversable.filter(Traversable.scala:105)
at io.gatling.http.cookie.CookieJar$$anonfun$1.applyOrElse(CookieJar.scala:129)
at io.gatling.http.cookie.CookieJar$$anonfun$1.applyOrElse(CookieJar.scala:129)
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33)
at scala.collection.TraversableLike$$anonfun$collect$1.apply(TraversableLike.scala:278)
at scala.collection.immutable.Map$Map1.foreach(Map.scala:109)
at scala.collection.TraversableLike$class.collect(TraversableLike.scala:278)
at scala.collection.AbstractTraversable.collect(Traversable.scala:105)
at io.gatling.http.cookie.CookieJar.get(CookieJar.scala:129)
at io.gatling.http.cookie.CookieHandling$$anonfun$getStoredCookies$1.apply(CookieHandling.scala:33)
at io.gatling.http.cookie.CookieHandling$$anonfun$getStoredCookies$1.apply(CookieHandling.scala:33)
at scala.Option.map(Option.scala:145)
at io.gatling.http.cookie.CookieHandling$.getStoredCookies(CookieHandling.scala:33)
at io.gatling.http.cookie.CookieHandling$.getStoredCookies(CookieHandling.scala:29)
at io.gatling.http.request.builder.AbstractHttpRequestBuilder.io$gatling$http$request$builder$AbstractHttpRequestBuilder$$configureQueryCookiesAndProxy$1(AbstractHttpRequestBuilder.scala:156)
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$getAHCRequestBuilder$2.apply(AbstractHttpRequestBuilder.scala:198)
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$getAHCRequestBuilder$2.apply(AbstractHttpRequestBuilder.scala:198)
at io.gatling.core.validation.Success.flatMap(Validation.scala:27)
at io.gatling.http.request.builder.AbstractHttpRequestBuilder.getAHCRequestBuilder(AbstractHttpRequestBuilder.scala:198)
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$build$1.apply(AbstractHttpRequestBuilder.scala:208)
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$build$1.apply(AbstractHttpRequestBuilder.scala:208)
at io.gatling.http.action.HttpRequestAction$$anonfun$1.apply(HttpRequestAction.scala:82)
at io.gatling.http.action.HttpRequestAction$$anonfun$1.apply(HttpRequestAction.scala:81)
at io.gatling.core.validation.Success.flatMap(Validation.scala:27)
at io.gatling.http.action.HttpRequestAction.execute(HttpRequestAction.scala:81)
at io.gatling.core.action.Action$$anonfun$receive$1.applyOrElse(Action.scala:27)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:166)
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)

23:29:50.180 [ERROR] i.g.h.a.HttpRequestAction - Action HttpRequestAction crashed, forwarding user to next one
java.lang.NullPointerException: null
at io.gatling.http.cookie.CookieJar$.domainMatches(CookieJar.scala:30) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieJar.io$gatling$http$cookie$CookieJar$$matchSubDomain$1(CookieJar.scala:126) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieJar$$anonfun$1$$anonfun$applyOrElse$1.apply(CookieJar.scala:129) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieJar$$anonfun$1$$anonfun$applyOrElse$1.apply(CookieJar.scala:129) ~[gatling-http-2.0.0.20130628.jar:na]
at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264) ~[na:na]
at scala.collection.immutable.List.foreach(List.scala:318) ~[na:na]
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263) ~[na:na]
at scala.collection.AbstractTraversable.filter(Traversable.scala:105) ~[na:na]
at io.gatling.http.cookie.CookieJar$$anonfun$1.applyOrElse(CookieJar.scala:129) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieJar$$anonfun$1.applyOrElse(CookieJar.scala:129) ~[gatling-http-2.0.0.20130628.jar:na]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) ~[na:na]
at scala.collection.TraversableLike$$anonfun$collect$1.apply(TraversableLike.scala:278) ~[na:na]
at scala.collection.immutable.Map$Map1.foreach(Map.scala:109) ~[na:na]
at scala.collection.TraversableLike$class.collect(TraversableLike.scala:278) ~[na:na]
at scala.collection.AbstractTraversable.collect(Traversable.scala:105) ~[na:na]
at io.gatling.http.cookie.CookieJar.get(CookieJar.scala:129) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieHandling$$anonfun$getStoredCookies$1.apply(CookieHandling.scala:33) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieHandling$$anonfun$getStoredCookies$1.apply(CookieHandling.scala:33) ~[gatling-http-2.0.0.20130628.jar:na]
at scala.Option.map(Option.scala:145) ~[na:na]
at io.gatling.http.cookie.CookieHandling$.getStoredCookies(CookieHandling.scala:33) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.cookie.CookieHandling$.getStoredCookies(CookieHandling.scala:29) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.request.builder.AbstractHttpRequestBuilder.io$gatling$http$request$builder$AbstractHttpRequestBuilder$$configureQueryCookiesAndProxy$1(AbstractHttpRequestBuilder.scala:156) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$getAHCRequestBuilder$2.apply(AbstractHttpRequestBuilder.scala:198) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$getAHCRequestBuilder$2.apply(AbstractHttpRequestBuilder.scala:198) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.core.validation.Success.flatMap(Validation.scala:27) ~[gatling-core-2.0.0.20130628.jar:na]
at io.gatling.http.request.builder.AbstractHttpRequestBuilder.getAHCRequestBuilder(AbstractHttpRequestBuilder.scala:198) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$build$1.apply(AbstractHttpRequestBuilder.scala:208) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.request.builder.AbstractHttpRequestBuilder$$anonfun$build$1.apply(AbstractHttpRequestBuilder.scala:208) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.action.HttpRequestAction$$anonfun$1.apply(HttpRequestAction.scala:82) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.action.HttpRequestAction$$anonfun$1.apply(HttpRequestAction.scala:81) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.core.validation.Success.flatMap(Validation.scala:27) ~[gatling-core-2.0.0.20130628.jar:na]
at io.gatling.http.action.HttpRequestAction.execute(HttpRequestAction.scala:81) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.core.action.Action$$anonfun$receive$1.applyOrElse(Action.scala:27) ~[gatling-core-2.0.0.20130628.jar:na]
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:166) ~[na:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) ~[akka-actor_2.10-2.1.4.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:386) ~[akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) ~[akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:212) ~[akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.4.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [na:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [na:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [na:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [na:na]

Hi,

Could you check if you can reproduce with current snapshot, please?
https://github.com/excilys/gatling/wiki/Continuous-Integration

I can help migrating.

Cheers,
Stéphane

Hi, Stéphane, Thanks a lot for your quick response!

I download the snapshot from below URL according the wiki page :
https://oss.sonatype.org/content/repositories/snapshots/io/gatling/highcharts/gatling-charts-highcharts/2.0.0-SNAPSHOT/.

Firstly, I’d like to record scripts again using 2.0.0-SNAPSHOT, but failed to do that, I will report it in another subject.

Then I tried to migrated the scripts with below changing:
a. Remove the imports: bootstrap._ and assertions._
b. Change ramp to rampUsers.

Running the modifed scripts on 2.0.0-SNAPSHOT with JDK 7, it report similar error message like below:

09:44:45.457 [WARN ] i.g.h.r.b.HttpRequestExpressionBuilder - Failed to build request
java.lang.NullPointerException: null
at io.gatling.http.cookie.CookieJar$.io$gatling$http$cookie$CookieJar$$requestDomain(CookieJar.scala:29) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.cookie.CookieJar.get(CookieJar.scala:129) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.cookie.CookieHandling$.getStoredCookies(CookieHandling.scala:34) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder.configureCookies(RequestExpressionBuilder.scala:61) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder$$anonfun$configureRequestBuilder$1.apply(RequestExpressionBuilder.scala:111) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder$$anonfun$configureRequestBuilder$1.apply(RequestExpressionBuilder.scala:111) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.core.validation.Success.flatMap(Validation.scala:32) [gatling-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder.configureRequestBuilder(RequestExpressionBuilder.scala:111) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.HttpRequestExpressionBuilder.configureRequestBuilder(HttpRequestExpressionBuilder.scala:72) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder$$anonfun$build$1$$anonfun$apply$5.apply(RequestExpressionBuilder.scala:134) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder$$anonfun$build$1$$anonfun$apply$5.apply(RequestExpressionBuilder.scala:133) ~[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.core.validation.Success.flatMap(Validation.scala:32) [gatling-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder$$anonfun$build$1.apply(RequestExpressionBuilder.scala:133) [gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.request.builder.RequestExpressionBuilder$$anonfun$build$1.apply(RequestExpressionBuilder.scala:118) [gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.action.HttpRequestAction.sendRequest(HttpRequestAction.scala:84) [gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.action.RequestAction$$anonfun$executeOrFail$1.apply(RequestAction.scala:33) [gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.action.RequestAction$$anonfun$executeOrFail$1.apply(RequestAction.scala:31) [gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.core.validation.Success.flatMap(Validation.scala:32) [gatling-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.action.RequestAction.executeOrFail(RequestAction.scala:31) [gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.core.action.Failable$class.execute(Actions.scala:97) [gatling-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.http.action.RequestAction.execute(RequestAction.scala:25)[gatling-http-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at io.gatling.core.action.Action$$anonfun$receive$1.applyOrElse(Actions.scala:30) [gatling-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:166) [scala-library-2.10.4-RC3.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498) [akka-actor_2.10-2.2.4.jar:2.2.4]
at akka.actor.ActorCell.invoke(ActorCell.scala:456) [akka-actor_2.10-2.2.4.jar:2.2.4]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237) [akka-actor_2.10-2.2.4.jar:2.2.4]
at akka.dispatch.Mailbox.run(Mailbox.scala:219) [akka-actor_2.10-2.2.4.jar:2.2.4]
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:385) [akka-actor_2.10-2.2.4.jar:2.2.4]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)[scala-library-2.10.4-RC3.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.10.4-RC3.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.10.4-RC3.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.10.4-RC3.jar:na]
09:44:45.467 [ERROR] i.g.h.a.HttpRequestAction - Failed to build request: null

Hi,

I don’t get how that’s possible, but it seems that you’re trying to build an URI with a null host.
Does it ring a bell to you?

Stéphane

Hi, Stéphane, Thanks for so quickly response! 8- )

I highly doubt that the issue is related the special URI which including some empty char, like:
https://xxx:9443/rest/…&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID ASC&…”

Running with this URL on [Gatling 2.0.0.M3a], it will report error message like:

java.net.URISyntaxException: Illegal character in query at index 297: https://xxx:9443/rest/…&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID ASC&…
at java.net.URI$Parser.fail(URI.java:2809) ~[na:1.6.0]
at java.net.URI$Parser.checkChars(URI.java:2982) ~[na:1.6.0]
at java.net.URI$Parser.parseHierarchical(URI.java:3072) ~[na:1.6.0]
at java.net.URI$Parser.parse(URI.java:3014) ~[na:1.6.0]
at java.net.URI.(URI.java:578) ~[na:1.6.0]
at java.net.URI.create(URI.java:840) ~[na:1.6.0]
Wrapped by: java.lang.IllegalArgumentException: null
at java.net.URI.create(URI.java:842) ~[na:1.6.0]
at com.ning.http.client.RequestBuilderBase$RequestImpl.toURI(RequestBuilderBase.java:215) ~[async-http-client-1.7.18.20130621.jar:na]
at com.ning.http.client.RequestBuilderBase$RequestImpl.getRawURI(RequestBuilderBase.java:162) ~[async-http-client-1.7.18.20130621.jar:na]
at com.ning.http.client.RequestBuilderBase$RequestImpl.getRawUrl(RequestBuilderBase.java:147) ~[async-http-client-1.7.18.20130621.jar:na]
at io.gatling.highcharts.gatling_highcharts_maven_archetype.RecordedSimulation$$anonfun$1.apply(RecordedSimulation.scala:76) ~[test-classes/:na]
at io.gatling.highcharts.gatling_highcharts_maven_archetype.RecordedSimulation$$anonfun$1.apply(RecordedSimulation.scala:74) ~[test-classes/:na]
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$1.apply(AsyncHandlerActor.scala:89) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$1.apply(AsyncHandlerActor.scala:89) ~[gatling-http-2.0.0.20130628.jar:na]
at scala.Option.map(Option.scala:145) ~[na:na]
at io.gatling.http.ahc.AsyncHandlerActor.logRequest(AsyncHandlerActor.scala:89) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor.ok(AsyncHandlerActor.scala:117) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor.checkAndProceed$1(AsyncHandlerActor.scala:166) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor.io$gatling$http$ahc$AsyncHandlerActor$$processResponse(AsyncHandlerActor.scala:176) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$receive$1.applyOrElse(AsyncHandlerActor.scala:55) [gatling-http-2.0.0.20130628.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) [akka-actor_2.10-2.1.4.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:386) [akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) [akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:212) [akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.4.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [na:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [na:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [na:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [na:na]

Then, I wrapped the URI with URLEncoder.encode(…). Now, I highly doubt the beginning error message was related this URLEncoder.encode(…), I need to remove it and try again , but the question is how to deal with such special URI which including the empty char?

Stéphane Landelle於 2014年3月10日星期一UTC+8下午1時21分11秒寫道:

I don’t think the problem is related to unencoded chars in the path.
The problem really seems to be with the host.

Here’s a replacement for gatling-http jar that would throw an Exception if the host was null. Could you give it a try, please?

Regarding spaces in the query, this is not valid HTTP. Those are supposed to be URLencoded. java.net.URI respects the RFC on this point, and most java HTTP clients are based on this class (AsyncHttpClient, Apache HttpComponents, Jetty client…). Sadly, browsers don’t and are very permissive, not encouraging people to fix their implementation and turning the internet into a mess. I’m actually working on AsyncHttpClient in order to make it permissive as well :frowning:

gatling-http-2.0.0-SNAPSHOT.jar (984 KB)

Hi, Stéphane:

a. From below testing 1, 2, 3, I think that the beginning error message
is related to use the URLEncoder.encode(..) to wrap original URI.

2 probably means that there's another character that wasn't encoded.
3 is wrong: that's not how you use URLEncoder.encode, please read the
javadoc. It is used to encode query parameter names and values, not the
full query, otherwise you end up encoding all the characters, for example
the "=" and "&".

b. From below testing 1, 2, it looks like gatling have some trouble to
deal with the URL including the empty char or %20 .

See above, I think 2 is not complete.
And as I said, empty char is not valid according to the RFC.

c. From below testing 4, it was the output when useing the attached jar
file.

Is "https://xxx:9443/rest/…&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID
ASC&…" the real url (appart from the anonymized host)?
If not, could you provide the full url? We're playing riddles here.

Stéphane Landelle於 2014年3月10日星期一UTC+8下午7時15分38秒寫道:

a. From below testing 1, 2, 3, I think that the beginning error message is related to use the URLEncoder.encode(…) to wrap original URI.

2 probably means that there’s another character that wasn’t encoded.
3 is wrong: that’s not how you use URLEncoder.encode, please read the javadoc. It is used to encode query parameter names and values, not the full query, otherwise you end up encoding all the characters, for example the “=” and “&”.

There is no other special characters in URL, One simple URL is :
“/rest/TASKSLIST?selectedAttributes=TKIID&interactionFilter=ASSESS_AND_WORK_ON&size=26&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID ASC”

When remove “&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID ASC” from above url like below , the Gatling works and won’t throw out the exception. (but the testing is required to use the full url not just part of them).
“/rest/TASKSLIST?selectedAttributes=TKIID&interactionFilter=ASSESS_AND_WORK_ON&size=26”

So I think the questions now is how to deal with the URL containing the empty char (though it is not a good HTTP URL) … 8- )

There is no other special characters in URL, One simple URL is :

"/rest/TASKSLIST?selectedAttributes=TKIID&interactionFilter=ASSESS_AND_WORK_ON&size=26&sortAttributes=IS_AT_RISK
DESC,DUE ASC,TKIID ASC"

Yes there is. For example, comma should be %2C.

When remove "&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID ASC" from above
url like below , the Gatling works and won't throw out the exception. (but
the testing is required to use the full url not just part of them).

"/rest/TASKSLIST?selectedAttributes=TKIID&interactionFilter=ASSESS_AND_WORK_ON&size=26"

So I think the questions now is how to deal with the URL containing the
empty char (though it is not a good HTTP URL) ... 8- )

"/rest/TASKSLIST?selectedAttributes=TKIID&interactionFilter=ASSESS_AND_WORK_ON&size=26&sortAttributes="
+ UrlEncoder.encode("IS_AT_RISK DESC,DUE ASC,TKIID ASC", "UTF-8")

With URLEncoder.encode(…), the beginning Error message is gone, but Gatling threw out a Warning Message like below.

22:15:45.453 [WARN ] i.g.h.a.AsyncHandlerActor - Encountered error while extracting extra request info
java.net.URISyntaxException: Illegal character in query at index 297: https://xxx:9443/rest/…&sortAttributes=IS_AT_RISK DESC,DUE ASC,TKIID ASC&…
at java.net.URI$Parser.fail(URI.java:2809) ~[na:1.6.0]
at java.net.URI$Parser.checkChars(URI.java:2982) ~[na:1.6.0]
at java.net.URI$Parser.parseHierarchical(URI.java:3072) ~[na:1.6.0]
at java.net.URI$Parser.parse(URI.java:3014) ~[na:1.6.0]
at java.net.URI.(URI.java:578) ~[na:1.6.0]
at java.net.URI.create(URI.java:840) ~[na:1.6.0]
Wrapped by: java.lang.IllegalArgumentException: null
at java.net.URI.create(URI.java:842) ~[na:1.6.0]
at com.ning.http.client.RequestBuilderBase$RequestImpl.toURI(RequestBuilderBase.java:215) ~[async-http-client-1.7.18.20130621.jar:na]
at com.ning.http.client.RequestBuilderBase$RequestImpl.getRawURI(RequestBuilderBase.java:162) ~[async-http-client-1.7.18.20130621.jar:na]
at com.ning.http.client.RequestBuilderBase$RequestImpl.getRawUrl(RequestBuilderBase.java:147) ~[async-http-client-1.7.18.20130621.jar:na]
at io.gatling.highcharts.gatling_highcharts_maven_archetype.RecordedSimulation$$anonfun$1.apply(RecordedSimulation.scala:483) ~[test-classes/:na]
at io.gatling.highcharts.gatling_highcharts_maven_archetype.RecordedSimulation$$anonfun$1.apply(RecordedSimulation.scala:481) ~[test-classes/:na]
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$1.apply(AsyncHandlerActor.scala:89) ~[gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$1.apply(AsyncHandlerActor.scala:89) ~[gatling-http-2.0.0.20130628.jar:na]
at scala.Option.map(Option.scala:145) ~[na:na]
at io.gatling.http.ahc.AsyncHandlerActor.logRequest(AsyncHandlerActor.scala:89) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor.ok(AsyncHandlerActor.scala:117) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor.checkAndProceed$1(AsyncHandlerActor.scala:166) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor.io$gatling$http$ahc$AsyncHandlerActor$$processResponse(AsyncHandlerActor.scala:176) [gatling-http-2.0.0.20130628.jar:na]
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$receive$1.applyOrElse(AsyncHandlerActor.scala:55) [gatling-http-2.0.0.20130628.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) [akka-actor_2.10-2.1.4.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:386) [akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) [akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:212) [akka-actor_2.10-2.1.4.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.4.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [na:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [na:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [na:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [na:na]

I am wondering if this URL have been called successfully, so using below method to print some message for each url. Other url calling can print out message Except this url calling. So it looks like the URL was still failed to be called.

.extraInfoExtractor( (status,session,request,response) =>
status match {
case _ => List( response.getStatusCode() + " : " + session(“username”).as[String] + " : " + response.getStatusText + " : " + request.getRawUrl() )
})

response.getStatusCode and response.getStatusText will throw an exception if the response was never received (ConnectionTimeout, Request timeout, etc).

Hi, Stéphane :

Thanks for your patient to answer my questions … 8- )

One more update is that, I have downloaded the latest 2.0 Snapshot (March. 10 version) from below link, record scripts again, the special char. was converted to the %xx chars in the new generated URL, then try to run the new scripts again, it looks like the issues were gone. I would like continue to try this new version.

https://oss.sonatype.org/content/repositories/snapshots/io/gatling/highcharts/gatling-charts-highcharts/2.0.0-SNAPSHOT/gatling-charts-highcharts-2.0.0-SNAPSHOT-bundle.zip

One more question is that the gatling-charts-highcharts-2.0.0-SNAPSHOT-bundle.zip is the command line , how can I build up the Eclipse based IDE environment with this new version gatling? So that it is easier to write scripts in Eclipse …

Just use the same procedure than in Gatling 1, but use https://oss.sonatype.org/content/repositories/snapshots/archetype-catalog.xml for the archetype catalog. 2M4 will be on central.

Hi, Stéphane :

Sorry, but another question to setup the IDE for Gatling 2.0.0 Snapshot, I can create Gatling IDE environment with 2.0M3a, but failed to create on 2.0.0Snapshot and Maven project can’t be created, the screenshot “step3.png” is the error message, the screenshot step1, step2 are my step, would you mind let me know which step is incorrect?

Stéphane Landelle於 2014年3月11日星期二UTC+8下午5時19分33秒寫道:

step3.png

No idea. Maybe clicking on “Details” on step 3 would provide more information.
Also beware that Gatling 2 uses Scala 2.10, so make sure you pick the right ScalaIDE version.

The “Details” box gave message like below:

Unable to create project from archetype [io.gatling.highcharts:gatling-highcharts-maven-archetype:2.0.0-SNAPSHOT → https://oss.sonatype.org/content/repositories/snapshots]
The defined artifact is not an archetype

I just removed the archetype from my local repo, set up the archetype and created a project with it.
It went perfectly fine, as expected.

I suspect something like a broken download that stays in eclipse’s cache. Maybe removing the archetype from your local repository and restarting eclipse could help.

I won’t be able to help any further, the problem is really on your side.