-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi.
I'm using zk CE 6.5.2 and Shiro 1.2.2. I'm using Jetty8 Maven plugin (for development), but it also happens on Tomcat7 (Continuous Integration) when deployed.
When doing the following:
SecurityUtils.getSubject().logout();
Executions.sendRedirect("/");
I get a NullPointerException dialog in zk, before the redirect kicks in. I get the following error in my log:
org.zkoss.zk.ui.impl.UiEngineImpl handleError:1359 SEVERE: java.lang.NullPointerException at org.zkoss.zk.ui.AbstractComponent.getAttachedUiEngine(AbstractComponent.java:337) at org.zkoss.zk.ui.AbstractComponent.disableClientUpdate(AbstractComponent.java:1765) at org.zkoss.zul.Popup.service(Popup.java:177) at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:701) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1201) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:600) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:482) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:643) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1302) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:448) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1067) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:377) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1001) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:360) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) at java.lang.Thread.run(Thread.java:722)
Not having 1500 reputation, I cannot create the actual tags "Shiro" and "Redirect".
I'm guessing this means that Shiro's Subject.logout() method does something to the session that zk doesn't expect. Since none of my classes are involved in provoking this error, does anyone have any ideas what to do about this?
I was having the same problem so I just do :
#
# warning, do not use
# currentUser.logout()
# as ZK does not like it.
# invalidate the session and redirect as per below.
#
desktop = Executions.getCurrent().getDesktop()
session = desktop.getSession()
session.invalidate()
Executions.sendRedirect(None)
Note, this is Python code but you get the gist.
p.s. I have to add, using Shiro is much easier/simple than using Spring - I love it.
Asked: 2013-08-13 10:38:02 +0800
Seen: 35 times
Last updated: Aug 13 '13
ArrayIndexOuOfBoundsException showing Messagebox
error PWC2788: setAttribute: Non-serializable attribute with name javax.zkoss.zk.ui.Session
no grammar constraints (dtd or xml schema) detected for the document
ListModelList.clear() - Error in ZK Framework?
Script error when doing stuff in background thread
XPAGES with Customize excel cells