# Error with 302

**URL:** <https://community.gatling.io/t/error-with-302/4066>\
**Category:** Gatling (Open-Source)\
**Created:** [November 28, 2017, 10:13am UTC](https://community.gatling.io/t/error-with-302/4066 "2017-11-28T10:13:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davide\_Raffaele\_Marr](https://avatars.discourse-cdn.com/v4/letter/d/3e96dc/32.png) [@Davide\_Raffaele\_Marr](https://community.gatling.io/u/Davide_Raffaele_Marr)\
**Post date:** [November 28, 2017, 10:13am UTC](https://community.gatling.io/t/error-with-302/4066/1 "2017-11-28T10:13:27Z")

</div>

Goodmorning everyone,  
I’m starting to use gatling and I found a strange behavior in analyzing my application.

I’m using this simulation class :

> > class login extends Simulation {
> 
> > 
> 
> > val httpProtocol = http
> 
> > .baseURL(“[http://app.myapp.net](http://app.myapp.net)”)
> 
> > .disableFollowRedirect
> 
> > .inferHtmlResources(BlackList(“”“._.js"“”, “”"._.css”“”, “”“._.gif"“”, “”"._.jpeg”“”, “”“._.jpg"“”, “”"._.ico”“”, “”“._.woff"“”, “”"._.(t|o)tf”“”, “”“._.png"“”, “”"._.txt”“”, “”“.\*.dwr”“”), WhiteList())
> 
> > .acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,_/_;q=0.8”)
> 
> > .acceptEncodingHeader(“gzip, deflate”)
> 
> > .acceptLanguageHeader(“it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3”)
> 
> > .userAgentHeader(“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0”)
> 
> > 
> 
> > val headers\_0 = Map(“Upgrade-Insecure-Requests” → “1”)
> 
> > 
> 
> > val headers\_4 = Map(
> 
> > “Accept” → “application/json, text/javascript, _/_; q=0.01”,
> 
> > “Content-Type” → “application/x-www-form-urlencoded”,
> 
> > “X-Requested-With” → “XMLHttpRequest”)
> 
> > 
> 
> > val uri1 = “[http://app.myapp.net/myapp](http://app.myapp.net/myapp)”
> 
> > 
> 
> > val scn = scenario(“login”)
> 
> > .exec(http(“access”)
> 
> > .get(“/myapp/web”)
> 
> > .headers(headers\_0)
> 
> > .resources(http(“login\_access”)
> 
> > .get(“/myapp/web/login”)
> 
> > .headers(headers\_0))
> 
> > .check(status.is(302)))
> 
> > .pause(4)
> 
> > .exec(http(“login”)
> 
> > .post(“/myapp/j\_spring\_security\_check”)
> 
> > .headers(headers\_0)
> 
> > .formParam(“j\_username”, “user”)
> 
> > .formParam(“j\_password”, “password”)
> 
> > .resources(http(“welcome”)
> 
> > .get(“/myapp/web/contabilita/cruscottoCed/accesso?welcome=true”)
> 
> > .headers(headers\_0))
> 
> > .check(status.is(302)))
> 
> > .pause(1)
> 
> > .exec(http(“cruscotto”)
> 
> > .get(“/myapp/cxf/contabilita/cruscottoCed/listgrid?filterscount=0&groupscount=0&pagenum=0&pagesize=25&recordstartindex=0&recordendindex=25&\_=1511801628236”)
> 
> > .headers(headers\_4))
> 
> > .pause(1)
> 
> > .exec(http(“doc list”)
> 
> > .get(“/myapp/web/contabilita/documento/accesso”)
> 
> > .headers(headers\_0))
> 
> > .pause(1)
> 
> > .exec(http(“doc emessi”)
> 
> > .get(“/myapp/cxf/contabilita/documento/listgrid?filterscount=0&groupscount=0&pagenum=0&pagesize=25&recordstartindex=0&recordendindex=25&field\_t\_\_totale=number&field\_t\_\_annoContabile=number&field\_t\_\_dataContabilizzazione=date&field\_t\_\_dataEmissione=date&field\_t\_\_numeroProtocollo=number&field\_tdo\_\_attivoPassivo=number&griglia=emessi&\_=1511801632715”)
> 
> > .headers(headers\_4)
> 
> > .resources(http(“doc suggeriti”)
> 
> > .get(“/myapp/cxf/contabilita/documento/listgrid?filterscount=0&groupscount=0&pagenum=0&pagesize=25&recordstartindex=0&recordendindex=25&field\_t\_\_totale=number&field\_t\_\_annoContabile=number&field\_t\_\_dataContabilizzazione=date&field\_t\_\_dataEmissione=date&field\_t\_\_numeroProtocollo=number&field\_tdo\_\_attivoPassivo=number&griglia=suggeriti&\_=1511801633219”)
> 
> > .headers(headers\_4),
> 
> > http(“logout”)
> 
> > .get(“/myapp/j\_spring\_security\_logout”)
> 
> > .headers(headers\_0)
> 
> > .check(status.is(302)),
> 
> > http(“bye”)
> 
> > .get(“/myapp/web/login/bye”)
> 
> > .headers(headers\_0)))
> 
> > 
> 
> > setUp(scn.inject(atOnceUsers(5))).protocols(httpProtocol)
> 
> > }

Executing the class (for more than 1 user), for the “cruscotto”, “doc emessi” and “doc suggeriti” request (are web service called from view with ajax) i get 302 HTTP result. Specifically, the application returns an “expired session” error. The odd thing is that only a percentage generates this error.

[![](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/7/794cf27f34d14a5e419747700794f9e3da76cc18.png)](https://lh3.googleusercontent.com/-3tVPM6zH8lM/Wh01kjK-XgI/AAAAAAAAAFw/lopXp8-1QNwk54t6TGygT4jVxnn2KGeCQCLcBGAs/s1600/stats.PNG)

[![](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/c/c4ff77fb137731a1fd10409124832f48ac947279.png)](https://lh3.googleusercontent.com/-7h2GrjACiVk/Wh02Z_58jlI/AAAAAAAAAF4/GDgedwXqT5wVnumlUQbqEf2SK9BwzKu3wCLcBGAs/s1600/req.PNG)

Is an access configuration error of my application?  
Or depends on wrong gatling configuration?
