ZK Does not set session in SessionCtrl when handling a Portlet Ajax request - which effects in no session available for componentes, which can turn into NPE in some components.
our case is:
java.lang.NullPointerException
at org.zkoss.zkmax.zul.impl.LiveListboxDataLoader.smartUpdate(LiveListboxDataLoader.java:266)
at org.zkoss.zkmax.zul.impl.LiveListboxDataLoader.access$100(LiveListboxDataLoader.java:60)
at org.zkoss.zkmax.zul.impl.LiveListboxDataLoader$1.onEvent(LiveListboxDataLoader.java:287)
at org.zkoss.zkmax.zul.impl.LiveListboxDataLoader$1.onEvent(LiveListboxDataLoader.java:278)
at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2748)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2719)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2660)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1717)
at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1502)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1212)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:600)
at org.zkoss.zk.ui.http.DHtmlLayoutPortlet.serveResource(DHtmlLayoutPortlet.java:205)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:118)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
After debugging the code we found out that in DHtmlLayoutPortlet in serverResource method there is no call to:
SessionsCtrl.setCurrent(sess);
it is, however done in doView, but it is needed in serveResource as well.