You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "KARR, DAVID" <dk...@att.com> on 2017/03/10 00:21:49 UTC

Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

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?

Re: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2017-03-10 17:39 GMT+01:00 KARR, DAVID <dk...@att.com>:

> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Friday, March 10, 2017 8:14 AM
> > 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
> >
> > dont think it has it, building a sample with this bug is hard or is it
> > an option?
>
> I don't understand what you mean by "don't think it has it".
>

sorry, i don't think the log will help


>
> Building a sample app to repeat this is certainly an "option", but I think
> it will take more work than it is likely worth, assuming my assumptions
> about my other options are correct.
>

By experience I'm thinking the opposite. Until we can reproduce we rely on
hypothesis vs facts.


>
> I would like to solve this problem, but from what I can see, I'm not
> actually using any features of TomEE that aren't provided by Tomcat.  I'm
> using JNDI to get DataSources used by Spring JDBC and Environment strings.
> That's about it that's even close to being TomEE-specific.  As far as I
> know, except for moving the DataSources to the Context.xml file, it should
> port cleanly.  Any thoughts on that?
>

That's an option as well


>
> I could also examine using HttpClient to make my REST client requests
> instead of ClientBuilder, but I will only do that if the move to Tomcat
> doesn't work.
>

Take 30mn to try to reproduce it in a small sample with ~ the same stack,
if you fail give up, if you do I'm convinced we'll sort it out on monday.


>
> > 2017-03-10 17:02 GMT+01:00 KARR, DAVID <dk...@att.com>:
> >
> > > > -----Original Message-----
> > > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > > Sent: Friday, March 10, 2017 7:15 AM
> > > > 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
> > > >
> > > > the classloading is not the same for both parts and i need to know
> > > > if it is triggered by cxf or the api. Normally the jaxrs client will
> > > > let the app one be used instead of the server one since you request
> > > > it by your deployment but then question is which part loads the cxf
> > > > classes from server
> > >
> > > Can you tell from the verbose classloading output?  Up to now, I've
> > > only provided excerpts of that output.  I don't think I'd want to send
> > > that entire thing to the list.
> > >
> > > > 2017-03-10 15:45 GMT+01:00 KARR, DAVID <dk...@att.com>:
> > > >
> > > > > > -----Original Message-----
> > > > > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > > > > Sent: Friday, March 10, 2017 12:01 AM
> > > > > > 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
> > > > > >
> > > > > > Can you try dropping jaxrs client api from the webapp (trying to
> > > > > > see if issue is only the api or not)?
> > > > >
> > > > > I don't even have to test this.  This app was working fine when it
> > > > > was just serving a REST api.  I didn't have this problem until I
> > > > > added the ClientBuilder reference.
> > > > >
> > > > > > 2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:
> > > > > >
> > > > > > > > -----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=Os
> > > > > > > > TemS
> > > > > > > > XEn-
> > > > > > > > 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 <dk...@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.ja
> > > > > > > > > va:3
> > > > > > > > > 90)
> > > > > > > > > ------------
> > > > > > > > >
> > > > > > > > > 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?
> > > > > > > > >
> > > > > > >
> > > > >
> > >
>

RE: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Friday, March 10, 2017 8:14 AM
> 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
> 
> dont think it has it, building a sample with this bug is hard or is it
> an option?

I don't understand what you mean by "don't think it has it".

Building a sample app to repeat this is certainly an "option", but I think it will take more work than it is likely worth, assuming my assumptions about my other options are correct.

I would like to solve this problem, but from what I can see, I'm not actually using any features of TomEE that aren't provided by Tomcat.  I'm using JNDI to get DataSources used by Spring JDBC and Environment strings.  That's about it that's even close to being TomEE-specific.  As far as I know, except for moving the DataSources to the Context.xml file, it should port cleanly.  Any thoughts on that?

I could also examine using HttpClient to make my REST client requests instead of ClientBuilder, but I will only do that if the move to Tomcat doesn't work.

> 2017-03-10 17:02 GMT+01:00 KARR, DAVID <dk...@att.com>:
> 
> > > -----Original Message-----
> > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > Sent: Friday, March 10, 2017 7:15 AM
> > > 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
> > >
> > > the classloading is not the same for both parts and i need to know
> > > if it is triggered by cxf or the api. Normally the jaxrs client will
> > > let the app one be used instead of the server one since you request
> > > it by your deployment but then question is which part loads the cxf
> > > classes from server
> >
> > Can you tell from the verbose classloading output?  Up to now, I've
> > only provided excerpts of that output.  I don't think I'd want to send
> > that entire thing to the list.
> >
> > > 2017-03-10 15:45 GMT+01:00 KARR, DAVID <dk...@att.com>:
> > >
> > > > > -----Original Message-----
> > > > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > > > Sent: Friday, March 10, 2017 12:01 AM
> > > > > 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
> > > > >
> > > > > Can you try dropping jaxrs client api from the webapp (trying to
> > > > > see if issue is only the api or not)?
> > > >
> > > > I don't even have to test this.  This app was working fine when it
> > > > was just serving a REST api.  I didn't have this problem until I
> > > > added the ClientBuilder reference.
> > > >
> > > > > 2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:
> > > > >
> > > > > > > -----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=Os
> > > > > > > TemS
> > > > > > > XEn-
> > > > > > > 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 <dk...@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.ja
> > > > > > > > va:3
> > > > > > > > 90)
> > > > > > > > ------------
> > > > > > > >
> > > > > > > > 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?
> > > > > > > >
> > > > > >
> > > >
> >

Re: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by Romain Manni-Bucau <rm...@gmail.com>.
dont think it has it, building a sample with this bug is hard or is it an
option?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-03-10 17:02 GMT+01:00 KARR, DAVID <dk...@att.com>:

> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Friday, March 10, 2017 7:15 AM
> > 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
> >
> > the classloading is not the same for both parts and i need to know if it
> > is triggered by cxf or the api. Normally the jaxrs client will let the
> > app one be used instead of the server one since you request it by your
> > deployment but then question is which part loads the cxf classes from
> > server
>
> Can you tell from the verbose classloading output?  Up to now, I've only
> provided excerpts of that output.  I don't think I'd want to send that
> entire thing to the list.
>
> > 2017-03-10 15:45 GMT+01:00 KARR, DAVID <dk...@att.com>:
> >
> > > > -----Original Message-----
> > > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > > Sent: Friday, March 10, 2017 12:01 AM
> > > > 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
> > > >
> > > > Can you try dropping jaxrs client api from the webapp (trying to see
> > > > if issue is only the api or not)?
> > >
> > > I don't even have to test this.  This app was working fine when it was
> > > just serving a REST api.  I didn't have this problem until I added the
> > > ClientBuilder reference.
> > >
> > > > 2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:
> > > >
> > > > > > -----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=Os
> > > > > > TemS
> > > > > > XEn-
> > > > > > 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 <dk...@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:3
> > > > > > > 90)
> > > > > > > ------------
> > > > > > >
> > > > > > > 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?
> > > > > > >
> > > > >
> > >
>

RE: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Friday, March 10, 2017 7:15 AM
> 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
> 
> the classloading is not the same for both parts and i need to know if it
> is triggered by cxf or the api. Normally the jaxrs client will let the
> app one be used instead of the server one since you request it by your
> deployment but then question is which part loads the cxf classes from
> server

Can you tell from the verbose classloading output?  Up to now, I've only provided excerpts of that output.  I don't think I'd want to send that entire thing to the list.

> 2017-03-10 15:45 GMT+01:00 KARR, DAVID <dk...@att.com>:
> 
> > > -----Original Message-----
> > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > Sent: Friday, March 10, 2017 12:01 AM
> > > 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
> > >
> > > Can you try dropping jaxrs client api from the webapp (trying to see
> > > if issue is only the api or not)?
> >
> > I don't even have to test this.  This app was working fine when it was
> > just serving a REST api.  I didn't have this problem until I added the
> > ClientBuilder reference.
> >
> > > 2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:
> > >
> > > > > -----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=Os
> > > > > TemS
> > > > > XEn-
> > > > > 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 <dk...@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:3
> > > > > > 90)
> > > > > > ------------
> > > > > >
> > > > > > 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?
> > > > > >
> > > >
> >

Re: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by Romain Manni-Bucau <rm...@gmail.com>.
the classloading is not the same for both parts and i need to know if it is
triggered by cxf or the api. Normally the jaxrs client will let the app one
be used instead of the server one since you request it by your deployment
but then question is which part loads the cxf classes from server


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-03-10 15:45 GMT+01:00 KARR, DAVID <dk...@att.com>:

> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Friday, March 10, 2017 12:01 AM
> > 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
> >
> > Can you try dropping jaxrs client api from the webapp (trying to see if
> > issue is only the api or not)?
>
> I don't even have to test this.  This app was working fine when it was
> just serving a REST api.  I didn't have this problem until I added the
> ClientBuilder reference.
>
> > 2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:
> >
> > > > -----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=OsTemS
> > > > XEn-
> > > > 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 <dk...@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?
> > > > >
> > >
>

RE: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Friday, March 10, 2017 12:01 AM
> 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
> 
> Can you try dropping jaxrs client api from the webapp (trying to see if
> issue is only the api or not)?

I don't even have to test this.  This app was working fine when it was just serving a REST api.  I didn't have this problem until I added the ClientBuilder reference.

> 2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:
> 
> > > -----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=OsTemS
> > > XEn-
> > > 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 <dk...@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?
> > > >
> >

Re: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Can you try dropping jaxrs client api from the webapp (trying to see if
issue is only the api or not)?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-03-10 2:08 GMT+01:00 KARR, DAVID <dk...@att.com>:

> > -----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 <dk...@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?
> > >
>

RE: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by "KARR, DAVID" <dk...@att.com>.
> -----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 <dk...@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?
> >

Re: Setting "openejb.classloader.forced-load" to include "org.apache.cxf" is still loading some classes from tomee lib dir

Posted by Romain Manni-Bucau <rm...@gmail.com>.
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.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-03-10 1:21 GMT+01:00 KARR, DAVID <dk...@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?
>