Websphere6.x cannot use spring's session scope to inject objects in a solution

Source: Internet
Author: User
Tags aop stringbuffer


Spring AOP has been used to inject some of the session scope objects, but today the following exceptions occur when deploying such applications:
[09-12-25 14:50:52:562 CST] 0000003f WebApp E srve0026e: [Servlet error]-[filter [Identityfilter]: Filter is Unav Ailable.]:org.springframework.beans.factory.beancreationexception:error creating bean with Name ' Scopedtarget.sessionuser ': Scope ' session ' isn't active for the current thread; Consider defining a scoped proxy for this beans if you are intend to refer to it from Singleton; Nested exception is Java.lang.IllegalStateException:No thread-bound request Found:are your referring to request attribute s outside of an actual Web request? If you are are actually operating within a Web request and still receive this message,your the code is probably running outside of Dispatcherservlet/dispatcherportlet:in this case, use Requestcontextlistener or requestcontextfilter to expose the Curre NT request.
caused By:java.lang.IllegalStateException:No thread-bound request Found:are you referring to request attributes outside of an actual Web request? If you are are actually operating within a Web request and still receive this message,your the code is probably running outside of Dispatcherservlet/dispatcherportlet:in this case, use Requestcontextlistener or requestcontextfilter to expose the Curre NT request.
At Org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes ( REQUESTCONTEXTHOLDER.JAVA:102)
At Org.springframework.web.context.request.SessionScope.get (sessionscope.java:88)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:285)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:160)
At Org.springframework.aop.target.SimpleBeanTargetSource.getTarget (simplebeantargetsource.java:33)
At Org.springframework.aop.framework.cglib2aopproxy$dynamicadvisedinterceptor.gettarget (Cglib2AopProxy.java:661 )
At Org.springframework.aop.framework.cglib2aopproxy$dynamicadvisedinterceptor.intercept (Cglib2AopProxy.java:611 )
At .....
At Java.lang.String.valueOf (String.java (inlined Compiled Code))
At Java.lang.StringBuffer.append (Stringbuffer.java (Compiled Code))
...
After half a day of information, there is no one to solve, there is no way, there is spring to look at the document, and finally the Web.xml file used in the listener to filter the problem solved, is to
<listener> <listener-class> Org.springframework.web.context.request.RequestContextListener </ Listener-class> </listener>
Change into
<filter> <filter-name>requestContextFilter</filter-name> <filter-class> Org.springframework.web.filter.requestcontextfilter</filter-class> </filter> <filter-mapping> <filter-name>requestContextFilter</filter-name> <url-pattern>/*</url-pattern> </ Filter-mapping>

But the specific reason is still not clear, and then have time to take a good look.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.