首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Spring/Struts从Tomcat到WPS/WAS移植的有关问题

2012-11-10 
Spring/Struts从Tomcat到WPS/WAS移植的问题问题:javax.servlet.ServletException: Unable to instantiate

Spring/Struts从Tomcat到WPS/WAS移植的问题
问题:
javax.servlet.ServletException: Unable to instantiate Action, menuLoginAction,  defined for 'menuLogin' in namespace '/sys'Error creating bean with name 'menuLoginAction': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. - action - file:/C:/W7/profiles/AppSrv01/installedApps/localhostNode01Cell/CmccSzyd.ear/CmccSzydWeb.war/WEB-INF/classes/conf/struts/sys.xml:7:67

问题的本质:
在于struts和Spring对HTTP request的执行顺序要求,先是Spring(会写一些theadlocal的信息),然后才能是Struts.
用户的struts和Spring的定义:

<filter><filter-name>SpringRequestContextFiler</filter-name><filter-class>org.springframework.web.filter.RequestContextFilter</filter-class></filter><filter-mapping><filter-name>SpringRequestContextFiler</filter-name><url-pattern>/*</url-pattern></filter-mapping>

2. 作个假的servlet,servlet什么也不处理,并设置servlet mapping为"/*",这样的话,就是先执行Spring的listener.

热点排行