8 Replies Latest reply on Sep 25, 2010 11:37 PM by 787153

    Webservice:  Unable to create JAXBContext

    amseth
      Hi,

      I am trying to create a Java web service with below class using JDev 11g:
      public class TestWS {

      public TestWS() {
      super();
      }
      public XMLDocument testXML (XMLDocument xmldoc){
      System.out.println("Inside service...");
      System.out.println(xmldoc.getClass());
      return new XMLDocument();
      }
      }

      When I try to Test Web Service in Integrated WLS server, i get an error:
      <May 25, 2010 4:29:32 PM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "TestWSPort" failed to preload on startup in Web application: "Test1-TestWS-context-root".
      javax.xml.ws.WebServiceException: Unable to create JAXBContext
           at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)
           at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
           at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:271)
           at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:351)
           at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:201)
           Truncated. see log file for complete stacktrace
      ....
      Caused By: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
      oracle.xml.scalable.InfosetReader is an interface, and JAXB can't handle interfaces.
           this problem is related to the following location:
                at oracle.xml.scalable.InfosetReader
                at public oracle.xml.scalable.InfosetReader oracle.xml.parser.v2.XMLDocument.getInfosetReader()
                at oracle.xml.parser.v2.XMLDocument
                at public oracle.xml.parser.v2.XMLDocument testws.jaxws.TestXML.arg0
                at testws.jaxws.TestXML
      oracle.xml.scalable.InfosetReader does not have a no-arg default constructor.
           this problem is related to the following location:
                at oracle.xml.scalable.InfosetReader
                at public oracle.xml.scalable.InfosetReader oracle.xml.parser.v2.XMLDocument.getInfosetReader()
                at oracle.xml.parser.v2.XMLDocument
                at public oracle.xml.parser.v2.XMLDocument testws.jaxws.TestXML.arg0
                at testws.jaxws.TestXML

           at java.security.AccessController.doPrivileged(Native Method)
           at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:148)
           at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
           at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:271)
           at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:351)
           Truncated. see log file for complete stacktrace

      Caused By: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
      oracle.xml.scalable.InfosetReader is an interface, and JAXB can't handle interfaces.
           this problem is related to the following location:
                at oracle.xml.scalable.InfosetReader
                at public oracle.xml.scalable.InfosetReader oracle.xml.parser.v2.XMLDocument.getInfosetReader()
                at oracle.xml.parser.v2.XMLDocument
                at public oracle.xml.parser.v2.XMLDocument testws.jaxws.TestXML.arg0
                at testws.jaxws.TestXML
      oracle.xml.scalable.InfosetReader does not have a no-arg default constructor.
           this problem is related to the following location:
                at oracle.xml.scalable.InfosetReader
                at public oracle.xml.scalable.InfosetReader oracle.xml.parser.v2.XMLDocument.getInfosetReader()
                at oracle.xml.parser.v2.XMLDocument
                at public oracle.xml.parser.v2.XMLDocument testws.jaxws.TestXML.arg0
                at testws.jaxws.TestXML

           at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
           at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
           at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
           at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
           at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
           Truncated. see log file for complete stacktrace
      >

      Can anyone explain the cause the of issue and any solution for this...
      Regards
      Amit
        • 1. Re: Webservice:  Unable to create JAXBContext
          Shay Shmeltzer-Oracle
          I was able to reproduce this and filed bug 9749573
          1 person found this helpful
          • 2. Re: Webservice:  Unable to create JAXBContext
            amseth
            Thanks Shay. I appreciate that.
            • 3. Re: Webservice:  Unable to create JAXBContext
              amseth
              Hi Shay,

              Can I track the bug through metalink. I do have approved account on Metalink using CSI number for Weblogic.

              Thanks/Amit
              • 4. Re: Webservice:  Unable to create JAXBContext
                Shay Shmeltzer-Oracle
                The basic answer is:

                The type oracle.xml.parser.v2.XMLDocument cannot be marshalled by JAXB for the reasons provided in the error trace.
                If any type referenced by a method, as an argument, or a return type, cannot be handled by JAXB, then the method
                cannot be published as part of a web service and must be annotated by @WebMethod(exclude=true) so that the deployment process ignores this method during deployment.


                We are looking into having this exclusion done automatically for you in future releases.
                • 5. Re: Webservice:  Unable to create JAXBContext
                  amseth
                  Thanks for the info Shay.

                  We were trying to create a web service that takes an XML and returns an XML back. We were generating this XML's from View Object at client(where we are trying to make a call to this WS) and at server we were trying to read this XML into a ViewObject. To keep things simple we want to have argument and return type class close to what VO returns and accepts.

                  I am not very expert on JAXB. Could you suggest some way by which we can achieve our goal.
                  • 6. Re: Webservice:  Unable to create JAXBContext
                    Shay Shmeltzer-Oracle
                    I wonder if you can't just transfer the XML between the two as a String.
                    • 7. Re: Webservice:  Unable to create JAXBContext
                      amseth
                      Currently we are using java.lang.Object for argument and return type as workaround. But I an just not convinced with it :)
                      • 8. Re: Webservice:  Unable to create JAXBContext
                        787153
                        hI
                        I am getting the same issue, did you find any solution .please email me at logontoarvind@gmail.com
                        I wrote 2 methods in my in JDeveloper . First Method gets XML String does some processing and sends XML to a HTTP web server URL, first method calls second method -parseXML, which does some parsing and returns XML to first method.

                        Now when I created web service, annotation for 2 methods were created like
                        @WebService(portName = "HTTPClassSoap12HttpPort")
                        @BindingType(SOAPBinding.SOAP12HTTP_BINDING

                        @WebMethod(exclude = true). I even tried changing this to false later.

                        When I deploy on WLS/ SOA Server and create a WAR I get an Exception.

                        03:29:07 PM] weblogic.application.ModuleException: [HTTP:101216]Servlet: "HTTPClassSoap12HttpPort" failed to preload on startup in Web application: "XYZApp-XYZJavaProject-context-root.war".
                        javax.xml.ws.WebServiceException: Unable to create JAXBContext
                             at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:164)
                             at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:94)
                             at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:265)
                             at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:363)
                             at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:202)
                             at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:514)
                             at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:557)
                             at weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:183)
                             at weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:96)
                             at weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:61)
                             at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:55)
                             at javax.servlet.GenericServlet.init(GenericServlet.java:242)
                             at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
                             at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                             at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                             at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
                             at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
                             at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
                             at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
                             at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1976)
                             at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1950)
                             at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1869)
                             at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3127)
                             at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
                             at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:489)
                             at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:427)
                             at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
                             at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
                             at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:201)
                             at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:249)
                             at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:427)
                             at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
                             at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
                             at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:28)
                             at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1269)
                             at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
                             at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
                             at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
                             at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
                             at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
                             at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
                             at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
                             at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
                             at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
                             at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
                             at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
                             at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
                             at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:164)
                             at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
                             at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
                             at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:69)
                             at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
                             at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                             at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
                        Caused by: java.security.PrivilegedActionException:
                        com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 5 counts of IllegalAnnotationExceptions
                        java.io.DataInputStream does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at java.io.DataInputStream
                                  at public java.io.DataInputStream fmbrilljavaproject.jaxws.ParseXML.arg0
                                  at fmbrilljavaproject.jaxws.ParseXML
                        java.io.FilterInputStream does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at java.io.FilterInputStream
                                  at java.io.DataInputStream
                                  at public java.io.DataInputStream fmbrilljavaproject.jaxws.ParseXML.arg0
                                  at fmbrilljavaproject.jaxws.ParseXML
                        java.lang.StackTraceElement does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at java.lang.StackTraceElement
                                  at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
                                  at java.lang.Throwable
                                  at java.lang.Exception
                                  at public java.lang.Exception fmbrilljavaproject.jaxws.SAXExceptionBean.exception
                                  at fmbrilljavaproject.jaxws.SAXExceptionBean
                        javax.xml.transform.SourceLocator is an interface, and JAXB can't handle interfaces.
                             this problem is related to the following location:
                                  at javax.xml.transform.SourceLocator
                                  at public javax.xml.transform.SourceLocator fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean.locator
                                  at fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean
                        javax.xml.transform.SourceLocator does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at javax.xml.transform.SourceLocator
                                  at public javax.xml.transform.SourceLocator fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean.locator
                                  at fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean

                             at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:151)
                             at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:95)
                             ... 52 more
                        Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 5 counts of IllegalAnnotationExceptions
                        java.io.DataInputStream does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at java.io.DataInputStream
                                  at public java.io.DataInputStream fmbrilljavaproject.jaxws.ParseXML.arg0
                                  at fmbrilljavaproject.jaxws.ParseXML
                        java.io.FilterInputStream does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at java.io.FilterInputStream
                                  at java.io.DataInputStream
                                  at public java.io.DataInputStream fmbrilljavaproject.jaxws.ParseXML.arg0
                                  at fmbrilljavaproject.jaxws.ParseXML
                        java.lang.StackTraceElement does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at java.lang.StackTraceElement
                                  at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
                                  at java.lang.Throwable
                                  at java.lang.Exception
                                  at public java.lang.Exception fmbrilljavaproject.jaxws.SAXExceptionBean.exception
                                  at fmbrilljavaproject.jaxws.SAXExceptionBean
                        javax.xml.transform.SourceLocator is an interface, and JAXB can't handle interfaces.
                             this problem is related to the following location:
                                  at javax.xml.transform.SourceLocator
                                  at public javax.xml.transform.SourceLocator fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean.locator
                                  at fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean
                        javax.xml.transform.SourceLocator does not have a no-arg default constructor.
                             this problem is related to the following location:
                                  at javax.xml.transform.SourceLocator
                                  at public javax.xml.transform.SourceLocator fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean.locator
                                  at fmbrilljavaproject.jaxws.TransformerConfigurationExceptionBean

                             at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
                             at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:448)
                             at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:297)
                             at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
                             at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
                             at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:73)
                             at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:159)
                             at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:151)
                             ... 54 more
                        :com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:5 counts of IllegalAnnotationExceptions
                        [03:29:08 PM] #### Deployment incomplete. ####
                        [03:29:08 PM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)