You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Beyer, Doug" <do...@troppussoftware.com> on 2011/10/03 19:10:56 UTC

com.ctc.wstx.stax.WstxInputFactory cannot be located

For testing purposes, I've created a simple bundle that accesses a public weather service. I've included all the jars in the lib directory of the axis2-1.6.1 distribution in my bundle and set the bundle's classpath accordingly. I've included the contents of my manifest.mf file at the bottom of this email. I'm attempting to run this in Felix 3.2.2.

I've worked thru all the obvious classpath issues. But now I'm stuck on the following error. I've even explicitly added wstx-asl-3.2.9.jar to my bundle (and modified the bundle's classpath accordingly) in an attempt to locate com.ctc.wstx.stax.WstxInputFactory.

Exception in thread "WeatherThread" javax.xml.stream.FactoryConfigurationError:
Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located.  Classlo
ader =sun.misc.Launcher$AppClassLoader@4aad3ba4
        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:505)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axiom.om.util.StAXUtils.newXMLInputFactory(StAXUtils.java:
495)
        at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(
StAXUtils.java:566)
        at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:
172)
        at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:
137)
        at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.ja
va:224)
        at org.apache.axiom.om.impl.AbstractOMMetaFactory.createXMLStreamReader(
AbstractOMMetaFactory.java:48)
        at org.apache.axiom.om.impl.AbstractOMMetaFactory.createOMBuilder(Abstra
ctOMMetaFactory.java:73)
        at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderF
actory.java:94)
        at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderF
actory.java:79)
        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(DescriptionBui
lder.java:97)
        at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConf
igBuilder.java:89)
        at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguratio
n(DeploymentEngine.java:857)
        at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfigurati
on(FileSystemConfigurator.java:116)
        at org.apache.axis2.context.ConfigurationContextFactory.createConfigurat
ionContext(ConfigurationContextFactory.java:64)
        at org.apache.axis2.context.ConfigurationContextFactory.createConfigurat
ionContextFromFileSystem(ConfigurationContextFactory.java:210)
        at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceC
lient.java:151)
        at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:144)
        at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:98)
        at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:84)
        at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:132)
        at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:124)
        at com.dbeyer.Activator$2.run(Activator.java:235)
        at java.lang.Thread.run(Unknown Source)


Does anyone know how to get around this error?


>> manifest.mf >>

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Beyer Weather Service (axis2)
Bundle-Vendor: Beyer
Bundle-SymbolicName: com.beyer.weather.axis2
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .,
lib/endorsed\geronimo-jaxws_2.2_spec-1.0.jar,
lib/endorsed\geronimo-saaj_1.3_spec-1.0.1.jar,
lib/endorsed\jaxb-api-2.1.jar,
lib/activation-1.1.jar,
lib/antlr-2.7.7.jar,
lib/axiom-api-1.2.12.jar,
lib/axiom-dom-1.2.12.jar,
lib/axiom-impl-1.2.12.jar,
lib/axis2-adb-1.6.1.jar,
lib/axis2-adb-codegen-1.6.1.jar,
lib/axis2-ant-plugin-1.6.1.jar,
lib/axis2-clustering-1.6.1.jar,
lib/axis2-codegen-1.6.1.jar,
lib/axis2-corba-1.6.1.jar,
lib/axis2-fastinfoset-1.6.1.jar,
lib/axis2-java2wsdl-1.6.1.jar,
lib/axis2-jaxbri-1.6.1.jar,
lib/axis2-jaxws-1.6.1.jar,
lib/axis2-jibx-1.6.1.jar,
lib/axis2-json-1.6.1.jar,
lib/axis2-kernel-1.6.1.jar,
lib/axis2-metadata-1.6.1.jar,
lib/axis2-mtompolicy-1.6.1.jar,
lib/axis2-saaj-1.6.1.jar,
lib/axis2-soapmonitor-servlet-1.6.1.jar,
lib/axis2-spring-1.6.1.jar,
lib/axis2-transport-http-1.6.1.jar,
lib/axis2-transport-local-1.6.1.jar,
lib/axis2-xmlbeans-1.6.1.jar,
lib/bcel-5.1.jar,
lib/commons-cli-1.2.jar,
lib/commons-codec-1.3.jar,
lib/commons-fileupload-1.2.jar,
lib/commons-httpclient-3.1.jar,
lib/commons-io-1.4.jar,
lib/commons-logging-1.1.1.jar,
lib/geronimo-annotation_1.0_spec-1.1.jar,
lib/geronimo-jaxws_2.2_spec-1.0.jar,
lib/geronimo-jta_1.1_spec-1.1.jar,
lib/geronimo-saaj_1.3_spec-1.0.1.jar,
lib/geronimo-stax-api_1.0_spec-1.0.1.jar,
lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar,
lib/httpcore-4.0.jar,
lib/jalopy-1.5rc3.jar,
lib/jaxb-api-2.1.jar,
lib/jaxb-impl-2.1.7.jar,
lib/jaxb-xjc-2.1.7.jar,
lib/jaxen-1.1.1.jar,
lib/jaxws-tools-2.1.3.jar,
lib/jettison-1.0-RC2.jar,
lib/jibx-bind-1.2.jar,
lib/jibx-run-1.2.jar,
lib/jsr311-api-1.0.jar,
lib/juli-6.0.16.jar,
lib/log4j-1.2.15.jar,
lib/mail-1.4.jar,
lib/mex-1.6.1-impl.jar,
lib/neethi-3.0.1.jar,
lib/regexp-1.2.jar,
lib/tribes-6.0.16.jar,
lib/woden-api-1.0M9.jar,
lib/woden-impl-commons-1.0M9.jar,
lib/woden-impl-dom-1.0M9.jar,
lib/wsdl4j-1.6.2.jar,
lib/wstx-asl-3.2.9.jar,
lib/xalan-2.7.0.jar,
lib/xml-resolver-1.2.jar,
lib/xmlbeans-2.3.0.jar,
lib/XmlSchema-1.4.7.jar,
lib/wstx-asl-3.2.9.jar
Import-Package: org.osgi.framework,
org.osgi.util.tracker,
org.osgi.service.log,
org.xml.sax,
javax.xml.parsers,
javax.xml.namespace,
javax.xml.transform,
org.w3c.dom
Bundle-Activator: com.dbeyer.Activator

>> end manifest.mf >>

Re: com.ctc.wstx.stax.WstxInputFactory cannot be located

Posted by Andreas Veithen <an...@gmail.com>.
That is because the StAX API relies on the thread context class loader
to locate the StAX implementation, but in contrast to J2EE, the
context class loader is not set in an OSGi environment. Ideally,
instead of embedding these dependencies, you should use a fully OSGi
aware StAX API bundle (geronimo-stax-api_1.2_spec or the StAX API
bundle from ServiceMix) and also deploy the StAX implementation as a
separate bundle (this may require Woodstox 4.x instead of 3.2). In
addition, you could also use the Axiom artifacts as bundles, but
because of AXIS2-4902 this may require using snapshot versions of
Axiom and Axis2 (depending on the Axis2 features that you need).

Andreas

On Mon, Oct 3, 2011 at 19:10, Beyer, Doug
<do...@troppussoftware.com> wrote:
> For testing purposes, I’ve created a simple bundle that accesses a public
> weather service. I’ve included all the jars in the lib directory of the
> axis2-1.6.1 distribution in my bundle and set the bundle’s classpath
> accordingly. I’ve included the contents of my manifest.mf file at the bottom
> of this email. I’m attempting to run this in Felix 3.2.2.
>
>
>
> I’ve worked thru all the obvious classpath issues. But now I’m stuck on the
> following error. I’ve even explicitly added wstx-asl-3.2.9.jar to my bundle
> (and modified the bundle’s classpath accordingly) in an attempt to locate
> com.ctc.wstx.stax.WstxInputFactory.
>
>
>
> Exception in thread "WeatherThread"
> javax.xml.stream.FactoryConfigurationError:
>
> Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located.
> Classlo
>
> ader =sun.misc.Launcher$AppClassLoader@4aad3ba4
>
>         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:505)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>
>         at
> org.apache.axiom.om.util.StAXUtils.newXMLInputFactory(StAXUtils.java:
>
> 495)
>
>         at
> org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(
>
> StAXUtils.java:566)
>
>         at
> org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:
>
> 172)
>
>         at
> org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:
>
> 137)
>
>         at
> org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.ja
>
> va:224)
>
>         at
> org.apache.axiom.om.impl.AbstractOMMetaFactory.createXMLStreamReader(
>
> AbstractOMMetaFactory.java:48)
>
>         at
> org.apache.axiom.om.impl.AbstractOMMetaFactory.createOMBuilder(Abstra
>
> ctOMMetaFactory.java:73)
>
>         at
> org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderF
>
> actory.java:94)
>
>         at
> org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderF
>
> actory.java:79)
>
>         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(DescriptionBui
>
> lder.java:97)
>
>         at
> org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConf
>
> igBuilder.java:89)
>
>         at
> org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguratio
>
> n(DeploymentEngine.java:857)
>
>         at
> org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfigurati
>
> on(FileSystemConfigurator.java:116)
>
>         at
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurat
>
> ionContext(ConfigurationContextFactory.java:64)
>
>         at
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurat
>
> ionContextFromFileSystem(ConfigurationContextFactory.java:210)
>
>         at
> org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceC
>
> lient.java:151)
>
>         at
> org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:144)
>
>         at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:98)
>
>         at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:84)
>
>         at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:132)
>
>         at com.cdyne.ws.weatherws.WeatherStub.<init>(WeatherStub.java:124)
>
>         at com.dbeyer.Activator$2.run(Activator.java:235)
>
>         at java.lang.Thread.run(Unknown Source)
>
>
>
>
>
> Does anyone know how to get around this error?
>
>
>
>
>
>>> manifest.mf >>
>
>
>
> Manifest-Version: 1.0
>
> Bundle-ManifestVersion: 2
>
> Bundle-Name: Beyer Weather Service (axis2)
>
> Bundle-Vendor: Beyer
>
> Bundle-SymbolicName: com.beyer.weather.axis2
>
> Bundle-Version: 1.0.0
>
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>
> Bundle-ClassPath: .,
>
> lib/endorsed\geronimo-jaxws_2.2_spec-1.0.jar,
>
> lib/endorsed\geronimo-saaj_1.3_spec-1.0.1.jar,
>
> lib/endorsed\jaxb-api-2.1.jar,
>
> lib/activation-1.1.jar,
>
> lib/antlr-2.7.7.jar,
>
> lib/axiom-api-1.2.12.jar,
>
> lib/axiom-dom-1.2.12.jar,
>
> lib/axiom-impl-1.2.12.jar,
>
> lib/axis2-adb-1.6.1.jar,
>
> lib/axis2-adb-codegen-1.6.1.jar,
>
> lib/axis2-ant-plugin-1.6.1.jar,
>
> lib/axis2-clustering-1.6.1.jar,
>
> lib/axis2-codegen-1.6.1.jar,
>
> lib/axis2-corba-1.6.1.jar,
>
> lib/axis2-fastinfoset-1.6.1.jar,
>
> lib/axis2-java2wsdl-1.6.1.jar,
>
> lib/axis2-jaxbri-1.6.1.jar,
>
> lib/axis2-jaxws-1.6.1.jar,
>
> lib/axis2-jibx-1.6.1.jar,
>
> lib/axis2-json-1.6.1.jar,
>
> lib/axis2-kernel-1.6.1.jar,
>
> lib/axis2-metadata-1.6.1.jar,
>
> lib/axis2-mtompolicy-1.6.1.jar,
>
> lib/axis2-saaj-1.6.1.jar,
>
> lib/axis2-soapmonitor-servlet-1.6.1.jar,
>
> lib/axis2-spring-1.6.1.jar,
>
> lib/axis2-transport-http-1.6.1.jar,
>
> lib/axis2-transport-local-1.6.1.jar,
>
> lib/axis2-xmlbeans-1.6.1.jar,
>
> lib/bcel-5.1.jar,
>
> lib/commons-cli-1.2.jar,
>
> lib/commons-codec-1.3.jar,
>
> lib/commons-fileupload-1.2.jar,
>
> lib/commons-httpclient-3.1.jar,
>
> lib/commons-io-1.4.jar,
>
> lib/commons-logging-1.1.1.jar,
>
> lib/geronimo-annotation_1.0_spec-1.1.jar,
>
> lib/geronimo-jaxws_2.2_spec-1.0.jar,
>
> lib/geronimo-jta_1.1_spec-1.1.jar,
>
> lib/geronimo-saaj_1.3_spec-1.0.1.jar,
>
> lib/geronimo-stax-api_1.0_spec-1.0.1.jar,
>
> lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar,
>
> lib/httpcore-4.0.jar,
>
> lib/jalopy-1.5rc3.jar,
>
> lib/jaxb-api-2.1.jar,
>
> lib/jaxb-impl-2.1.7.jar,
>
> lib/jaxb-xjc-2.1.7.jar,
>
> lib/jaxen-1.1.1.jar,
>
> lib/jaxws-tools-2.1.3.jar,
>
> lib/jettison-1.0-RC2.jar,
>
> lib/jibx-bind-1.2.jar,
>
> lib/jibx-run-1.2.jar,
>
> lib/jsr311-api-1.0.jar,
>
> lib/juli-6.0.16.jar,
>
> lib/log4j-1.2.15.jar,
>
> lib/mail-1.4.jar,
>
> lib/mex-1.6.1-impl.jar,
>
> lib/neethi-3.0.1.jar,
>
> lib/regexp-1.2.jar,
>
> lib/tribes-6.0.16.jar,
>
> lib/woden-api-1.0M9.jar,
>
> lib/woden-impl-commons-1.0M9.jar,
>
> lib/woden-impl-dom-1.0M9.jar,
>
> lib/wsdl4j-1.6.2.jar,
>
> lib/wstx-asl-3.2.9.jar,
>
> lib/xalan-2.7.0.jar,
>
> lib/xml-resolver-1.2.jar,
>
> lib/xmlbeans-2.3.0.jar,
>
> lib/XmlSchema-1.4.7.jar,
>
> lib/wstx-asl-3.2.9.jar
>
> Import-Package: org.osgi.framework,
>
> org.osgi.util.tracker,
>
> org.osgi.service.log,
>
> org.xml.sax,
>
> javax.xml.parsers,
>
> javax.xml.namespace,
>
> javax.xml.transform,
>
> org.w3c.dom
>
> Bundle-Activator: com.dbeyer.Activator
>
>
>
>>> end manifest.mf >>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org