Jpa entity classes are causing class cast exceptions after undeploy/deploy of bundles

Solution Verified - Updated -

Issue

  • Some jpa entity classes are causing class cast exceptions when some bundles are undeployed and deployed again. It seems that jpa entities are not destroyed during undeployment of bundles containing entities.
  • I have 2 questions:
    • Is this a known problem
    • Is there a way (debug option) to check the cause of the class cast exception
  • As per https://issues.jboss.org/browse/ENTESB-3599 the class cast exception issue should have been fixed with Fuse 6.2.1 but we still see that at each restart of the containers, at each deployment of new bundles, and even because the containers just refresh other profiles, the class cast exception of hibernate appears and it's impossible to manage the production environment in stable way or to perform hot deployment.
  • The stack trace
01.07.2015 17:00:14,874 | WARN  | qtp978535935-157 | PhaseInterceptorChain            | 164 - org.apache.cxf.cxf-api - 2.7.0.redhat-610394 | Application {xxx.yyy.zzz.search}IpiSearchWebService#{xxx.yyy.zzz.search}searchIp ha
org.apache.cxf.interceptor.Fault: xxx.yyy.zzz.MembershipAgreement cannot be cast to xxx.yyy.zzz.MembershipAgreement
        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:272)[172:org.apache.cxf.cxf-rt-frontend-jaxws:2.7.0.redhat-610394]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:237)[172:org.apache.cxf.cxf-rt-frontend-jaxws:2.7.0.redhat-610394]
        at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68)[172:org.apache.cxf.cxf-rt-frontend-jaxws:2.7.0.redhat-610394]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_17]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_17]
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_17]
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)[91:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)[170:org.apache.cxf.cxf-rt-transports-http:2.7.0.redhat-610394]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)[100:org.ops4j.pax.web.pax-web-jetty:3.0.6]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:219)[100:org.ops4j.pax.web.pax-web-jetty:3.0.6]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:77)[100:org.ops4j.pax.web.pax-web-jetty:3.0.6]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.Server.handle(Server.java:370)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
        at java.lang.Thread.run(Thread.java:722)[:1.7.0_17]
Caused by: java.lang.ClassCastException: xxx.yyy.zzz.MembershipAgreement cannot be cast to xxx.yyy.zzz.MembershipAgreement
        at xxx.yyy.zzz.updateNamesWithAgreementInfo(NameDAO.java:190)
        at xxx.yyy.zzz.searchIp(NameDAO.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_17]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_17]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_17]
        at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_17]
        at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)
        at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)
        at xxx.yyy.zzz.$NameDAO2143670739.searchIp(Unknown Source)
        at xxx.yyy.zzz.impl.IpiSearchService.searchIp(IpiSearchService.java:37)
        at Proxybd888973_c2f6_42dd_85b3_f1ef7ddc795f.searchIp(Unknown Source)
        at Proxy1fabfd0a_e4e8_481b_87f6_89ab0c4f4a10.searchIp(Unknown Source)
        at xxx.yyy.zzz.searchIp(IpiSearchWebService.java:29)[323:phx-work-ws:4.0.00.SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_17]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_17]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_17]
        at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_17]
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)[164:org.apache.cxf.cxf-api:2.7.0.redhat-610394]
        ... 46 more

Environment

  • Red Hat JBoss Fuse
    • 6.1.0
    • 6.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content