Class cast exception using with WebLogic 10.3

I am using Vaadin as OSGi bundle and I need to support a few app server. Everything works with other servers like, tomcat, jboss, websphere except WebLogic. I do not know much about WebLogic in general. After deployment of my war file, I get the following error:


####<Apr 12, 2011 5:29:31 PM CDT> <[ACTIVE]
ExecuteThread: ‘1’ for queue: ‘weblogic.kernel.Default (self-tuning)’> <> <> <> <1302647371746> <Could not deserialize session data.

java.lang.ClassNotFoundException:
com.vaadin.terminal.gwt.server.WebApplicationContext: This error could indicate that a component was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on all other members of that cluster
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:218)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:85)
at weblogic.common.internal.WLObjectInputStream.resolveClass(WLObjectInputStream.java:61)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.common.internal.PassivationUtils.toObject(PassivationUtils.java:54)
at weblogic.common.internal.PassivationUtils.toObject(PassivationUtils.java:46)
at weblogic.common.internal.PassivationUtils.copy(PassivationUtils.java:64)
at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:89)
at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:39)
at weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:805)
at com.vaadin.terminal.gwt.server.WebApplicationContext.getApplicationContext(WebApplicationContext.java:82)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:942)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:768)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:431)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:93)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:75)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.felix.http.proxy.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

So I thought it is not finding the WebApplicationContext jar and I put it under lib directory (for shared libraries, I think). Now I am getting the following class cast exception:

[i]
GET /library/console HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, /
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SearchToolbar 1.2; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)
Connection: Keep-Alive
Cookie: JSESSIONID=38989F2F7FBCF1674DCDDC1BF0D0BD76; ADMINCONSOLESESSION=QGxlNk2pxQ4TfT1QxgflyrqrZp9G08h2RV2xLnn5KbV11vpTGJG3!451558265; JSESSIONID=GxLFNkQSh4qD2Gx6LQx3Yj4ySQlzpddGTVzcvG2NPC8GJj1Dn1Qn!451558265
Authorization: Basic YWRtaW46YWRtaW4=

]] Root cause of ServletException.

java.lang.ClassCastException: com.vaadin.terminal.gwt.server.WebApplicationContext cannot be cast to com.vaadin.terminal.gwt.server.WebApplicationContext

at com.vaadin.terminal.gwt.server.WebApplicationContext.getApplicationContext(WebApplicationContext.java:82)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:942)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:768)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:431)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:93)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:75)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.felix.http.proxy.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at com.hp.lal.web.context.HttpSessionInserterFilter.doFilter(HttpSessionInserterFilter.java:31)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
[/i]

I am confused, since it is showing the same class name in the cast exception.
Any idea?
Thanks in advance.

Did you check the explanation in the error: "
This error could indicate that a component was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on all other members of that cluster
"?

See
this doc
about deploying to a WebLogic cluster.

I suppose it could be something else as well. Sometimes multiple Vaadin Jars in a class path can cause problems, such as in Liferay.

I did not install webLogic in clustered env, it is in just one box. So I did not pay attention to this message. All my other services (non-vaadin) are working fine without any problem. Anyway I will look into the doc link. Thanks.

This means that the instance of WebApplicationContext was based on a different classloader instance. Do you also deploy a separate copy of the Vaadin JAR with your application?

Many servers do load shared libraries with one classloader and servlets/portlets (including any libraries deployed with them) with another. OSGi certainly uses its own classloaders, and might also be related to your first issue (why the class was not found). However, I don’t know WebLogic and so I am not able to say much more.

Yes I think you are right, the problem is related to class loading. But I just do not know how all the pieces work. One important piece of information that I had later yesterday that it works on RedHat linux and HPUX. My platform is windows vista. So the problem is only on windows. I will do more reading and let me know if you can think of anything else.

Problem is solved. It was indeed a problem with WebLogic’s class loading and they fixed it on version 10.3.3. I was using 10.3.2. Here is a link that talked about this issue and that (see Steve Button’s reply) mentioned that the WL dev team knows it is a bug and it will be fixed in 10.3.3 http://forums.oracle.com/forums/thread.jspa?threadID=1057501

Momena