I'm trying to override an Apache CXF implementation of JAX-WS web services. As per JAX-WS = When Apache CXF is installed it "steals" default JDK JAX-WS implementation, how to solve?, I'm trying to create/override the Provider implementation.
With that configuration, we have the javax.xml.ws.spi.Provider in, at least, two jars: /tomcat/lib/cxf-rt-frontend-jaxws-*.jar and in our own jar /tomcat/webapps/appX/WEB-INF/META-INF/services).
With the default behavior of loading webapp resources first, we were expecting to fetch first our own jar. But it isn't.
Doing some debug, it seems that Tomcat's class loader's method of getResources("resource-name") is returning an Enumeration where the first element if the on from /tomcat/lib. Since the WS Provider is using the first element, it's still using the original CXF implementation.
The default class loader was ParallelWebappClassLoader. We've switched to the WebappClassLoader, but it kept the same problem.
We then created our own class loader extending the WebappClassLoader, only overriding the getResources method (to remove the /tomcat/lib/cxf-rt-frontend-jaxws-*.jar jax-ws provider implementation), and it's now working. But this is just a solution to make it work, it really shouldn't be necessary to do this.
So, any idea on how the ClassLoader.getResources(String name) should return first the webapp entries?
It should already be the default value, but the searchExternalFirst="false" didn't to any magic (nor with a "true" value)