0

We're now using WebSphere 9 and some applications are behaving differently then they did in WebSphere 8.5.5. Every time we restart the apps (not the server), they stop working correctly and the log shows exceptions similar to this one:

java.lang.ClassCastException: pt.sibs.epms.persistence.entity.EpmsDebugParameters incompatible with pt.sibs.epms.persistence.entity.EpmsDebugParameters

It only happens with JPA entities and I've checked the classpath to make sure the Jar is only referenced once (I've exported classloaders info for the application). I've confirmed that the EntityManagerFactory is being closed when the application stops (via contextDestroyed on a ServletContextListener).

As stated before, this happens only on WebSphere 9, it works well on WebSphere 8.5.5 and GlassFish 4.1.

Any ideas?

EDIT #1

I'm using WebSphere Full Profile and the exception that it's being thrown is:

java.lang.ClassCastException: pt.sibs.epms.persistence.entity.EpmsDebugParameters cannot be cast to pt.sibs.epms.persistence.entity.EpmsDebugParameters
             at pt.sibs.epms.util.logging.LoggerConfiguration.<clinit>(LoggerConfiguration.java:40)
             at pt.sibs.epms.util.logging.LoggerConfiguration.<clinit>(LoggerConfiguration.java)
             at pt.sibs.epms.suppdata.EpmsSuppData.<init>(EpmsSuppData.java:55)
             at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
             at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
             at sun.reflect.DelegatingConstructorAccessorImpl.__newInstance(DelegatingConstructorAccessorImpl.java:57)
             at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
             at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
             at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
             at com.ibm.ws.managedobject.internal.ManagedObjectFactoryImpl.createManagedObject(ManagedObjectFactoryImpl.java:65)
             at com.ibm.ws.websvcs.server.WSServiceInstanceFactory.createManagedObject(WSServiceInstanceFactory.java:276)
             at com.ibm.ws.websvcs.server.WSServiceInstanceFactory.createServiceInstance(WSServiceInstanceFactory.java:131)
             at org.apache.axis2.jaxws.server.EndpointController.handleRequest(EndpointController.java:272)
             at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:103)
             at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
             at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:212)
             at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
             at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1633)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
             at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
             at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
             at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
             at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
             at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1124)
             at com.ibm.ws.webcontainer.webapp.WebApp.__handleRequest(WebApp.java:4144)
             at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java)
             at com.ibm.ws.webcontainer.webapp.WebAppImpl.handleRequest(WebAppImpl.java:2208)
             at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
             at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1030)
             at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
             at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:382)
             at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
             at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:532)
             at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:318)
             at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:289)
             at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1084)
             at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:658)
             at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1820)
             at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
             at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
             at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
             at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
             at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
             at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
             at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
             at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
EPMS Devteam
  • 273
  • 2
  • 15
  • Can you paste a more complete stack trace? Is this Liberty or traditional WebSphere? – Scott Kurz Feb 02 '17 at 14:21
  • @ScottKurz, Thanks for your reply, could you please check my latest edit? – EPMS Devteam Feb 02 '17 at 14:38
  • Which JPA provider were you using on WebSphere 8.5.5? – dalia Feb 02 '17 at 16:07
  • @dalia, Thanks for your reply, I was using eclipselink 2.5.2 – EPMS Devteam Feb 02 '17 at 16:12
  • You may already be aware of this, but WebSphere uses EclipseLink by default starting with WebSphere 9. If you're not already doing so, I'd suggest trying to use the EclipseLink JPA provider being shipped with WebSphere instead of your own and see if that gets rid of your error. – dalia Feb 02 '17 at 16:46
  • @dalia, I'm aware of that. I'm not using any other implementation of eclipselink, just the one distributed with WebSphere. – EPMS Devteam Feb 02 '17 at 16:49
  • WebSphere 8.5.5 didn't ship with an EclipseLink provider so you must have provided your own eclipselink jar on WebSphere 8.5.5. Now that you are on WebSphere 9, make sure that your server or applications aren't configured with their own eclipselink jar anymore. Your error maybe caused by having two eclipselink jar files that are incompatible (the one that is now provided by WebSphere 9 and the one that you had when you were running on WebSphere 8.5.5). – dalia Feb 02 '17 at 17:55
  • Could you provide a snippet of your entity? – dalia Feb 03 '17 at 17:57
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/134807/discussion-between-dalia-and-epms-devteam). – dalia Feb 03 '17 at 18:01

1 Answers1

0

WebSphere 8.5.5 used WSJPA (build on OpenJPA) as the default JPA provider. However, starting WebSphere 9, the default JPA provider was switched to EclipseLink. If you were using EclipseLink on WebSphere 8.5.5, that means that you were providing your own EclipseLink library for WebSphere 8.5.5 since WebSphere didn't ship with EclipseLink.

When you switch to WebSphere 9, you should remove Eclipselink libraries/configuration that you had in WebSphere 8.5.5 that allowed you to use your own EclipseLink. The error you posted can result from having two EclipseLink jars visible to your application (one from your application/library and one from WebSphere).

dalia
  • 146
  • 4