Weird Stale Session issues

I am learning Vaadin, having spent a number of years using ZK and before that standard JSP and SOAP apps under Tomcat.

Not wanting to start a flame war, I like both ZK and Vaadin. However, I am attempting to get a handle on Vaadin and have some questions.

Under ZK, each Tomcat session is “fresh” in otherwords there is no serialization of instances into the Tomcat working directory, which seems to be the case in Vaadin.

Let me give a

I’ve developed a simple test application. I then change something in the Application class, for example, a component is added, or just a parameter is changed, for example a Caption.

What happens next is that I have to
right click
in the Tomcat Server view, then select
Clean Tomcat Work Directory
else my changes will not be visible, even if I refresh the application in the browser, causing a rebuild in the Console window. The same applies even if I restart Tomcat. Stale instances of
objects are retained, unless I clear the working directory as well. Never had this issue under ZK, and frankly, never really had it with any other web app, either, except in rare specific instances.

Whilst that’s a nuisance, I can live with it for now. However, testing a more complex situation it becomes really troublesome, since I’m never completely sure if the instance I’m looking at is correct, unless I stop the server, clean the working directory and restart.

Second more serious

Take the same web app as above and add URL parameters, e.g. http://localhost:8080/MyApp/?id=3 I have different effects that are supposed to happen if the parameters are correct or not. Here’s where it gets
really weird
if the parameter is correct, then everything works fine, as long as I keep testing correct parameters, the various logic things that are supposed to happen, happen. Now, if I’m testing the handling of invalid parameters, it doesn’t work. At least, not until I clean the cache and restart.

For me this a really serious issue, because it causes so much wasted time. Any normal web app should not store state like this. Each restart of the Tomcat server should be “fresh” in my view, unless there is a specific means of reloading cached instances.

In production I can see the value (sort of) of this approach. Apps load faster. But not if the normal handling of things like invalid parameters to the URL require a clean and restart. Then the webapp as a whole breaks the user experience. Or we have sysadmins monitoring each users actions and if they enter the wrong parameters, we restart the session for them, call the user and ask them to refresh the browser. I’m joking of course. But this does not make sense, especially when Vaadin (by default) is in debug / non-production mode in Eclipse. Even in production, the user experience is flawed, if the user retypes parameters on the address bar, in my examples case.

I’m sure there is something I’m doing wrong, so can someone please point me in the right direction?
Thanks in advance.

A Vaadin application keeps its UI state (in Vaadin 6, at least for the main window) as long as the session is alive. During development, you probably want to add the URL parameter “?restartApplication” to always restart the whole application when reloading the page.

As for Tomcat keeping sessions alive these even over server restart, that is a Tomcat configuration setting and has nothing to do with Vaadin - look for “Manager” in Tomcat’s context.xml (if I remember correctly) and see the comments for it.

This sounds strange - I suspect there is something wrong with how you handle the parameters, and what you do in the case of erroneous parameters. The whole application is
restarted when it is reloaded with new parameters, so your parameter handling code should typically update the application state and layouts rather than assume everything is reconstructed from scratch.

Thanks Henri,
This gives me some areas to investigate.