环境:
- Jboss 7.2
- Java 11
- Maven 3.6.3
从迁移
- Jboss 5.2
- Java 7
我正在从JBoss 5.2迁移到JBoss 7.2,我在WS-soap中遇到了一个错误,它找不到ProviderImpl,因为它来自旧的实现com.sun.xml.internal.WS.spi.ProviderImpl。我应该删除文件resources/META-INF/services/javax.xml.ws.spi.Provider以获得JBoss 7.2上的默认实现吗?还是改变它?
使用Web
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "EmpleoWeb", targetNamespace = "http://namespace.softwareag.com/entirex/xml/mapping", wsdlLocation = "http://intra.web.es/WebServicesEntireX/services/EmpleoWeb?wsdl")
public class EmpleoWeb extends Service {
private final static URL EMPLEOWEB_WSDL_LOCATION;
private final static WebServiceException EMPLEOWEB_EXCEPTION;
private final static QName EMPLEOWEB_QNAME = new QName("http://namespace.softwareag.com/entirex/xml/mapping", "EmpleoWeb");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("http://intra.web.es/WebServicesEntireX/services/EmpleoWeb?wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
EMPLEOWEB_WSDL_LOCATION = url;
EMPLEOWEB_EXCEPTION = e;
}
public EmpleoWeb() {
super(__getWsdlLocation(), EMPLEOWEB_QNAME);
}
public EmpleoWeb(WebServiceFeature... features) {
super(__getWsdlLocation(), EMPLEOWEB_QNAME, features);
}
public EmpleoWeb(URL wsdlLocation) {
super(wsdlLocation, EMPLEOWEB_QNAME);//ERROR
}
...
resources/META-INF/services/javax.xml.ws.spi.Provider
com.sun.xml.internal.ws.spi.ProviderImpl
错误日志
导致原因:java.util.ServiceConfiguration错误:javax.xml.ws.spi.Provider:Provider com.sun.xml.internal.ws.spi.ProviderImpl未找到
...
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.weld.core@3.0.5.Final-redhat-00001//org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:83)
... 146 more
Caused by: javax.xml.ws.WebServiceException: Error while searching for service [javax.xml.ws.spi.Provider]
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:65)
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:62)
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.spi.ServiceLoaderUtil.firstByServiceLoader(ServiceLoaderUtil.java:74)
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:93)
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.spi.Provider.provider(Provider.java:96)
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.Service.<init>(Service.java:112)
at deployment.accfor2.ear.accfor-ejb.jar//es.caib.accfor.business.io.ws.silcoi.entity.wsdl.empleo.EmpleoWeb.<init>(EmpleoWeb.java:50)
at deployment.accfor2.ear.accfor-ejb.jar//es.caib.accfor.business.io.ws.silcoi.boundary.SilcoiClient.setWsdlEmpleoWeb(SilcoiClient.java:339)
at deployment.accfor2.ear.accfor-ejb.jar//es.caib.accfor.business.io.ws.silcoi.boundary.SilcoiClient.<init>(SilcoiClient.java:45)
at deployment.accfor2.ear.accfor-back.war//es.caib.accfor.presentation.back.io.ws.silcoi.SilcoiBean.init(SilcoiBean.java:43)
... 151 more
Caused by: java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1211)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1220)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
at javax.xml.ws.api@1.0.0.Final-redhat-1//javax.xml.ws.spi.ServiceLoaderUtil.firstByServiceLoader(ServiceLoaderUtil.java:67)
... 158 more
遵循Oracle JDK迁移指南和JEP 320:删除Java EE和CORBA模块
我根据maven项目添加了以下内容以保持运行。
<!-- JAXWS for Java 11 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.0</version>
</dependency>
我不得不下载jaxws-rt-2.3.0.jar并添加到/lib文件夹中。
在我的案例中,这是由于从java 11中删除了默认实现:在迁移到JBoss7.2 时找不到javax.xml.ws.spi.ProviderImpl