[Axiom] javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Axiom] javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located

Jayanga Dissanayake
Hi All,

I am trying to run an OSGi-fied axis2 engine, with Carbon5 kernel (Carbon5 is an OSGi environment).

I have included all the dependencies in the "osgi/dropins" directory, which will we loaded into the OSGi environment by the above mentioned Carbon5 kernel. I checked the bundles in the OSGi console. All the bundles are in ACTIVE state, except for the bundle "axis2-runtime-new_1.0.0", in which I am trying to create a ConfigurationContext via an axis2.xml file [1], in the start method of the activator.

According to the stack trace "javax.xml.stream.FactoryLocator" is trying to load the factory "com.ctc.wstx.stax.WstxInputFactory". I checked the source of the javax.xml.stream.FactoryLocator in [2]. According to the source this is caused by a ClassNotFoundException (line 115)

I have woodstox-core-asl_4.4.1 bundle in active state which exports the package "com.ctc.wstx.stax" with version 4.4.1, But it seems "org.apache.ws.commons.axiom.axiom-api" is unable to load the com.ctc.wstx.stax.WstxInputFactory.

Does anyone know what is going over here? or a way to fix this issue.

[1]
ConfigurationContext configurationContext = ConfigurationContextFactory.
                    createConfigurationContextFromFileSystem(null, axis2FilePath);

[2] http://grepcode.com/file/repo1.maven.org/maven2/org.apache.geronimo.specs/geronimo-stax-api_1.0_spec/1.0/javax/xml/stream/FactoryLocator.java

[3]
org.osgi.framework.BundleException: Exception in org.wso2.carbon.axis2.runtime.internal.Activator.start() of bundle axis2-runtime-new.
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
    at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
    at org.eclipse.osgi.container.Module.doStart(Module.java:571)
    at org.eclipse.osgi.container.Module.start(Module.java:439)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
    at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:438)
    at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
    at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
    at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
    at org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
    at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
    at org.eclipse.osgi.container.Module.doStart(Module.java:571)
    at org.eclipse.osgi.container.Module.start(Module.java:439)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
    at org.wso2.carbon.launcher.CarbonServer.loadInitialBundles(CarbonServer.java:243)
    at org.wso2.carbon.launcher.CarbonServer.start(CarbonServer.java:84)
    at org.wso2.carbon.launcher.Main.main(Main.java:83)
Caused by: javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located.  Classloader =org.eclipse.osgi.internal.loader.EquinoxClassLoader@1b74ac8[org.apache.ws.commons.axiom.axiom-api:1.2.17(id=30)]
    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$1.run(StAXUtils.java:437)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.axiom.om.util.StAXUtils.newXMLInputFactory(StAXUtils.java:427)
    at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_singleton(StAXUtils.java:541)
    at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:171)
    at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:134)
    at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:209)
    at org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createXMLStreamReader(AbstractOMMetaFactory.java:111)
    at org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createOMBuilder(AbstractOMMetaFactory.java:167)
    at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:161)
    at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:141)
    at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:112)
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:590)
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:575)
    at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
    at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:90)
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:857)
    at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
    at org.wso2.carbon.axis2.runtime.internal.Activator.start(Activator.java:51)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
    ... 26 more


[4]
Exported packages
    com.ctc.wstx.sr; version="4.4.1"[exported]
    com.ctc.wstx.msv; version="4.4.1"[exported]
    com.ctc.wstx.osgi; version="4.4.1"[exported]
    com.ctc.wstx.dom; version="4.4.1"[exported]
    com.ctc.wstx.api; version="4.4.1"[exported]
    com.ctc.wstx.sw; version="4.4.1"[exported]
    com.ctc.wstx.cfg; version="4.4.1"[exported]
    com.ctc.wstx.stax; version="4.4.1"[exported]
    com.ctc.wstx.sax; version="4.4.1"[exported]

Thanks in advance.

Regards,
Jayanga
Reply | Threaded
Open this post in threaded view
|

Re: [Axiom] javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located

Andreas Veithen
The geronimo-stax-api_1.0_spec bundle doesn't work with Woodstox. Use
the StAX API bundle from ServiceMix instead. For more information:
http://veithen.github.io/2014/10/12/stax-osgi.html

Andreas

On Wed, Jan 20, 2016 at 6:29 PM, Jayanga Dissanayake
<[hidden email]> wrote:

> Hi All,
>
> I am trying to run an OSGi-fied axis2 engine, with Carbon5 kernel (Carbon5
> is an OSGi environment).
>
> I have included all the dependencies in the "osgi/dropins" directory, which
> will we loaded into the OSGi environment by the above mentioned Carbon5
> kernel. I checked the bundles in the OSGi console. All the bundles are in
> ACTIVE state, except for the bundle "axis2-runtime-new_1.0.0", in which I am
> trying to create a ConfigurationContext via an axis2.xml file [1], in the
> start method of the activator.
>
> According to the stack trace "javax.xml.stream.FactoryLocator" is trying to
> load the factory "com.ctc.wstx.stax.WstxInputFactory". I checked the source
> of the javax.xml.stream.FactoryLocator in [2]. According to the source this
> is caused by a ClassNotFoundException (line 115)
>
> I have woodstox-core-asl_4.4.1 bundle in active state which exports the
> package "com.ctc.wstx.stax" with version 4.4.1, But it seems
> "org.apache.ws.commons.axiom.axiom-api" is unable to load the
> com.ctc.wstx.stax.WstxInputFactory.
>
> Does anyone know what is going over here? or a way to fix this issue.
>
> [1]
> ConfigurationContext configurationContext = ConfigurationContextFactory.
>                     createConfigurationContextFromFileSystem(null,
> axis2FilePath);
>
> [2]
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.geronimo.specs/geronimo-stax-api_1.0_spec/1.0/javax/xml/stream/FactoryLocator.java
>
> [3]
> org.osgi.framework.BundleException: Exception in
> org.wso2.carbon.axis2.runtime.internal.Activator.start() of bundle
> axis2-runtime-new.
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
>     at org.eclipse.osgi.container.Module.doStart(Module.java:571)
>     at org.eclipse.osgi.container.Module.start(Module.java:439)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
>     at
> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:438)
>     at
> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
>     at
> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
>     at
> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
>     at
> org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
>     at org.eclipse.osgi.container.Module.doStart(Module.java:571)
>     at org.eclipse.osgi.container.Module.start(Module.java:439)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
>     at
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
>     at
> org.wso2.carbon.launcher.CarbonServer.loadInitialBundles(CarbonServer.java:243)
>     at org.wso2.carbon.launcher.CarbonServer.start(CarbonServer.java:84)
>     at org.wso2.carbon.launcher.Main.main(Main.java:83)
> Caused by: javax.xml.stream.FactoryConfigurationError: Requested factory
> com.ctc.wstx.stax.WstxInputFactory cannot be located.  Classloader
> =org.eclipse.osgi.internal.loader.EquinoxClassLoader@1b74ac8[org.apache.ws.commons.axiom.axiom-api:1.2.17(id=30)]
>     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$1.run(StAXUtils.java:437)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.apache.axiom.om.util.StAXUtils.newXMLInputFactory(StAXUtils.java:427)
>     at
> org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_singleton(StAXUtils.java:541)
>     at
> org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:171)
>     at
> org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:134)
>     at
> org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:209)
>     at
> org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createXMLStreamReader(AbstractOMMetaFactory.java:111)
>     at
> org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createOMBuilder(AbstractOMMetaFactory.java:167)
>     at
> org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:161)
>     at
> org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:141)
>     at
> org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:112)
>     at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:590)
>     at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:575)
>     at
> org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
>     at
> org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:90)
>     at
> org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:857)
>     at
> org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
>     at
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
>     at
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
>     at
> org.wso2.carbon.axis2.runtime.internal.Activator.start(Activator.java:51)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
>     ... 26 more
>
>
> [4]
> Exported packages
>     com.ctc.wstx.sr; version="4.4.1"[exported]
>     com.ctc.wstx.msv; version="4.4.1"[exported]
>     com.ctc.wstx.osgi; version="4.4.1"[exported]
>     com.ctc.wstx.dom; version="4.4.1"[exported]
>     com.ctc.wstx.api; version="4.4.1"[exported]
>     com.ctc.wstx.sw; version="4.4.1"[exported]
>     com.ctc.wstx.cfg; version="4.4.1"[exported]
>     com.ctc.wstx.stax; version="4.4.1"[exported]
>     com.ctc.wstx.sax; version="4.4.1"[exported]
>
> Thanks in advance.
>
> Regards,
> Jayanga