Search code examples
javajaxbweblogicclasspathapache-axis

JAXB Issue -- class ... nor any of its super class is known to this context


I've been trying to figure this problem out for the last 2 days already, but to no avail!

My webservice, as well as the client, are working fine on my machine (I'm testing the applicaiton on Weblogic 10.3.2, same as our DEV environment). But whenever I deploy the app to DEV, the below exception shows up.

My assumption is that the classloaders are loading "old" jar files, which don't support my current application code, but I have no way of figuring out how to solve this issue.

I've tried many things, from using the 'prefer-application-packages' in my ear file, to creating the "endorsed" directory and including that in my classpath, but nothing works. (I've included both the axis2 and jaxb jars in the 'endorsed' dir).

Does anybody out there have any possible solution to this? Which jar files should I "overwrite"? Where do you think this is failing?

Any help is appreciated!!!

DEV configuration:

Weblogic 10.3.2

java.version = 1.6.0_14

java.vm.info = compiled mode

java.vm.name = BEA JRockit(R)

java.home = /app/platform/jrockit/3.1.2/jre

java.class.path = /app/platform/jrockit/3.1.2/lib/endorsed/jaxb-impl-2.2.2.jar::/app/platform/wls/10.3.2/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/app/platform/jrockit/3.1.2/lib/tools.jar:/app/platform/wls/10.3.2/utils/config/10.3/config-launch.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/weblogic_sp.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/weblogic.jar:/app/platform/wls/10.3.2/modules/features/weblogic.server.modules_10.3.2.0.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/webservices.jar:/app/platform/wls/10.3.2/modules/org.apache.ant_1.7.0/lib/ant-all.jar:/app/platform/wls/10.3.2/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:/app/platform/wls/10.3.2/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/xqrl.jar
Caused By: javax.xml.bind.JAXBException: class com.comcast.cet.web.service.routing.lb.f5.impl.GetWipInfoForSpecificPoolMemberRequest nor any of its super class is known to this context.
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:605)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:486)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:249)
        at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
        at org.apache.axis2.datasource.jaxb.JAXBDSContext$1.run(JAXBDSContext.java:388)
        at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
        at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshalByElement(JAXBDSContext.java:369)
        at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshal(JAXBDSContext.java:339)
        at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:189)
        at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:370)
        at org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:294)
        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965)
        at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
        at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
        at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
        at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
        at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
        at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
        at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:554)
        at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:118)
        at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:82)
        at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:317)
        at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:159)
        at $Proxy84.getWipInfoForSpecificPoolMember(Unknown Source)
        at com.comcast.cet.web.service.routing.lb.LoadBalancerMain.getWipInfoForPoolMember(LoadBalancerMain.java:73)
        at com.comcast.cet.web.controllers.rpc.RoutingServiceImpl.getWipInfoForSpecificFarm(RoutingServiceImpl.java:157)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:544)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:504)
        at com.comcast.cet.web.controllers.rpc.RoutingServiceRpcController.processCall(RoutingServiceRpcController.java:64)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
        at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
        at com.comcast.cet.web.controllers.rpc.RoutingServiceRpcController.handleRequest(RoutingServiceRpcController.java:41)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
        at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
        at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        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 weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        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)

Solution

  • Ok, the quick solution is simply to switch from Axis2 to Apache CXF if you're running your code on weblogic or websphere (I was using the former). The reason for that is that these application servers bundle axis into their RTE, so when you managed server starts up, the axis libraries that are bundled with weblogic are read in first, rather then your axis libraries. There are a lot of "hacks" you can use/do to make this work:

    1. Migrating from a 'war' package to an 'ear' package and utilizing the 'prefer-application-packages' feature
    2. Creating the 'endorsed' directory and uploading your jar files there
    3. Other options are available, but too complex to clearly spell them out

    In all of the above cases, the code still didn't function properly, so the only option that I saw fit was to switch from axis2 to cxf, which isn't bundled by weblogic, therefore no "interference"! If you are using weblogic, then you'll have to add the following to the server 'startup' options:

    
    -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
    
    

    This is a known issue in weblogic.

    Here are the cxf maven dependencies I had to include (I removed ALL of the axis and axiom dependencies)

    
        
            org.apache.cxf
            cxf-rt-frontend-jaxws
            ${cxf.version}
        
        
            org.apache.cxf
            cxf-rt-transports-http
            ${cxf.version}
        
            
        
            org.apache.cxf
            cxf-rt-transports-http-jetty
            ${cxf.version}