restartApplication isn't working for me


I’m new to Vaadin and I’m having a bit of problem with STS and Vaadin.

I’m deploying my (mavenized) Vaadin application to an integrated Tomcat instance inside STS. This works fine - the code gets deployed, the application works, etc. I can also see that STS is correctly hot-deploying the new application when I make code changes (based on the Spring context shutting down).

However, when I refresh the browser, I don’t see any of the changes I’ve made. I understand (from other threads on this forum) that the reason for this is that Tomcat has stored the serialized session state of my application (prior to the changes) and is feeding that back to me when I hit refresh.

The forums suggest that you should add ?restartApplication to the URL as this will trigger the app server to start a new application instance. However, this just doesn’t seem to work for me - I continue to get the old version of the application.

The only way I can see the code changes is if I manually delete my session cookie after a hot-deploy; but this is cumbersome.

I’ve already tried re-installing STS and recreating the project in a different workspace (based on what seemed to work for other people in other threads); but to no avail.

I don’t want to use Jetty - we have quite a bit of dependencies at the container level and I don’t want to have to figure out how to duplicate those dependencies on a totally different app server. That’s not a good approach anyway.

Any help would be greatly appreciated.


Nevermind :slight_smile: I figured it out - ?restartApplication torches the main Application object; but it does not invalidate the session. In my application, the actual Application class is really small and then uses session scoped Spring beans for all the various components of the application.

So when I was using ?restartApplication, the main application instance would get removed; but the new instance would then simply lookup the same session objects in Spring.

I solved this by added implementing HttpServletRequestListener and checking for the presence of the ?restartApplication parameter. When it’s present, I simply invalidate the session.


public class ProvisioningManagerApplication extends Application implements HttpServletRequestListener{

	protected ProvisioningManagerWindow mainWindow;
	public void init() {
		ServletContext servletContext = ((WebApplicationContext) this.getContext()).getHttpSession().getServletContext();
		ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
		mainWindow = (ProvisioningManagerWindow)context.getBean("mainWindow");

	public void onRequestStart(HttpServletRequest request,
			HttpServletResponse response) {
		if(request.getParameter("restartApplication")!= null)

	public void onRequestEnd(HttpServletRequest request,
			HttpServletResponse response) {


application.close work fine