Geronimo StAX 无法找到 Woodstox 实现

发布于 2024-12-06 03:37:41 字数 2405 浏览 0 评论 0原文

使用 ant,我尝试调用一个自定义任务,在该任务中我尝试使用 Axis2 调用 Web 服务。我通过父 jar 中的 Class-Path 清单标头提供所有 jar。 geronimo-stax-api_1.0_spec-1.0.1.jar 和 wstx-asl-3.2.4.jar 均在 Class-Path 上定义。 StAX api(来自 geronimo-stax-api_1.0_spec-1.0.1.jar)正在尝试使用 com.ctc.wstx.stax.WstxInputFactory(来自 wstx-asl-3.2.4.jar)。我收到 Classloader 找不到该类。这似乎是一个类加载器问题,但我找不到任何错误。奇怪的是,如果我将 wstx-asl-3.2.4.jar 放在系统类路径上,它就会被找到。但是Sun/Oracle的jar规范表明Class-Path和系统类路径功能相同,使用相同的系统类加载器。顺便说一句,如您所见,有些 jar 是 osgi 捆绑包,我不确定这会导致任何问题。

堆栈跟踪如下所示:

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)

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 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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文