The problem occurs if an only if CXF jars are placed under 
$CATALINA_HOME/endorsed.This was a mistake on my part as I w under the 
impression that $CATALINA_HOME/lib should remain pristine. Turns out the 
endorsed directory is used to override classes delivered by the JDK itself. 
Placing CXF libraries under $CATALINA_HOME/lib (for all applications) or at 
WEB-INF/lib (per application) makes it work.
The patch was simple. Check is getClass().getClassLoader() returned null, if so 
then use the context ClassLoader itself.
Cheers,AndresĀ -------------------------------------------Java Champion, Groovy 
Enthusiasthttp://jroller.com/aalmirayhttp://www.linkedin.com/in/aalmiray--What 
goes up, must come down. Ask any system administrator.There are 10 types of 
people in the world: Those who understand binary, and those who don't.To 
understand recursion, we must first understand recursion. 

    On Tuesday, February 21, 2017 4:16 PM, Sergey Beryozkin 
<[email protected]> wrote:
 

 I haven't seen any issues in running CXF in Tomcat 8, we've had it added 
to the actual war, looks like you put CXF into the common lib folder ? 
If yes, how did you patch it for the given resource be loaded if it is 
'null', did you delegate to the system loader ?

Thanks, Sergey
On 20/02/17 14:46, Andres Almiray wrote:
> Hello everyone,
>
> I'm trying to run a simple webservice on Tomcat 8.5.11 with CXF 3.1.10 and 
> have encountered two separate NPEs when CXF attempts to resolve a BusFactory.
>
> The first one appears at 
> https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/BusFactory.java#L397
>  apparently cls.getClassLoader() returns null.
>
> The second one is at 
> https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java#L154
>  where getClass().getClassLoader() also returns null.
>
> More details at 
> http://stackoverflow.com/questions/42341942/tomcat8-org-apache-cxf-busfactory-getbusfactoryclass-failed-to-determine-busfact
>
> I've build a local version of cxf-core with these two spots patched to handle 
> the NPE and forward the loading to a non-null ClassLoader, such as the 
> ContextClassLoader.
>
> My question is, am I missing setup on the Tomcat side so that the intended 
> ClassLoader is not null?
>
> Should CXF have additional checks for potential nulls in these two (possibly 
> other) cases?
>
> TIA
> Andres
>



   

Reply via email to