tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID" <dk0...@att.com>
Subject RE: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir
Date Fri, 10 Mar 2017 01:08:43 GMT
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Thursday, March 09, 2017 4:39 PM
> To: users@tomee.apache.org
> Subject: Re: Setting "openejb.classloader.forced-load" to include
> "org.apache.cxf" is still loading some classes from tomee lib dir
> 
> Hi
> 
> did you identify which classes was loaded from where? (in term of code
> path and not classloader). Once this is known it would be easier to
> solve it.

Not quite, but thinking about this gave me a clue, although I still don't have a solution.

Right after my code created the "ClientBuilder" instance, I saw it load javax.ws.rs.client.ClientBuilder
from the TomEE lib dir.  It then loads many CXF classes from the same directory.

So, I figured that I should add "javax.ws.rs.client" to the "forced-load" list.

That just resulted in a different stacktrace:
-----------------
org.apache.cxf.interceptor.Fault: ClassCastException: attempting to castjar:file:.../apache-tomee-webprofile-7.0.1/lib/javaee-api-7.0.jar!/javax/ws/rs/client/ClientBuilder.class
to jar:file:.../.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/uslMonitorService/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar!/javax/ws/rs/client/ClientBuilder.class
	at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
    ...
Caused by: java.lang.LinkageError: ClassCastException: attempting to castjar:file:.../apache-tomee-webprofile-7.0.1/lib/javaee-api-7.0.jar!/javax/ws/rs/client/ClientBuilder.class
to jar:file:.../.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/uslMonitorService/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar!/javax/ws/rs/client/ClientBuilder.class
	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:97)
	at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114)
---------------
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__twitter.com_rmannibucau&d=DwIBaQ&c=LFYZ-
> o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=i7rGuYqiD2shB4GPAkohwmpGuCsHDpMNi6-
> s7wfTVtQ&s=0CK9zOVBU8nHUzp-IbhQ5gTotA_WyMrlt5vS8yZAu20&e= > |  Blog
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__blog-
> 2Drmannibucau.rhcloud.com&d=DwIBaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=i7rGuYqiD2shB4GPAkohwmpGuCsHDpMNi6-
> s7wfTVtQ&s=vb67kZl6WtAWknP-D-_DnsB-_XZdcJWnX8X7pEJ_0Js&e= > | Old Blog
> <https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__rmannibucau.wordpress.com&d=DwIBaQ&c=LFYZ-
> o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=i7rGuYqiD2shB4GPAkohwmpGuCsHDpMNi6-
> s7wfTVtQ&s=_lFWMKFTh7BRzFDesYUfFger5PUuDmKNbxsThf7gUmg&e= > | Github
> <https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__github.com_rmannibucau&d=DwIBaQ&c=LFYZ-
> o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=i7rGuYqiD2shB4GPAkohwmpGuCsHDpMNi6-
> s7wfTVtQ&s=ceR5hOrxX6nsYrQfLk3tiVkEyjtEZItA1qhm7wJwI5c&e= > | LinkedIn
> <https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__www.linkedin.com_in_rmannibucau&d=DwIBaQ&c=LFYZ-
> o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=i7rGuYqiD2shB4GPAkohwmpGuCsHDpMNi6-
> s7wfTVtQ&s=USlF5RKPexLQFpbLeL2nfE2btUQYG7xD1l5UIHjT36s&e= > | JavaEE
> Factory <https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__javaeefactory-2Drmannibucau.rhcloud.com&d=DwIBaQ&c=LFYZ-
> o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=i7rGuYqiD2shB4GPAkohwmpGuCsHDpMNi6-
> s7wfTVtQ&s=kH6YCQd6PwHCjd2dP0DlyTAhsP_KidkGuQAEuQhJxgs&e= >
> 
> 2017-03-10 1:21 GMT+01:00 KARR, DAVID <dk068x@att.com>:
> 
> > I'm currently using CXF 3.1.9 and Spring 4.3.5 in an app built with
> > Gradle, and running in Tomcat 8 (TomEE 7.0.1).
> >
> > I currently only specify the following explicit CXF dependencies:
> > -----------
> > ['cxf-rt-rs-extension-providers', 'cxf-rt-management'].each {
> >     compile "org.apache.cxf:${it}:3.1.9"
> > }
> > -----------
> >
> > This gets several other artifacts transitively, including cxf-core.
> >
> > Up to now, the app has just been serving REST requests, and it's been
> > working fine. I'm now trying to add a simple request out to another
> > service, using ClientBuilder. When I try to send that message, I get
> this:
> > ------------
> > SEVERE: Failed to determine BusFactory implementation class name.
> > java.lang.ClassCastException: class  org.apache.cxf.bus.spring.
> > SpringBusFactory
> >     at java.lang.Class.asSubclass(Class.java:3404)
> >     at
> > org.apache.cxf.BusFactory.getBusFactoryClass(BusFactory.java:390)
> > ------------
> >
> > The occurrences of this error seem to imply that there is a
> > classloading issue with BusFactory.  So, I turned on verbose
> > classloading, and I did see CXF classes being loaded from both the CXF
> > jars in my webapp, and also in the "lib" dir in TomEE, specifically
> > the BusFactory class.  However, in the "system.properties" file in the
> > "Server" definition in Eclipse, I have
> > "openejb.classloader.forced-load=org.springframework,org.apache.cxf"
> (and also "disabled=true" in the "cxf.properties" and "cxf-
> rs.properties"
> > files).  So, I appear to have the proper settings to make it load all
> > the CXF (and Spring) classes from my webapp, instead of from the
> > container, but it's not quite working.
> >
> > What else could be wrong here?
> >
Mime
View raw message