I have a strange problem.
-
Using wsimport I generated als JAX-WS Code from a WSDL (in a dedicated eclipse java project). This works fine in JDK6 without any external dependencies (running in Eclipse)
-
I have second project where I once used Apache CXF. If I copy the Code described in 1.) into this project, suddenly not the JDK executes the JAX-WS stuff (files I generated), but rather Apache CXF.
How can I prevent Apache CXF “running” the JAX-WS stuff. (Problem is, CXF Fails to run the code…). I also completely do not understand how Apache CXF discovers these classes. I did not register them anywere?
Thank you very much!
Markus
Apache CXF (
cxf-rt-frontend-jaxws-*.jarto be precise) registers itself as a JAX-WS provider in the JVM. Inside the aforementioned JAR there is a file named:/META-INF/services/javax.xml.ws.spi.Providerwith the following contents:If you now look at
javax.xml.ws.spi.FactoryFinder#findmethod you will discover that JDK searches the CLASSPATH for the presence ofjavax.xml.ws.spi.Providerfile and falls back to default Sun implementation if not available. So you have two options to force fallback:either remove
cxf-rt-frontend-jaxws-*.jarfrom CLASSPATHor override
javax.xml.ws.spi.Providerfile provided by CXF to point to fallback locationThe second option is actually a bit easier. Simply create:
file (assuming you are using Maven) with the following contents:
That’s it, tested with
javax.xml.ws.Endpoint#publish.