Loader constraint violation: javax.xml.soap.SOAPFault

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

Loader constraint violation: javax.xml.soap.SOAPFault

lechlukasz
Hello,

I'm getting LinkageError when processing SOAPFault:

java.lang.LinkageError: loader constraint violation: loader (instance of
<bootloader>) previously initiated loading for a different type with name
"javax/xml/soap/SOAPFault"

I've found out the very old issue about this:
https://issues.apache.org/jira/browse/KARAF-1840

Is it possible that it came back? Or this is my configuration error?

I'm using karaf 4.2.4 with apache-cxf 3.3.1, on JDK8.
I've configured everything with karaf 4.1.3 and definitely my code wasn't
running without providing apache-cxf. After updating to 4.2.4 I've got only
to upgrade cxf version.

I've got 'luck' with not getting SAOPFaults from remote server, at least
nobody noticed that problem after upgrade...

Can it be some issue between karaf and cxf?

And general question: how to debug such issues in first line? The class is
allegedly loaded twice, but which bundles have loaded it using which
classloaders?





--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Loader constraint violation: javax.xml.soap.SOAPFault

jbonofre
Hi,

did you check that you don't have dual bundle version ?

Can you check with package:exports the bundles providing javax.xml.soap
package ?

FYI, we are using Karaf 4.2.5 with CXF 3.3.2 without problem. Anyway,
let me test on the Karaf SOAP example.

Regards
JB

On 05/06/2019 11:47, lechlukasz wrote:

> Hello,
>
> I'm getting LinkageError when processing SOAPFault:
>
> java.lang.LinkageError: loader constraint violation: loader (instance of
> <bootloader>) previously initiated loading for a different type with name
> "javax/xml/soap/SOAPFault"
>
> I've found out the very old issue about this:
> https://issues.apache.org/jira/browse/KARAF-1840
>
> Is it possible that it came back? Or this is my configuration error?
>
> I'm using karaf 4.2.4 with apache-cxf 3.3.1, on JDK8.
> I've configured everything with karaf 4.1.3 and definitely my code wasn't
> running without providing apache-cxf. After updating to 4.2.4 I've got only
> to upgrade cxf version.
>
> I've got 'luck' with not getting SAOPFaults from remote server, at least
> nobody noticed that problem after upgrade...
>
> Can it be some issue between karaf and cxf?
>
> And general question: how to debug such issues in first line? The class is
> allegedly loaded twice, but which bundles have loaded it using which
> classloaders?
>
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Loader constraint violation: javax.xml.soap.SOAPFault

lechlukasz
In reply to this post by lechlukasz
I see only one exporter of javax.xml.soap:

Bundle 353 - Apache ServiceMix :: Specs :: SAAJ API 1.3 2.9.0 (state:
Active)
    Symbolic Name: org.apache.servicemix.specs.saaj-api-1.3
    Version: 2.9.0
    Bundle Location:
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/2.9.0
    Last Modification: Mon Jun 03 15:16:00 CEST 2019
    Bundle Documentation: http://www.apache.org/
    Vendor: The Apache Software Foundation
    Description: This pom provides project information that is common to all
ServiceMix branches.
    Start Level: 10
    Exported Packages:
        javax.xml.soap,version=1.3.0

Is it possible that someone has loaded that package from JRE, and not
endorsed version? Unfortunately my knowledge to endorsed mechanism is very
rudimentary, and java.lang.LinkageError is something that I wasn't even
familiar with until now.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Loader constraint violation: javax.xml.soap.SOAPFault

lechlukasz
In reply to this post by jbonofre
I've updated karaf to version 4.2.5 and cxf to 3.3.2 and the problem is still
existing.

Only handlin of SOAPFault produces the problem.

How exactly are you using CXF?

I have the following import in my bundle: org.apache.cxf.jaxws.spi

If I remove it, I have the following error:

SEVERE: Unknown JAXBContext implementation: class
com.sun.xml.bind.v2.runtime.JAXBContextImpl
com.sun.xml.internal.ws.spi.db.DatabindingException: Unknown JAXBContext
implementation: class com.sun.xml.bind.v2.runtime.JAXBContextImpl
      at
com.sun.xml.internal.ws.spi.db.BindingContextFactory.getJAXBFactory(BindingContextFactory.java:192)
      at
com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:134)
      at
com.sun.xml.internal.ws.message.jaxb.JAXBMessage.create(JAXBMessage.java:152)
      at
com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAP11Fault(SOAPFaultBuilder.java:424)
      at
com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:201)
      at
com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:189)
      at
com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:411)
      at
com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:706)
      at
com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:260)
      at
com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:98)
      at
com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:82)
      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
      at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
      at
sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
      at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
      at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Loader constraint violation: javax.xml.soap.SOAPFault

lechlukasz
I can provide more specific information. I've checked other web services that
we are calling.

The services that throws declared exception (via wsdl:fault section in wsdl)
are OK.

The only problem are services that declare no exceptions, and throw runtime
exceptions. Those exceptions are tried to be mapped to SOAPFault in CXF
code, and this is what is failing.

So the problem might never arise in properly defined web service
environment, where all exceptions that are thrown are declared in WSDL.

I hope this will be helpful in localizing the issue. I can imagine that case
wasn't tested because it's quite specific (unfortunately, if you're forced
to cooperate with 3rd party infrastructure, you can't influence the way they
(mis)behave).



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Loader constraint violation: javax.xml.soap.SOAPFault

jbonofre
In reply to this post by lechlukasz
I gonna check and try to reproduce on the Karaf SOAP provided example:

https://github.com/apache/karaf/tree/master/examples/karaf-soap-example

Regards
JB

On 05/06/2019 13:49, lechlukasz wrote:

> I've updated karaf to version 4.2.5 and cxf to 3.3.2 and the problem is still
> existing.
>
> Only handlin of SOAPFault produces the problem.
>
> How exactly are you using CXF?
>
> I have the following import in my bundle: org.apache.cxf.jaxws.spi
>
> If I remove it, I have the following error:
>
> SEVERE: Unknown JAXBContext implementation: class
> com.sun.xml.bind.v2.runtime.JAXBContextImpl
> com.sun.xml.internal.ws.spi.db.DatabindingException: Unknown JAXBContext
> implementation: class com.sun.xml.bind.v2.runtime.JAXBContextImpl
>       at
> com.sun.xml.internal.ws.spi.db.BindingContextFactory.getJAXBFactory(BindingContextFactory.java:192)
>       at
> com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:134)
>       at
> com.sun.xml.internal.ws.message.jaxb.JAXBMessage.create(JAXBMessage.java:152)
>       at
> com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAP11Fault(SOAPFaultBuilder.java:424)
>       at
> com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:201)
>       at
> com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:189)
>       at
> com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:411)
>       at
> com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:706)
>       at
> com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:260)
>       at
> com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:98)
>       at
> com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:82)
>       at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
>       at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
>       at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
>       at
> sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
>       at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
>       at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
>       at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>       at java.lang.Thread.run(Thread.java:745)
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Loader constraint violation: javax.xml.soap.SOAPFault

lechlukasz
Hello,

I've found something out.
The exception comes from:

java.lang.LinkageError: javax/xml/soap/SOAPFault
at javax.xml.ws.soap.SOAPFaultException.<init>(SOAPFaultException.java:63)
~[?:?]
at
org.apache.cxf.jaxws.JaxWsClientProxy.mapException(JaxWsClientProxy.java:195)
~[?:?]
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
~[?:?]

The class javax.xml.ws.soap.SOAPFaultException comes from system bundle (0),
which means, it has loaded javax.xml.soap.SOAPFault from JRE.

However, system bundle doesn't export javax.xml.soap package, it comes (in
my case) from org.apache.servicemix.specs.saaj-api-1.3

If I understand it correctly, the proxy generated by CXF, called from my
module, with my module's class loader, has loaded  javax.xml.soap.SOAPFault
definition from org.apache.servicemix.specs.saaj-api-1.3, while
javax.xml.ws.soap.SOAPFaultException is bound with class definition loaded
from JRE, which generates LinkageError.

Could you check if it is plausible, and what is the possible workaround?



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html