Scenario
When I'm trying to access the WSDL's of web services deployed in a Axis2 SOAP engine the following error is occurring,
javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found
at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
at org.apache.ws.commons.schema.XmlSchema.serialize_internal(XmlSchema.java:505)
at org.apache.ws.commons.schema.XmlSchema.write(XmlSchema.java:478)
at org.apache.axis2.description.AxisService2WSDL11.generateOM(AxisService2WSDL11.java:215)
at org.apache.axis2.dataretrieval.WSDLDataLocator.outputInlineForm(WSDLDataLocator.java:131)
at org.apache.axis2.dataretrieval.WSDLDataLocator.getData(WSDLDataLocator.java:73)
at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:81)
at org.apache.axis2.description.AxisService.getData(AxisService.java:2980)
at org.apache.axis2.description.AxisService.getWSDL(AxisService.java:1653)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1421)
at org.wso2.carbon.core.transports.util.Wsdl11Processor$1.printWSDL(Wsdl11Processor.java:43)
at org.wso2.carbon.core.transports.util.AbstractWsdlProcessor.printWSDL(AbstractWsdlProcessor.java:86)
at org.wso2.carbon.core.transports.util.Wsdl11Processor.process(Wsdl11Processor.java:57)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.processWithGetProcessor(NHttpGetProcessor.java:137)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.process(NHttpGetProcessor.java:277)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:256)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
[2014-05-19 17:56:10,980] ERROR - DefaultHttpGetProcessor Error processing request
org.apache.axis2.dataretrieval.DataRetrievalException: Provider net.sf.saxon.TransformerFactoryImpl not found
at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:85)
at org.apache.axis2.description.AxisService.getData(AxisService.java:2980)
at org.apache.axis2.description.AxisService.getWSDL(AxisService.java:1653)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1421)
at org.wso2.carbon.core.transports.util.Wsdl11Processor$1.printWSDL(Wsdl11Processor.java:43)
at org.wso2.carbon.core.transports.util.AbstractWsdlProcessor.printWSDL(AbstractWsdlProcessor.java:86)
at org.wso2.carbon.core.transports.util.Wsdl11Processor.process(Wsdl11Processor.java:57)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.processWithGetProcessor(NHttpGetProcessor.java:137)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.process(NHttpGetProcessor.java:277)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:256)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found
at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
at org.apache.ws.commons.schema.XmlSchema.serialize_internal(XmlSchema.java:505)
at org.apache.ws.commons.schema.XmlSchema.write(XmlSchema.java:478)
at org.apache.axis2.description.AxisService2WSDL11.generateOM(AxisService2WSDL11.java:215)
at org.apache.axis2.dataretrieval.WSDLDataLocator.outputInlineForm(WSDLDataLocator.java:131)
at org.apache.axis2.dataretrieval.WSDLDataLocator.getData(WSDLDataLocator.java:73)
at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:81)
... 13 more
at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
at org.apache.ws.commons.schema.XmlSchema.serialize_internal(XmlSchema.java:505)
at org.apache.ws.commons.schema.XmlSchema.write(XmlSchema.java:478)
at org.apache.axis2.description.AxisService2WSDL11.generateOM(AxisService2WSDL11.java:215)
at org.apache.axis2.dataretrieval.WSDLDataLocator.outputInlineForm(WSDLDataLocator.java:131)
at org.apache.axis2.dataretrieval.WSDLDataLocator.getData(WSDLDataLocator.java:73)
at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:81)
at org.apache.axis2.description.AxisService.getData(AxisService.java:2980)
at org.apache.axis2.description.AxisService.getWSDL(AxisService.java:1653)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1421)
at org.wso2.carbon.core.transports.util.Wsdl11Processor$1.printWSDL(Wsdl11Processor.java:43)
at org.wso2.carbon.core.transports.util.AbstractWsdlProcessor.printWSDL(AbstractWsdlProcessor.java:86)
at org.wso2.carbon.core.transports.util.Wsdl11Processor.process(Wsdl11Processor.java:57)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.processWithGetProcessor(NHttpGetProcessor.java:137)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.process(NHttpGetProcessor.java:277)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:256)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
[2014-05-19 17:56:10,980] ERROR - DefaultHttpGetProcessor Error processing request
org.apache.axis2.dataretrieval.DataRetrievalException: Provider net.sf.saxon.TransformerFactoryImpl not found
at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:85)
at org.apache.axis2.description.AxisService.getData(AxisService.java:2980)
at org.apache.axis2.description.AxisService.getWSDL(AxisService.java:1653)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1421)
at org.wso2.carbon.core.transports.util.Wsdl11Processor$1.printWSDL(Wsdl11Processor.java:43)
at org.wso2.carbon.core.transports.util.AbstractWsdlProcessor.printWSDL(AbstractWsdlProcessor.java:86)
at org.wso2.carbon.core.transports.util.Wsdl11Processor.process(Wsdl11Processor.java:57)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.processWithGetProcessor(NHttpGetProcessor.java:137)
at org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor.process(NHttpGetProcessor.java:277)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:256)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found
at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
at org.apache.ws.commons.schema.XmlSchema.serialize_internal(XmlSchema.java:505)
at org.apache.ws.commons.schema.XmlSchema.write(XmlSchema.java:478)
at org.apache.axis2.description.AxisService2WSDL11.generateOM(AxisService2WSDL11.java:215)
at org.apache.axis2.dataretrieval.WSDLDataLocator.outputInlineForm(WSDLDataLocator.java:131)
at org.apache.axis2.dataretrieval.WSDLDataLocator.getData(WSDLDataLocator.java:73)
at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:81)
... 13 more
Reason
In one of the web service deployed in my server, it has used Saxon XML transformer implementation instead of default java XML transformer implementation. Therefore, in it's code it has added the following static initialization block1 2 3 | static{ System.setProperty("javax.xml.transform."net.sf.saxon.TransformerFactoryImpl"); } |
The setting of this system property is the reason for this error. Also some can set this system property from command line using
-Djavax.xml.transform.TransformerFactory=cnet.sf.saxon.TransformerFactoryImpl
Workaround
Remove the above static initialization block which sets the javax.xml.transfrom system property. Then, when instantiating TransfromFactory in the code, explicitly instantiate the saxon trasform factory with the full qualified class name as follows,1 | TransformerFactory fact = new net.sf.saxon.TransformerFactoryImpl() |
In this way still you can use the Saxon transform implementaion without casuing any complications. When the system property is set, all the instantiations of transform factories which not uses the full qualified name of the transform factory class will be initialized with net.sf.saxon.TransfromerFactoryImpl and then it might lead to errors if they assume the default java xml transform implementation.
After recompiling and deployed the service the exception was not thrown
No comments:
Post a Comment