> -----Original Message-----
> From: KARR, DAVID
> Sent: Thursday, March 09, 2017 2:50 PM
> To: [email protected]
> 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: [email protected]
> > 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.

Reply via email to