0

GAE java.lang.IllegalStateException: No SessionHandler or SessionManager

asked 2009-12-06 01:57:12 +0800

kesavkolla gravatar image kesavkolla
180 3

I installed the fresh nightly build of zk-5.0 (zk-bin-5.0.0-RC2-2009-12-03) on GAE and I keep getting the No SessionHandler error. Here is the stack trace from the GAE log:

/pages/patientvisit.zul
java.lang.IllegalStateException: No SessionHandler or SessionManager
at org.mortbay.jetty.Request.getSession(Request.java:987)
at org.zkoss.zk.ui.http.WebManager.getSession(WebManager.java:341)
at org.zkoss.zk.ui.http.SessionResolverImpl.getSession(SessionResolverImpl.java:37)
at org.zkoss.zk.ui.Sessions.getCurrent(Sessions.java:56)
at org.zkoss.zk.ui.Sessions.getCurrent(Sessions.java:44)
at org.zkoss.zk.ui.http.SimpleSession.sessionDidActivate(SimpleSession.java:505)
at org.zkoss.zk.ui.http.SimpleSession.recover(SimpleSession.java:402)
at org.zkoss.zk.ui.sys.SessionsCtrl.getSession(SessionsCtrl.java:113)
at org.zkoss.zk.ui.http.WebManager.getSession(WebManager.java:347)
at org.zkoss.zk.ui.http.WebManager.getSession(WebManager.java:329)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:141)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)


I have kept the proper settings in zk.xml.

<system-config>
<disable-event-thread />
<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
</system-config>

<client-config>
<resend-delay>-1</resend-delay>
</client-config>

Just after couple of pages serving I am getting the session handler error. Is it a known problem or am I missing something?
Please help in fixing this as I am completely stuck with this issue.

-kesav

delete flag offensive retag edit

11 Replies

Sort by ยป oldest newest

answered 2009-12-07 09:01:46 +0800

kesavkolla gravatar image kesavkolla
180 3

Any help please? I am getting close to release of my work and things are falling apart in GAE. Please help me in resolving this issue.

link publish delete flag offensive edit

answered 2009-12-07 20:09:59 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi,kesavkolla
I try this demo
and replace lib to zk-bin-5.0.0-RC2-2009-12-03
it works well
Could you post your sample code ?

link publish delete flag offensive edit

answered 2009-12-08 09:58:51 +0800

kesavkolla gravatar image kesavkolla
180 3

I followed the exact steps that were given in the doc. I can get some pages and after a while the session error kicks in. The session error is so random some times it occurs on the second page some times it occur in after couple of page navigations. I am not sure how can I post code. When I run locally from my eclipse environment everything works fine.

I guess there is something wrong with the session handling code when uploaded to GAE.

link publish delete flag offensive edit

answered 2009-12-09 21:00:29 +0800

kesavkolla gravatar image kesavkolla
180 3

This bug is really killing all my decision of using ZK. Now I am almost close to delivery of the project and can't figure out why this Session thing failing when deployed to GAE. Please please some one help me to fix this out. It would take me more time to rework my application to drop ZK

link publish delete flag offensive edit

answered 2009-12-10 03:56:48 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-12-10 03:57:38 +0800

Only a hint:

web.xml

	<!-- ///               'distributable'                  /// -->
	<!-- ///            Makes the application               /// -->
	<!-- ///     suitable for running in an distributed     /// -->
	<!-- ///      environment like a tomcat cluster.        /// -->
	<distributable />

What other frameworks do you use?
Comes this error if an other user is logged in?
Where is your session-timeout is configured?

link publish delete flag offensive edit

answered 2009-12-10 11:03:04 +0800

kesavkolla gravatar image kesavkolla
180 3

I added the <distributable /> but still failing. I don't think it's because of timeout as it happens in just second or third request itself.

The stack trace shows 2 filters one is our application specific where we check for login credentials and second one Spring OpenPersistenceManagerInViewFilter.

/pages/usermgmt/customersearch.zul
java.lang.IllegalStateException: No SessionHandler or SessionManager
at org.mortbay.jetty.Request.getSession(Request.java:987)
at org.zkoss.zk.ui.http.WebManager.getSession(WebManager.java:341)
at org.zkoss.zk.ui.http.SessionResolverImpl.getSession(SessionResolverImpl.java:37)
at org.zkoss.zk.ui.Sessions.getCurrent(Sessions.java:56)
at org.zkoss.zk.ui.Sessions.getCurrent(Sessions.java:44)
at org.zkoss.zk.ui.http.SimpleSession.sessionDidActivate(SimpleSession.java:505)
at org.zkoss.zk.ui.http.SimpleSession.recover(SimpleSession.java:402)
at org.zkoss.zk.ui.sys.SessionsCtrl.getSession(SessionsCtrl.java:113)
at org.zkoss.zk.ui.http.WebManager.getSession(WebManager.java:347)
at org.zkoss.zk.ui.http.WebManager.getSession(WebManager.java:329)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:143)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at org.springframework.orm.jdo.support.OpenPersistenceManagerInViewFilter.doFilterInternal(OpenPersistenceManagerInViewFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.bodyfs.framework.filters.ApplicationFilter.doFilter(ApplicationFilter.java:53)

Please any other insight? In which scenario's zk throws this kind of no session error?

link publish delete flag offensive edit

answered 2009-12-19 08:56:53 +0800

kesavkolla gravatar image kesavkolla
180 3

I finally figured out what is the issue with GAE and zk. I have to patchup the zk code to fix this. It's because of the GAE's load balancing and zk's session caching. When we run on local machine there is no load balancer so everything was fine. When we upload the app to GAE there is load balancers come in picture and zk is failing. I have to fix the org.zkoss.zk.ui.http.SimpleSession class to not look for old session during recover process. After this fix every thing works great in GAE. If any one wants the patch let me know I am happy to provide the patch.

If ZK folks can incorporate this fix in their future builds that would be really great.

link publish delete flag offensive edit

answered 2009-12-19 12:41:55 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Please can you post the class-code here?

thx
Stephan

link publish delete flag offensive edit

answered 2009-12-19 14:26:54 +0800

kesavkolla gravatar image kesavkolla
180 3

protected void sessionDidActivate(HttpSession hsess) {
//Note: in Tomcat, servlet is activated later, so we have to
//add listener to WebManager instead of process now

//final Session old = SessionsCtrl.getCurrent(); //shall be null; just in case
SessionsCtrl.setCurrent(this);
try {
_navsess = hsess;
WebManager.addActivationListener(
hsess.getServletContext(),
//FUTURE: getServletContext only in Servlet 2.3 or later
new WebManagerActivationListener() {
public void didActivate(WebManager webman) {
_wapp = webman.getWebApp();
((WebAppCtrl)_wapp)
.sessionDidActivate(SimpleSession.this);
}
});

for (Enumeration en = getAttrNames(); en.hasMoreElements();) {
final String nm = (String)en.nextElement();
didActivate(getAttribute(nm));
}
} finally {
//SessionsCtrl.setCurrent(old);
SessionsCtrl.setCurrent((Session)null);
}
}


The highlighted ones are the changes.

link publish delete flag offensive edit

answered 2009-12-28 12:56:58 +0800

baradhell gravatar image baradhell
30 1

I have errors compiling zk sources. Can you send me zk.jar with this changes to jose.valero@gmail.com?

Thanks

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-12-06 01:57:12 +0800

Seen: 1,225 times

Last updated: Dec 28 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More