You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by arun <ar...@cse.ssn.edu.in> on 2012/01/18 12:58:11 UTC

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

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.



--
View this message in context: http://cxf.547215.n5.nabble.com/SAAJ-javax-xml-ws-WebServiceException-Unable-to-create-JAXBContext-tp5154634p5154634.html
Sent from the cxf-user mailing list archive at Nabble.com.