You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID" <dk...@att.com> on 2017/03/09 22:47:10 UTC
Getting "ClassCastException: class
org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
(TomEE)
I'm currently using CXF 3.1.9 in an app built with Gradle, and running in Tomcat (TomEE).
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.
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)
------------------
I noticed that some other people have gotten a similar error, but I don't see a solution that makes sense for my situation.
RE: Getting "ClassCastException: class
org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
(TomEE)
Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Friday, March 10, 2017 3:19 AM
> To: users@cxf.apache.org
> Subject: Re: Getting "ClassCastException: class
> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
> (TomEE)
>
> I have this response from Romain copied and stored on my local disk:
>
> "in tomee one easy way is to use
> openejb.classloader.forced-load=org.springframework,org.apache.cxf
> <rmannibucau> (in conf/system.properties)"
>
> I don't recall now why I copied it :-) but may be it can be relevant.
> Ask Romain, he will help fast
Yes, it's relevant, but I already had that. I'm talking with Romain about it.
> On 10/03/17 00:26, KARR, DAVID wrote:
> >> -----Original Message-----
> >> From: KARR, DAVID
> >> Sent: Thursday, March 09, 2017 2:50 PM
> >> To: users@cxf.apache.org
> >> Subject: RE: Getting "ClassCastException: class
> >> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in
> >> Tomcat
> >> (TomEE)
> >>
> >>> -----Original Message-----
> >>> From: KARR, DAVID
> >>> Sent: Thursday, March 09, 2017 2:47 PM
> >>> To: users@cxf.apache.org
> >>> Subject: Getting "ClassCastException: class
> >>> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in
> >>> Tomcat
> >>> (TomEE)
> >>>
> >>> I'm currently using CXF 3.1.9 in an app built with Gradle, and
> >>> running in Tomcat (TomEE).
> >>
> >> This might be relevant. I'm using Spring v4.3.5.RELEASE.
> >>
> >>> 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.
> >>>
> >>> 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)
> >>> ------------------
> >>>
> >>> I noticed that some other people have gotten a similar error, but I
> >>> don't see a solution that makes sense for my situation.
> >
> > It appears this is a TomEE problem. It's loading CXF classes both
> from my webapp's WEB-INF/lib and the container's "lib" directory, even
> though I have supposedly correct settings to make TomEE only load CXF
> jars from the webapp ("openejb.classloader.forced-
> load=org.springframework,org.apache.cxf" in the "system.properties"
> file). I still don't have a complete answer, however.
> >
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__coders.talend.com_&d=DwIC-g&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-
> xy2uk0vYF_EA&m=rhEe1kR7tdYmPF_ErB3ncZj9S_mAq1ewSonklssV8nY&s=npIbW4qLI1R
> AdVxtP7Z2lNUj3D6ofZcUX9aN4tAmYKQ&e=
Re: Getting "ClassCastException: class
org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
(TomEE)
Posted by Sergey Beryozkin <sb...@gmail.com>.
I have this response from Romain copied and stored on my local disk:
"in tomee one easy way is to use
openejb.classloader.forced-load=org.springframework,org.apache.cxf
<rmannibucau> (in conf/system.properties)"
I don't recall now why I copied it :-) but may be it can be relevant.
Ask Romain, he will help fast
Cheers, Sergey
On 10/03/17 00:26, KARR, DAVID wrote:
>> -----Original Message-----
>> From: KARR, DAVID
>> Sent: Thursday, March 09, 2017 2:50 PM
>> To: users@cxf.apache.org
>> Subject: RE: Getting "ClassCastException: class
>> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
>> (TomEE)
>>
>>> -----Original Message-----
>>> From: KARR, DAVID
>>> Sent: Thursday, March 09, 2017 2:47 PM
>>> To: users@cxf.apache.org
>>> Subject: Getting "ClassCastException: class
>>> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in
>>> Tomcat
>>> (TomEE)
>>>
>>> I'm currently using CXF 3.1.9 in an app built with Gradle, and running
>>> in Tomcat (TomEE).
>>
>> This might be relevant. I'm using Spring v4.3.5.RELEASE.
>>
>>> 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.
>>>
>>> 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)
>>> ------------------
>>>
>>> I noticed that some other people have gotten a similar error, but I
>>> don't see a solution that makes sense for my situation.
>
> It appears this is a TomEE problem. It's loading CXF classes both from my webapp's WEB-INF/lib and the container's "lib" directory, even though I have supposedly correct settings to make TomEE only load CXF jars from the webapp ("openejb.classloader.forced-load=org.springframework,org.apache.cxf" in the "system.properties" file). I still don't have a complete answer, however.
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
RE: Getting "ClassCastException: class
org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
(TomEE)
Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID
> Sent: Thursday, March 09, 2017 2:50 PM
> To: users@cxf.apache.org
> Subject: RE: Getting "ClassCastException: class
> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
> (TomEE)
>
> > -----Original Message-----
> > From: KARR, DAVID
> > Sent: Thursday, March 09, 2017 2:47 PM
> > To: users@cxf.apache.org
> > Subject: Getting "ClassCastException: class
> > org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in
> > Tomcat
> > (TomEE)
> >
> > I'm currently using CXF 3.1.9 in an app built with Gradle, and running
> > in Tomcat (TomEE).
>
> This might be relevant. I'm using Spring v4.3.5.RELEASE.
>
> > 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.
> >
> > 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)
> > ------------------
> >
> > I noticed that some other people have gotten a similar error, but I
> > don't see a solution that makes sense for my situation.
It appears this is a TomEE problem. It's loading CXF classes both from my webapp's WEB-INF/lib and the container's "lib" directory, even though I have supposedly correct settings to make TomEE only load CXF jars from the webapp ("openejb.classloader.forced-load=org.springframework,org.apache.cxf" in the "system.properties" file). I still don't have a complete answer, however.
RE: Getting "ClassCastException: class
org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
(TomEE)
Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID
> Sent: Thursday, March 09, 2017 2:47 PM
> To: users@cxf.apache.org
> Subject: Getting "ClassCastException: class
> org.apache.cxf.bus.spring.SpringBusFactory" for CXF/Spring app in Tomcat
> (TomEE)
>
> I'm currently using CXF 3.1.9 in an app built with Gradle, and running
> in Tomcat (TomEE).
This might be relevant. I'm using Spring v4.3.5.RELEASE.
> 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.
>
> 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)
> ------------------
>
> I noticed that some other people have gotten a similar error, but I
> don't see a solution that makes sense for my situation.