Geronimo StAX can't locate Woodstox implementation
Using ant, I am trying to invoke a self-defined task, in which I am trying to call a web services using Axis2. I am providing all the jars by Class-Path manifest header in the parent jar. Both geronimo-stax-api_1.0_spec-1.0.1.jar and wstx-asl-3.2.4.jar are defined on Class-Path. StAX api(from geronimo-stax-api_1.0_spec-1.0.1.jar) is trying to use com.ctc.wstx.stax.WstxInputFactory(from wstx-asl-3.2.4.jar). I am getting Classloader can't locate the class. This开发者_如何学JAVA seems to be a class loader problem, but I can't find anything wrong. The weird thing is if I put wstx-asl-3.2.4.jar on my system classpath, it will be located. But the jar spec from Sun/Oracle indicates Class-Path and system classpath function the same, use the same system class loader. BTW, as you see, some jars are osgi bundle, I am not sure this will cause any problem.
The stacktrace is shown below:
javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located. Classloader =java.net.URLClassLoader@341960
at javax.xml.stream.FactoryLocator.loadFactory(FactoryLocator.java:120)
at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:109)
at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:54)
at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:41)
at org.apache.axiom.om.util.StAXUtils$7.run(StAXUtils.java:311)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(StAXUtils.java:306)
at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:76)
at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:131)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:596)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581)
at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:86)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:641)
at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)
at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:244)
精彩评论