I have an application of Websphere application server 7.0 (Parent Last)
Please read through the description to understand the problem.
I created a new websphere profile. Configured my application on it and started the application and now when I test the application. It works Good.
Now, I went to websphere console and re-start my application. This time when I test my application. I get error.
The log says a classCastException :
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R java.lang.ClassCastException: com.csc.fs.ra.SimpleConnectionSpecImpl incompatible with com.csc.fs.ra.SimpleConnectionSpecImpl
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.ra.ip.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:69)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.InteractionHandlerBase.getConnection(InteractionHandlerBase.java:165)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.InteractionHandlerBase.execute(InteractionHandlerBase.java:95)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.InteractionHandlerBase.process(InteractionHandlerBase.java:230)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.SystemAccessBase.invokeInteraction(SystemAccessBase.java:374)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.SystemAccessBase.internalInvoke(SystemAccessBase.java:242)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.SystemAccessBase.invoke(SystemAccessBase.java:55)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.sa.SystemAccessBase.login(SystemAccessBase.java:106)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.session.AuthenticatorBase.logonSystemSession(AuthenticatorBase.java:153)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.session.AuthenticatorBase.addSystemSessions(AuthenticatorBase.java:132)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.session.standalone.AuthenticatorBase.logon(AuthenticatorBase.java:224)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.session.AuthenticatorBase.logon(AuthenticatorBase.java:93)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.service.ServiceControllerAbstract.logon(ServiceControllerAbstract.java:387)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.delegate.DirectServiceController.logon(DirectServiceController.java:132)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.delegate.ServiceDelegateDirect.logon(ServiceDelegateDirect.java:133)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.ui.BaseServiceAction.logon(BaseServiceAction.java:124)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.ui.action.desktop.Logon.perform(Logon.java:47)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.ui.ServiceDelegator.execute(ServiceDelegator.java:506)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.ui.ServiceDelegator.processEvent(ServiceDelegator.java:240)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.ui.BeanBase.executeEvent(BeanBase.java:779)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at pagecode.authorization.Logon.submit(Logon.java:66)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at java.lang.reflect.Method.invoke(Method.java:600)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:67)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at javax.faces.component.UICommand.broadcast(UICommand.java:315)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.csc.fs.accel.ui.filters.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:82)
[3/21/13 6:06:18:616 EDT] 0000001d SystemErr R at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
The reason behind this ClassCastException is multiple version of the class SimpleConnectionSpecImpl
.
This class is being supplied by Resource adapters that I have configured externally through websphere admin console.
But now when I stop the server and restart the server, I can again use the application with no error.
So my closest guess websphere is caching class files because of which I am seeing the exception.
Any thoughts? Ideas?
Please let me know if you require any more details
You see the exception because there are different class loaders that have loaded that class, which technically makes them different classes.
We've solved this problem before by have the class be apart of the server classpath and only have the server load it. This way there is only one class loader for the class and all applications running on the server can use it from there.
The only other options I can see here is don't restart your app unless you plan to restart the server as well. I would only see this as a pain in a development environment but once you hit production I doubt you're frequently restarting apps.