javax.xml.bind.JAXBException: java.util.List is not known to this context]

openejb-users | Cedric Hurst | 9 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Returning complex data types in @WebResult

    openejb-users | 9 years ago | Cedric Hurst
    javax.xml.bind.JAXBException: java.util.List is not known to this context]
  2. 0

    Returning complex data types in @WebResult

    openejb-users | 9 years ago | Cedric Hurst
    javax.xml.bind.JAXBException: java.util.List is not known to this context]
  3. 0

    I'm attempting to return a @XmlRootElement annotated object called "Customer" from a @WebMethod. When calling the service, I get the following error in the server log: javax.xml.bind.JAXBException: [Lcom.gmail.at.cedrichurst.complexDataTypeWSExampleEJB.domain.Customer; is not known to this context at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:223) at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:238) at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:85) at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:127) at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:244) at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:251) at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:33) at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:461) at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:292) ... 48 more From what I understand, the return type should be added to the JaxB context automatically. Just to make sure I wasn't doing something wrong in my Customer class, I added another method to my bean that returned a java.util.List of Strings. When calling this method, I also got the same sort of error: [javax.xml.bind.JAXBException: java.util.List is not known to this context] javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException - with linked exception: [javax.xml.bind.JAXBException: java.util.List is not known to this context] at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:174) at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:69) at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:127) at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl$2.run(JAXBBlockImpl.java:405) at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76) at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl.marshalByType(JAXBBlockImpl.java:321) at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:209) at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:327) at org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:252) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:599) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:785) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:785) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:237) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:225) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814) at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:421) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:68) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:294) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:211) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) at org.apache.geronimo.axis2.ejb.EJBInterceptor.intercept(EJBInterceptor.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:615) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:146) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129) at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:73) at org.apache.openejb.core.stateless.StatelessContainer.invokeWebService(StatelessContainer.java:263) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:199) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165) at org.apache.geronimo.axis2.ejb.EJBMessageReceiver.receive(EJBMessageReceiver.java:88) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.geronimo.axis2.Axis2WebServiceContainer.processPOSTRequest(Axis2WebServiceContainer.java:395) at org.apache.geronimo.axis2.Axis2WebServiceContainer.doService2(Axis2WebServiceContainer.java:265) at org.apache.geronimo.axis2.Axis2WebServiceContainer.doService(Axis2WebServiceContainer.java:204) at org.apache.geronimo.axis2.Axis2WebServiceContainer.invoke(Axis2WebServiceContainer.java:167) at org.apache.geronimo.tomcat.TomcatEJBWebServiceContext$EJBWebServiceValve.invoke(TomcatEJBWebServiceContext.java:180) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:801) According to a thread in the OpenEJB mailing list: http://www.nabble.com/Returning-complex-data-types-in-%40WebResult-tc15114306.html ...it doesn't seem that these errors should be happening. I attempted to test this under CXF, but ran into another issue which is outlined in another JIRA. EAR file and geronimo.log attached.

    Apache's JIRA Issue Tracker | 9 years ago | Cedric Hurst
    javax.xml.bind.JAXBException: java.util.List is not known to this context]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.xml.bind.JAXBException

      java.util.List is not known to this context]

      at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException()
    2. Axis2
      JAXBBlockImpl$2.run
      1. org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:174)
      2. org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:69)
      3. org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:127)
      4. org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl$2.run(JAXBBlockImpl.java:405)
      4 frames
    3. org.apache.axis2
      AccessController.doPrivileged
      1. org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
      1 frame
    4. Axis2
      BlockImpl.serialize
      1. org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl.marshalByType(JAXBBlockImpl.java:321)
      2. org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:209)
      3. org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:327)
      4. org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:252)
      4 frames
    5. Axiom Impl
      OMNodeImpl.serializeAndConsume
      1. org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:599)
      2. org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:785)
      3. org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814)
      4. org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:785)
      5. org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814)
      6. org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:237)
      7. org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:225)
      8. org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814)
      9. org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:421)
      9 frames
    6. Apache Axis2 - Transport - HTTP
      CommonsHTTPTransportSender.invoke
      1. org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:68)
      2. org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:294)
      3. org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:211)
      3 frames
    7. org.apache.axis2
      AxisEngine.send
      1. org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
      1 frame
    8. org.apache.geronimo
      EJBInterceptor.intercept
      1. org.apache.geronimo.axis2.ejb.EJBInterceptor.intercept(EJBInterceptor.java:94)
      1 frame
    9. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:615)
      4 frames
    10. OpenEJB :: OSGi :: Core
      StatelessContainer.invoke
      1. org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:146)
      2. org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129)
      3. org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:73)
      4. org.apache.openejb.core.stateless.StatelessContainer.invokeWebService(StatelessContainer.java:263)
      5. org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:199)
      6. org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
      6 frames
    11. org.apache.geronimo
      EJBMessageReceiver.receive
      1. org.apache.geronimo.axis2.ejb.EJBMessageReceiver.receive(EJBMessageReceiver.java:88)
      1 frame
    12. org.apache.axis2
      AxisEngine.receive
      1. org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
      1 frame
    13. Apache Axis2 - Transport - HTTP
      HTTPTransportUtils.processHTTPPostRequest
      1. org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
      1 frame
    14. org.apache.geronimo
      TomcatEJBWebServiceContext$EJBWebServiceValve.invoke
      1. org.apache.geronimo.axis2.Axis2WebServiceContainer.processPOSTRequest(Axis2WebServiceContainer.java:378)
      2. org.apache.geronimo.axis2.Axis2WebServiceContainer.doService2(Axis2WebServiceContainer.java:248)
      3. org.apache.geronimo.axis2.Axis2WebServiceContainer.doService(Axis2WebServiceContainer.java:205)
      4. org.apache.geronimo.axis2.Axis2WebServiceContainer.invoke(Axis2WebServiceContainer.java:167)
      5. org.apache.geronimo.tomcat.TomcatEJBWebServiceContext$EJBWebServiceValve.invoke(TomcatEJBWebServiceContext.java:180)
      5 frames
    15. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      2. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      3. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      4. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
      5. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
      5 frames
    16. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      3 frames
    17. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:801)
      1 frame