Error with 302

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”)

.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

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.

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