pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

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

pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

sahlex
Hi all.

I wrote a servlet filter to be used in a web (WAR) deployment. The servlet filter performs a remote request to a SOAP service with a configurable WSDL location. So the wsdl is not known locally to the web project. When creating the SOAP client, I get an exception the stacktrace of which is:

java.lang.Exception: Throwable caught while executing.
        at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1942)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1469)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:59)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1340)[17:com.netflix.hystrix.core:1.5.6]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[23:io.reactivex.rxjava:1.2.0]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[17:com.netflix.hystrix.core:1.5.6]
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[23:io.reactivex.rxjava:1.2.0]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154)
        at com.sun.xml.internal.ws.util.xml.XmlUtil.newXMLInputFactory(XmlUtil.java:423)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:116)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.access$000(XMLStreamReaderFactory.java:62)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:77)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:72)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.get(XMLStreamReaderFactory.java:137)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:160)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:1023)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:385)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseUsingMex(RuntimeWSDLParser.java:296)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:248)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)[:1.8.0_66]
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)[:1.8.0_66]
        at javax.xml.ws.Service.<init>(Service.java:77)
       <omitted classes>
        ... 26 more
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)[:1.8.0_66]
        ... 61 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)[:1.8.0_66]
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)[:1.8.0_66]
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)

After debugging I know that the service framework is unable to locate the WstxInputFactory class because it is not seen from the class loader in charge. The class loader used is the one from PAX-WEB jetty bundle because my servlet filter is called by that bundle and thus the WstxInputFactory class has to be visible from pax web bundle (it's org.ops4j.pax.web.pax-web-jetty).

I solved the issue with a fragment bundle that adds an import of package  com.ctc.wstx.stax to org.ops4j.pax.web.pax-web-jetty fragment host.

Is that the 'correct' way to fix the issue or should the pax-web-jetty bundle be able to find the XmlInputFactory without further intervention?

Best regards,
Alexander
Reply | Threaded
Open this post in threaded view
|

RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

Matthew Shaw

Hi Alex,

 

I encountered a similar issue when executing xslt from a camel route deployed in karaf. I think your fix is fine.

 

I solved my issue my setting the thread class loader to the bundle’s classloader before executing my code.

 

Cheers,

Matt.

 

From: [hidden email] [mailto:[hidden email]]
Sent: Thursday, 7 September 2017 12:32 AM
To: [hidden email]
Subject: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

 

Hi all.

 

I wrote a servlet filter to be used in a web (WAR) deployment. The servlet filter performs a remote request to a SOAP service with a configurable WSDL location. So the wsdl is not known locally to the web project. When creating the SOAP client, I get an exception the stacktrace of which is:

 

java.lang.Exception: Throwable caught while executing.
        at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1942)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1469)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:59)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1340)[17:com.netflix.hystrix.core:1.5.6]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[23:io.reactivex.rxjava:1.2.0]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[17:com.netflix.hystrix.core:1.5.6]
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[23:io.reactivex.rxjava:1.2.0]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154)
        at com.sun.xml.internal.ws.util.xml.XmlUtil.newXMLInputFactory(XmlUtil.java:423)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:116)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.access$000(XMLStreamReaderFactory.java:62)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:77)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:72)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.get(XMLStreamReaderFactory.java:137)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:160)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:1023)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:385)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseUsingMex(RuntimeWSDLParser.java:296)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:248)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)[:1.8.0_66]
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)[:1.8.0_66]
        at javax.xml.ws.Service.<init>(Service.java:77)
       <omitted classes>
        ... 26 more
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)[:1.8.0_66]
        ... 61 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)[:1.8.0_66]
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)[:1.8.0_66]
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)

 

After debugging I know that the service framework is unable to locate the WstxInputFactory class because it is not seen from the class loader in charge. The class loader used is the one from PAX-WEB jetty bundle because my servlet filter is called by that bundle and thus the WstxInputFactory class has to be visible from pax web bundle (it's org.ops4j.pax.web.pax-web-jetty).

 

I solved the issue with a fragment bundle that adds an import of package  com.ctc.wstx.stax to org.ops4j.pax.web.pax-web-jetty fragment host.

 

Is that the 'correct' way to fix the issue or should the pax-web-jetty bundle be able to find the XmlInputFactory without further intervention?

 

Best regards,

Alexander

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|

Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

sahlex
Hi Matt.

Well, setting the thread's class loader clearly assumes knowledge of the internals of the used components. When the implementation of the dependent components change changes, your implementation may break or cease to work correctly.

I consider setting the bundle classloader a code smell.

Best regards,
Alexander.


>>>
Hi Alex,
 
I encountered a similar issue when executing xslt from a camel route deployed in karaf. I think your fix is fine.
 
I solved my issue my setting the thread class loader to the bundle’s classloader before executing my code.
 
Cheers,
Matt.
 
From: [hidden email] [mailto:[hidden email]]
Sent: Thursday, 7 September 2017 12:32 AM
To: [hidden email]
Subject: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory
 
Hi all.
 
I wrote a servlet filter to be used in a web (WAR) deployment. The servlet filter performs a remote request to a SOAP service with a configurable WSDL location. So the wsdl is not known locally to the web project. When creating the SOAP client, I get an exception the stacktrace of which is:
 
java.lang.Exception: Throwable caught while executing.
        at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1942)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1469)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:59)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1340)[17:com.netflix.hystrix.core:1.5.6]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[23:io.reactivex.rxjava:1.2.0]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[17:com.netflix.hystrix.core:1.5.6]
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[23:io.reactivex.rxjava:1.2.0]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154)
        at com.sun.xml.internal.ws.util.xml.XmlUtil.newXMLInputFactory(XmlUtil.java:423)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:116)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.access$000(XMLStreamReaderFactory.java:62)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:77)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:72)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.get(XMLStreamReaderFactory.java:137)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:160)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:1023)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:385)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseUsingMex(RuntimeWSDLParser.java:296)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:248)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)[:1.8.0_66]
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)[:1.8.0_66]
        at javax.xml.ws.Service.<init>(Service.java:77)
       <omitted classes>
        ... 26 more
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)[:1.8.0_66]
        ... 61 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)[:1.8.0_66]
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)[:1.8.0_66]
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)
 
After debugging I know that the service framework is unable to locate the WstxInputFactory class because it is not seen from the class loader in charge. The class loader used is the one from PAX-WEB jetty bundle because my servlet filter is called by that bundle and thus the WstxInputFactory class has to be visible from pax web bundle (it's org.ops4j.pax.web.pax-web-jetty).
 
I solved the issue with a fragment bundle that adds an import of package  com.ctc.wstx.stax to org.ops4j.pax.web.pax-web-jetty fragment host.
 
Is that the 'correct' way to fix the issue or should the pax-web-jetty bundle be able to find the XmlInputFactory without further intervention?
 
Best regards,
Alexander
This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.
If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.
Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.
********************************************************************************
The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.
Reply | Threaded
Open this post in threaded view
|

RE: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

Matthew Shaw

Yep, fair point. Depends on your situation I guess.

 

From: [hidden email] [mailto:[hidden email]]
Sent: Thursday, 7 September 2017 6:31 PM
To: [hidden email]
Subject: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

 

Hi Matt.

 

Well, setting the thread's class loader clearly assumes knowledge of the internals of the used components. When the implementation of the dependent components change changes, your implementation may break or cease to work correctly.

 

I consider setting the bundle classloader a code smell.

 

Best regards,

Alexander.



>>>

Hi Alex,

 

I encountered a similar issue when executing xslt from a camel route deployed in karaf. I think your fix is fine.

 

I solved my issue my setting the thread class loader to the bundle’s classloader before executing my code.

 

Cheers,

Matt.

 

From: [hidden email] [[hidden email]]
Sent: Thursday, 7 September 2017 12:32 AM
To: [hidden email]
Subject: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

 

Hi all.

 

I wrote a servlet filter to be used in a web (WAR) deployment. The servlet filter performs a remote request to a SOAP service with a configurable WSDL location. So the wsdl is not known locally to the web project. When creating the SOAP client, I get an exception the stacktrace of which is:

 

java.lang.Exception: Throwable caught while executing.
        at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1942)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1469)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:59)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1340)[17:com.netflix.hystrix.core:1.5.6]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[23:io.reactivex.rxjava:1.2.0]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[17:com.netflix.hystrix.core:1.5.6]
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[23:io.reactivex.rxjava:1.2.0]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154)
        at com.sun.xml.internal.ws.util.xml.XmlUtil.newXMLInputFactory(XmlUtil.java:423)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:116)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.access$000(XMLStreamReaderFactory.java:62)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:77)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:72)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.get(XMLStreamReaderFactory.java:137)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:160)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:1023)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:385)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseUsingMex(RuntimeWSDLParser.java:296)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:248)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)[:1.8.0_66]
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)[:1.8.0_66]
        at javax.xml.ws.Service.<init>(Service.java:77)
       <omitted classes>
        ... 26 more
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)[:1.8.0_66]
        ... 61 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)[:1.8.0_66]
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)[:1.8.0_66]
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)

 

After debugging I know that the service framework is unable to locate the WstxInputFactory class because it is not seen from the class loader in charge. The class loader used is the one from PAX-WEB jetty bundle because my servlet filter is called by that bundle and thus the WstxInputFactory class has to be visible from pax web bundle (it's org.ops4j.pax.web.pax-web-jetty).

 

I solved the issue with a fragment bundle that adds an import of package  com.ctc.wstx.stax to org.ops4j.pax.web.pax-web-jetty fragment host.

 

Is that the 'correct' way to fix the issue or should the pax-web-jetty bundle be able to find the XmlInputFactory without further intervention?

 

Best regards,

Alexander

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|

RE: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

Siano, Stephan

Hi,

 

to come back to the original problem. When parsing a web.xml the war-extender should consider the class loader of the war (or wab). So if the wab manifest is containing an import statement for com.ctc.wstx.stax or the war is containing the Woodstox-parser this should actually be resolvable. The pax-web-jetty fragment works because the processing is also including the classloader of that bundle in order to be able to load artifacts that come with the web container (jetty).

 

I didn’t find any pax-web classes in the stack trace you provided, which confuses me a little. When do you get this exception and how does the manifest of your war look like?

 

Best regards

Stephan

 

From: Matthew Shaw [mailto:[hidden email]]
Sent: Donnerstag, 7. September 2017 23:21
To: [hidden email]
Subject: RE: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

 

Yep, fair point. Depends on your situation I guess.

 

From: [hidden email] [[hidden email]]
Sent: Thursday, 7 September 2017 6:31 PM
To: [hidden email]
Subject: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

 

Hi Matt.

 

Well, setting the thread's class loader clearly assumes knowledge of the internals of the used components. When the implementation of the dependent components change changes, your implementation may break or cease to work correctly.

 

I consider setting the bundle classloader a code smell.

 

Best regards,

Alexander.



>>>

Hi Alex,

 

I encountered a similar issue when executing xslt from a camel route deployed in karaf. I think your fix is fine.

 

I solved my issue my setting the thread class loader to the bundle’s classloader before executing my code.

 

Cheers,

Matt.

 

From: [hidden email] [[hidden email]]
Sent: Thursday, 7 September 2017 12:32 AM
To: [hidden email]
Subject: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

 

Hi all.

 

I wrote a servlet filter to be used in a web (WAR) deployment. The servlet filter performs a remote request to a SOAP service with a configurable WSDL location. So the wsdl is not known locally to the web project. When creating the SOAP client, I get an exception the stacktrace of which is:

 

java.lang.Exception: Throwable caught while executing.
        at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1942)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1469)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:59)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1340)[17:com.netflix.hystrix.core:1.5.6]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[23:io.reactivex.rxjava:1.2.0]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[17:com.netflix.hystrix.core:1.5.6]
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[23:io.reactivex.rxjava:1.2.0]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154)
        at com.sun.xml.internal.ws.util.xml.XmlUtil.newXMLInputFactory(XmlUtil.java:423)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:116)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.access$000(XMLStreamReaderFactory.java:62)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:77)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:72)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.get(XMLStreamReaderFactory.java:137)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:160)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:1023)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:385)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseUsingMex(RuntimeWSDLParser.java:296)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:248)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)[:1.8.0_66]
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)[:1.8.0_66]
        at javax.xml.ws.Service.<init>(Service.java:77)
       <omitted classes>
        ... 26 more
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)[:1.8.0_66]
        ... 61 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)[:1.8.0_66]
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)[:1.8.0_66]
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)

 

After debugging I know that the service framework is unable to locate the WstxInputFactory class because it is not seen from the class loader in charge. The class loader used is the one from PAX-WEB jetty bundle because my servlet filter is called by that bundle and thus the WstxInputFactory class has to be visible from pax web bundle (it's org.ops4j.pax.web.pax-web-jetty).

 

I solved the issue with a fragment bundle that adds an import of package  com.ctc.wstx.stax to org.ops4j.pax.web.pax-web-jetty fragment host.

 

Is that the 'correct' way to fix the issue or should the pax-web-jetty bundle be able to find the XmlInputFactory without further intervention?

 

Best regards,

Alexander

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|

RE: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory

sahlex
Hi Stephan.

OMG, it's so easy!

1st of all, you are right. It's (if anyways) an issue of war support, not pax-web.
2nd: It's not an issue at all. I didn't have the Import-Package for com.ctc.wstx.stax in the war bundle. As soon as I add it, I don't need the fragment any more.

Thanks!

Bast regards,
Alexander



>>>
Hi,
 
to come back to the original problem. When parsing a web.xml the war-extender should consider the class loader of the war (or wab). So if the wab manifest is containing an import statement for com.ctc.wstx.stax or the war is containing the Woodstox-parser this should actually be resolvable. The pax-web-jetty fragment works because the processing is also including the classloader of that bundle in order to be able to load artifacts that come with the web container (jetty).
 
I didn’t find any pax-web classes in the stack trace you provided, which confuses me a little. When do you get this exception and how does the manifest of your war look like?
 
Best regards
Stephan
From: Matthew Shaw [mailto:[hidden email]]
Sent: Donnerstag, 7. September 2017 23:21
To: [hidden email]
Subject: RE: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory
 
Yep, fair point. Depends on your situation I guess.
 
From: [hidden email] [[hidden email]]
Sent: Thursday, 7 September 2017 6:31 PM
To: [hidden email]
Subject: Antw: RE: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory
 
Hi Matt.
 
Well, setting the thread's class loader clearly assumes knowledge of the internals of the used components. When the implementation of the dependent components change changes, your implementation may break or cease to work correctly.
 
I consider setting the bundle classloader a code smell.
 
Best regards,
Alexander.


>>>
Hi Alex,
 
I encountered a similar issue when executing xslt from a camel route deployed in karaf. I think your fix is fine.
 
I solved my issue my setting the thread class loader to the bundle’s classloader before executing my code.
 
Cheers,
Matt.
 
From: [hidden email] [[hidden email]]
Sent: Thursday, 7 September 2017 12:32 AM
To: [hidden email]
Subject: pax-web-jetty bundle is unable to find class com.ctc.wstx.stax.WstxInputFactory
 
Hi all.
 
I wrote a servlet filter to be used in a web (WAR) deployment. The servlet filter performs a remote request to a SOAP service with a configurable WSDL location. So the wsdl is not known locally to the web project. When creating the SOAP client, I get an exception the stacktrace of which is:
 
java.lang.Exception: Throwable caught while executing.
        at com.netflix.hystrix.AbstractCommand.getExceptionFromThrowable(AbstractCommand.java:1942)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.wrapWithOnExecutionErrorHook(AbstractCommand.java:1469)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand.access$1300(AbstractCommand.java:59)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1340)[17:com.netflix.hystrix.core:1.5.6]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.observers.Subscribers$5.onError(Subscribers.java:230)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)[23:io.reactivex.rxjava:1.2.0]
        at rx.Observable.unsafeSubscribe(Observable.java:10151)[23:io.reactivex.rxjava:1.2.0]
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)[23:io.reactivex.rxjava:1.2.0]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)[17:com.netflix.hystrix.core:1.5.6]
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)[17:com.netflix.hystrix.core:1.5.6]
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)[23:io.reactivex.rxjava:1.2.0]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154)
        at com.sun.xml.internal.ws.util.xml.XmlUtil.newXMLInputFactory(XmlUtil.java:423)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:116)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.access$000(XMLStreamReaderFactory.java:62)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:77)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$1.initialValue(XMLStreamReaderFactory.java:72)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.get(XMLStreamReaderFactory.java:137)[:1.8.0_66]
        at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:160)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:1023)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:385)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseUsingMex(RuntimeWSDLParser.java:296)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:248)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)[:1.8.0_66]
        at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)[:1.8.0_66]
        at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)[:1.8.0_66]
        at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)[:1.8.0_66]
        at javax.xml.ws.Service.<init>(Service.java:77)
       <omitted classes>
        ... 26 more
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)[:1.8.0_66]
        ... 61 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)[:1.8.0_66]
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)[:1.8.0_66]
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)[:1.8.0_66]
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
        at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)
 
After debugging I know that the service framework is unable to locate the WstxInputFactory class because it is not seen from the class loader in charge. The class loader used is the one from PAX-WEB jetty bundle because my servlet filter is called by that bundle and thus the WstxInputFactory class has to be visible from pax web bundle (it's org.ops4j.pax.web.pax-web-jetty).
 
I solved the issue with a fragment bundle that adds an import of package  com.ctc.wstx.stax to org.ops4j.pax.web.pax-web-jetty fragment host.
 
Is that the 'correct' way to fix the issue or should the pax-web-jetty bundle be able to find the XmlInputFactory without further intervention?
 
Best regards,
Alexander
This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.
If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.
Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.
********************************************************************************
The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.
This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.
If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.
Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.
********************************************************************************
The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.