First of all, I like to thank you for reviewing this problem, and provide any help -- to which I am very grateful!
I have developed an application in Spring MVC framework (3.1.1) in Openshift environment. I have tested and been satisfied with its functionality.
When I loaded the appl for performance tests on Grinder, I received the following message, a lot of them:
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[MVCDispatcher]] (http-/127.8.157.1:8080-5) JBWEB000236: Servlet.service() for servlet MVCDispatcher threw exception: org.springframework.web.HttpSessionRequiredException: Expected session attribute 'session_account'
In my appl, session_account is a session attribute (defined by @SessionAttribute({...})) in 3 classes. It is also defined as a @ModelAttribute.
One of these 3 classes is LoginController.java, which initializes session_account by a method annotated by @ModelAttribute ("session_account"). It also contains REST services which authenticate users, and sets value to session_account after authentication. My functional test (seems) confirmed that every authenticated user had session_account defined.
Now comes performance tests on Grinder. Here are a few observations:
Most test scripts produced a large number of above mentioned error message;
When I limited Grinder runs to one user with a single (java) thread, no error. As soon as I relaxed the environment to more than one user OR multiple (java) threads, this error message occurred;
The error message seems to be from the Spring layer. I had a hard time to map it to my application code (lines)
In my application log, this error (line) frequently appears after a line with a later timestamp, e.g.:
2014/03/03 13:44:22,930 INFO [org.SandRiver.Controllers.JspController] (http-127.8.157.1/127.8.157.1:8080-32) home page
2014/03/03 13:44:22,822 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[MVCDispatcher]] (http-127.8.157.1/127.8.157.1:8080-54) JBWEB000236: Servlet.service() for servlet MVCDispatcher threw exception: org.springframework.web.HttpSessionRequiredException: Expected session attribute 'session_account'
I googled "Expected session attribute", and consulted related chapters in Spring documentation. Unfortunately, I am still here for help.
I have been so lost that I even have little idea regarding which files/code snippets are relevant to this problem. Here is the web.mxl but would be happy to provide more if asked.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true" version="3.0">
<display-name>LiquibilClient</display-name>
<servlet>
<servlet-name>MVCDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MVCDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/MVCDispatcher-servlet.xml,
/WEB-INF/applicationContext.xml,
/WEB-INF/application-security.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.security.web.session.HttpSessionEventPublisher
</listener-class>
</listener>
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>