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?