[entpack] SAAJ - javax.xml.ws.WebServiceException: Unable to create JAXBContext

  • From: "adiththan3" < >
  • To:
  • Subject: [entpack] SAAJ - javax.xml.ws.WebServiceException: Unable to create JAXBContext
  • Date: Wed, 18 Jan 2012 12:23:25 +0000

I have been trying to create a XML file from a Java Web service and create a 
SOAP message with Attachment using SAAJ to send it to another Web service. My 
Web service code is given below.

______________________________________________________________________

       DocumentBuilderFactory documentBuilderFactory = 
DocumentBuilderFactory.newInstance();
       DocumentBuilder documentBuilder = 
documentBuilderFactory.newDocumentBuilder();
       Document document = documentBuilder.newDocument();
       Element rootElement = document.createElement(root);
       document.appendChild(rootElement);
       Element ele1 = document.createElement("ID");
       ele1.appendChild(document.createTextNode(InstanceId));
       rootElement.appendChild(ele1);
       TransformerFactory transformerFactory = 
TransformerFactory.newInstance();
       Transformer transformer = transformerFactory.newTransformer();
       transformer.setOutputProperty(OutputKeys.INDENT, "yes");
       DOMSource source = new DOMSource(document);
       File file = new File("/CurrentStatus.xml");
       StreamResult result =  new StreamResult(file);
       transformer.transform(source, result);

______________________________________________________________________

On deploying this Web service, I get the following error.
javax.xml.ws.WebServiceException: Unable to create JAXBContext

______________________________________________________________________

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3
counts of IllegalAnnotationExceptions
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 private java.lang.Throwable
Local.jaxws.TransformerConfigurationExceptionBean.exception
               at Local.jaxws.TransformerConfigurationExceptionBean
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 private javax.xml.transform.SourceLocator
Local.jaxws.TransformerConfigurationExceptionBean.locator
               at Local.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 private javax.xml.transform.SourceLocator
Local.jaxws.TransformerConfigurationExceptionBean.locator
               at Local.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: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)
       at 
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:153)
       at 
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:149)
       ... 20 more
Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException:
Deployment Error -- Exception occured in the wsgen process
javax.xml.ws.WebServiceException: Unable to create JAXBContext
       at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1848)
       at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2249)
       at 
com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:427)
       at 
com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:160)
       at 
com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:182)
       at 
com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
       at 
com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
       at 
com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
       at 
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
       at 
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
       at 
com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
       at 
com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)


deployment started : 0%
Deploying application in domain failed; Deployment Error -- Exception
occured in the wsgen process javax.xml.ws.WebServiceException: Unable
to create JAXBContext
BUILD FAILED (total time: 3 seconds)

______________________________________________________________________

I have tried adding javax.jar and other relevant jar files to the Web 
application libraries but of no use. 

Any help to fix this problem would be very useful for me.

Thanks in advance.






[entpack] SAAJ - javax.xml.ws.WebServiceException: Unable to create JAXBContext

adiththan3 01/18/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close