Spring3 “session” scope and IllegalStateException even already defined proxy and RequestCntextListerner

I've got this error when deploying in Websphere 7. but it's working fine in Tomcat 7. It's such a strange behavior.

Unable to instantiate Action, ...: Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean.... In this case, use RequestContextListener or RequestContextFilter to expose the current request.

I use Spring 3 + Struts2 using annotation configuration Here is my configurations:

Action configuration:

@Bean 
@Scope(value="session", proxyMode=ScopedProxyMode.TARGET_CLASS) 
public sws.web.utilization.reports.Action public_utilization_reports(){
    sws.web.utilization.reports.Action action = new sws.web.utilization.reports.Action();       
    return action;
}

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>sws-web</display-name>

<!-- ============================================================================== -->
<!-- Spring Configuration parameters -->
<!-- ============================================================================== -->
<context-param>
    <param-name>contextClass</param-name>
    <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
</context-param>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        sws.domain.config.SWSDomainConfig,      
        sws.web.config.ActionsConfig
    </param-value>
</context-param>


<!-- ============================================================================== -->
<!-- Filters -->
<!-- ============================================================================== -->
<filter>
    <filter-name>ResponseOverrideFilter</filter-name>
    <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>

<filter>
    <filter-name>HibernateSessionConversationFilter</filter-name>
    <filter-class>pnd.core.web.filter.HibernateSessionConversationFilter</filter-class>
    <init-param>
        <param-name>sessionFactoryBeanName</param-name>
        <param-value>hibernateSessionFactory</param-value>
    </init-param>
</filter>

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>HibernateSessionConversationFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>ResponseOverrideFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<!-- ============================================================================== -->
<!-- Listeners -->
<!-- ============================================================================== -->
<!-- Spring Listener -->

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
 <!--Support the scoping of beans at the request, session, and global session levels (web-scoped beans) -->

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


<!-- Struts Tiles Listener -->

<listener>
    <listener-class>
        org.apache.struts2.tiles.StrutsTilesListener
    </listener-class>
</listener>

<welcome-file-list>     
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Please help. Thanks in advance

Answers


I still use jsp version 2.4
and use RequestcontextFiler rather than RequestContextListner. it worked fine.

<filter>
<filter-name>RequestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter>

Need Your Help

Performance issues when performing DB connection check

database

I have build a little library for DB interfacing, but I am concerned about the issues which may arise if I use it in a larger scale application with heavy traffic. My implementation now is:

Cursor coordinates in MATLAB figure

matlab cursor coordinates

I want to find the x and y coordinates of the cursor in a MATLAB figure in real time.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.