日期:2014-05-17  浏览次数:20645 次

struts2 + spring3 + shiro 在was7服务器下出错,请大神看看
最近项目需要集成shiro
我在本地已经开发完成,能够运行。但是我将代码部署在was7服务器下时,可以启动,但是无法登陆。
登陆的时候,运行到Subject user = SecurityUtils.getSubject();这段代码的时候
一直报错:No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton.  This is an invalid application configuration.
项目用的是 struts2 + spring2.5.6 +  shiro1.2.2
本地用的是tomcat,运行完全没问题,目前不知道咋个解决了,请大神帮忙看看,谢谢。非常急
我的XML配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>cdp</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/spring/*.xml,classpath*:/shiro/applicationContext_*.xml</param-value>
</context-param>
<!--  <context-param>
<param-name>contextClass</param-name>
<param-value>org.jboss.spring.vfs.context.VFSXmlWebApplicationContext</param-value>
</context-param> -->
<!-- Shiro Security filter -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
  <param-value>true</param-value>
  </init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>*.do</url-pattern>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.html</url-pattern>
<url-pattern>/*</url-pattern>
<!--  <dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher> -->
</filter-mapping>
<!-- GJZHU ADD 20120906 -->
<filter>
<filter-name>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>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<!--过滤器名字 -->
<filter-name>struts2</filter-name>
<!-- 过滤器支持的struts2类 -->
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<!--过滤器拦截名字 -->
<filter-name>struts2</f