# Problem with session timeout.

zkdev333
57 1

Hi, all. I have a problem with redirecting when my session is time out. When I using only spring framework in my project all worked fine. I.e. when session was timeout, client was redirected to login form. But after using zk framework, when session is time out, I see this message
"The server is temporarily out of service.
Would you like to try again?

(syntax error)"

and nothing happens. I look this page http://books.zkoss.org/wiki/ZK_Configuration_Reference/zk.xml/The_session-config_Element#The_timeout-message_Element , but nothing helps me. How can I fix this problem?

delete retag edit

## 7 Replies

twiegand
1807 3

zkdev333,

You might have a look here for some information on how to change the message or redirect to a different page.

Regards,

Todd

pschenke
12

i am also running into this problem. firefox gives the error-message from the OP, chrome says "(Unexpected Token <)". it's showing up in a javascript-alert-window (or something similar), not as a zk-dialog.

i've worked with the zk-timeout before and never had any problems. however, recently this message appears.
it is triggered by both, httpsession-timeout as well as zk-timeout.
if i click the "reload"-button in that alert-window, the regular zk-timeout-dialog appears.
unfortunately, i've had no luck so far in supressing the message or finding its cause.

iantsai
2755 1

Hi, pschenke

Is that possible the timeout js in zk.xml has some typo or tags without end?
Maybe we can take a look at the timeout config of your zk.xml.

pschenke
12

zk.xml:

<?xml version="1.0" encoding="utf-8" ?>
<zk>
<listener>
</listener-class>
</listener>
<preference>
<value>
</value>
</preference>
</language-config> -->
<session-config>
<device-type>ajax</device-type>
<automatic-timeout/>
<timer-keep-alive>true</timer-keep-alive>
<timeout-message>My custom timeout-message. Cönäining Ümläüts.</timeout-message>
</session-config>
<library-property>
<name>org.zkoss.zul.Button.mold</name>
<value>trendy</value>
</library-property>
<library-property>
<name>org.zkoss.zul.progressbox.position</name>
<value>center,center</value>
</library-property>
</zk>

and for the sake of completeness: web.xml

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<session-config>
<session-timeout>1</session-timeout>
</session-config>

<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>
org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>

<filter>
<filter-class>tv.px.common.PrincipalMdcFilter</filter-class>
</filter>

<filter-mapping>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- Spring -->
<listener>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/webapp-context.xml</param-value>
</context-param>

<!-- Hibernate -->
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- ZK -->

<listener>
<description>
Used to cleanup when a session is destroyed
</description>
<display-name>ZK Session Cleaner</display-name>
<listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
</listener>

<servlet>
<description>ZK loader for evaluating ZK pages</description>
<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
<!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet). -->
<init-param>
<param-name>update-uri</param-name>
<param-value>/zkau</param-value>
</init-param>
</servlet>
<servlet-mapping>
<url-pattern>*.zul</url-pattern>
</servlet-mapping>
<servlet-mapping>
<url-pattern>*.zhtml</url-pattern>
</servlet-mapping>
<servlet>
<description>The asynchronous update engine for ZK</description>
<servlet-name>auEngine</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>remoting</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>remoting</servlet-name>
<url-pattern>/remoting/*</url-pattern>
</servlet-mapping>

<!-- //// -->
<!-- MIME mapping -->
<mime-mapping>
<extension>gif</extension>
<mime-type>image/gif</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpeg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>js</extension>
<mime-type>application/x-javascript</mime-type>
</mime-mapping>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zhtml</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zul</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.zul</welcome-file>
</welcome-file-list>
</web-app>

iantsai
2755 1

This one(zk.xml) works fine to me, maybe you have to provide an example to reproduce it.

pschenke
12

i played around with the settings some more yesterday and finally found that this configuration works fine in jetty but produces the mentioned error when run in tomcat.
if i remove the automatic-timeout statement, i get the error in jetty, too.

i also found out that using the keep-alive-timer keeps the http-session-timeout from kicking in, so this can be used as a dirty workaround.

i may provide example-code later today, but i keep getting this error for all pages without timers.

iantsai
2755 1

By the way, can you make sure the encoding of your file?
There are some non-ASCII character out there in your messages, so if the file encoding is not UTF-8, then things could happened.

[hide preview]