WAS8自帶了axis2的web service實現,但有一個項目war包中自帶cxf,在實際部署中也但願使用cxf,java
卻發現用的是axis2的jar包,所以,須要將spi指成cxf,查了一下google,找到一些相關的辦法:web
Apache CXF (cxf-rt-frontend-jaxws-*.jar
to 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.Provider
with the following contents:apache
org.apache.cxf.jaxws.spi.ProviderImpl
If you now look at javax.xml.ws.spi.FactoryFinder#find
method you will discover that JDK searches the CLASSPATH for the presence of javax.xml.ws.spi.Provider
file and falls back to default Sun implementation if not available. So you have two options to force fallback:frontend
either remove cxf-rt-frontend-jaxws-*.jar
from CLASSPATHide
or override javax.xml.ws.spi.Provider
file provided by CXF to point to fallback locationgoogle
The second option is actually a bit easier. Simply create:code
/src/main/resources/META-INF/services/javax.xml.ws.spi.Provider
file (assuming you are using Maven) with the following contents:xml
org.apache.cxf.jaxws.spi.ProviderImpl
That's it, tested with javax.xml.ws.Endpoint#publish
ci