我正在尝试混合使用Apache Shiro的两个Web示例应用程序:
https://github.com/vaadin-kim/shiro-example
https://github.com/stormpath/shiro-hazelcast-web-sample
我为vaadin分配了shiro-example并在模块shiro-login-outside-vaadin-app下进行了更改:
https://github.com/poseidonjm/shiro-example
git clone https://github.com/poseidonjm/shiro-example.git
cd shiro-example
cd shiro-login-outside-vaadin-app
mvn package
我将.war文件部署到Apache Tomcat 7,登录后我得到了下一个异常:
javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.IllegalMonitorStateException
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
causa raíz
com.vaadin.server.ServiceException: java.lang.IllegalMonitorStateException
com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1429)
com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1383)
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
causa raíz
java.lang.IllegalMonitorStateException
java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:155)
java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1260)
java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:460)
com.vaadin.server.VaadinService.unlockSession(VaadinService.java:615)
com.vaadin.server.VaadinService.findOrCreateVaadinSession(VaadinService.java:633)
com.vaadin.server.VaadinService.findVaadinSession(VaadinService.java:495)
com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1365)
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
shiro.ini
[main]
# use native session management so we can configure our own session clustering:
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionDAO = $sessionDAO
# we have configured Hazelcast to enforce a TTL for the activeSessions Map. No need for Shiro to invalidate!
sessionManager.sessionValidationSchedulerEnabled = false
securityManager.sessionManager = $sessionManager
# configure Hazelcast as our Shiro CacheManager. Adding session capacity is as easy as adding hazelcast nodes!
cacheManager = com.stormpath.samples.shiro.hazelcast.cache.HazelcastCacheManager
securityManager.cacheManager = $cacheManager
shiro.loginUrl = /login.jsp
[users]
# format: username = password, role1, role2, ..., roleN
demo = demo
[urls]
/login.jsp = authc
/logout = logout
/VAADIN/** = authc
/** = authc
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="vaadin-uitest" version="3.0"
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_3_0.xsd">
<display-name>assembly</display-name>
<context-param>
<description>
Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
</filter>
<!-- Make sure any request you want accessible to Shiro is filtered. /*
catches all -->
<!-- requests. Usually this filter mapping is defined first (before all
others) to -->
<!-- ensure that Shiro works in subsequent filters in the filter chain: -->
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
</web-app>
欢迎任何帮助。 感谢。