Cast Exception when redeploying portlet to liferay

Hi all,

I’ve been struggling with a problem since I’ve upgraded to vaadin 6.6.0 (same with 6.6.1).

I’ve developed several portlets with no problem but now, when I redeploy any portlet from Eclipse, I get a ClassCastException :

com.vaadin.terminal.gwt.server.PortletApplicationContext2 cannot be cast to com.vaadin.terminal.gwt.server.PortletApplicationContext2

ERROR [jsp:154]
 java.lang.ClassCastException: com.vaadin.terminal.gwt.server.PortletApplicationContext2 cannot be cast to com.vaadin.terminal.gwt.server.PortletApplicationContext2
	at com.vaadin.terminal.gwt.server.PortletApplicationContext2.getApplicationContext(
	at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.getApplicationContext(
	at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.getExistingApplication(
	at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.findApplicationInstance(
	at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.handleRequest(
	at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.doDispatch(
	at javax.portlet.GenericPortlet.render(
	at com.liferay.portlet.FilterChainImpl.doFilter(
	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(
	at com.liferay.portal.kernel.servlet.PortletServlet.service(
	at javax.servlet.http.HttpServlet.service(
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
	at org.apache.catalina.core.ApplicationDispatcher.invoke(
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(
	at org.apache.catalina.core.ApplicationDispatcher.include(
	at com.liferay.portlet.InvokerPortletImpl.invoke(
	at com.liferay.portlet.InvokerPortletImpl.invokeRender(
	at com.liferay.portlet.InvokerPortletImpl.render(
	at org.apache.jasper.runtime.HttpJspBase.service(

It’s really annoying because the only way I manage to test my portlet is by restarting the server, which takes ages … And everything was working great when using vaadin 6.5.7.

I’ve made sure that I don’t have 2 vaadin.jar : I have one in liferay/WEBINF/lib/vaadin.jar and none in the deployed war

I’ve googled this but could not find any decent solution so I’m hoping that the vaadin experts on this forum will be able to help out.

Thanks a lot and have a nice day



When you get a ClassCastException with something like your

“com.vaadin.terminal.gwt.server.PortletApplicationContext2 cannot be cast to com.vaadin.terminal.gwt.server.PortletApplicationContext2”

it really means that the class in question has been loaded by two different classloaders. So you most probably do have a second vaadin.jar hiding somewhere on the classpath. These can be a real pain to find sometimes. One good way to find the hiding jar file is to ask a colleague to search through the classpath with you. That always works for me.


Hi Ben,

Caused by: java.lang.ClassCastException: FirstPortlet cannot be cast to javax.portlet.Portlet, After Googling, it appears that deploying vaadin.jar is a mistake with path not found.

javax.portlet.Portlet is implemented by GenericPortlet, and only 1Portlet found Error inside other Portlet

2ERROR [jsp:154]
java.lang.ClassCastException: com.vaadin.terminal.gwt.server.PortletApplicationContext2 cannot be cast to com.vaadin.terminal.gwt.server.PortletApplicationContext2

I would suggest that you double check if you don’t have vaadin.jar (or another jar which contains Portlet) loaded twice somewhere. The possible locations depend on the container you are using.

Kevin Thomas
Attune Infocom Inc
Email :

Liferay Portlet

This problem seems to occur if you set <private-session-attributes>false</private-session-attributes> in liferay-portlet.xml.

It would be nice to get
session attributes shared
. I wrote
a ticket about this issue

As you probably saw, fixed for the next Vaadin release by recreating the Vaadin application context if it is not compatible with the current Vaadin classes e.g. after redeploy.