Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK 11; JAX-WS; Provider com.sun.xml.internal.ws.spi.ProviderImpl not found

I Need to access legacy SOAP webservices in JDK 11. But I am suffering "ProviderImpl not found."

The JDK 11 implementation is: zulu11.2.3-jdk11.0.1-win_x64.

In my build.gradle, I have the following dependency:

compile group: 'com.sun.xml.ws', name: 'jaxws-rt', version: '2.3.1', ext: 'pom', { force = true }

My WAR file's WEB-INF/lib contains enter image description here

I am seeing:

javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found
    at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:61) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:112) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.Provider.provider(Provider.java:96) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.Service.<init>(Service.java:112) ~[jaxws-api-2.3.1.jar:na]

Following https://github.com/javaee/metro-jax-ws/issues/1247 I have tried setting:

-Djavax.xml.ws.spi.Provider=com.sun.xml.ws.spi.ProviderImpl

But I still get:

javax.xml.ws.WebServiceException: Provider com.sun.xml.ws.spi.ProviderImpl not found
    at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:61) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.FactoryFinder.fromSystemProperty(FactoryFinder.java:122) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:99) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.Provider.provider(Provider.java:96) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.Service.<init>(Service.java:112) ~[jaxws-api-2.3.1.jar:na]
    ...
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.spi.ProviderImpl
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:90) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:123) ~[jaxws-api-2.3.1.jar:na]
    at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:101) ~[jaxws-api-2.3.1.jar:na]
    ... 22 common frames omitted

I have verified that com.sun.xml.ws.spi.ProviderImpl IS available:

enter image description here

Is there a known working example of this combination available "out there"?

Thoughts/suggestions gratefully accepted.

like image 587
Bob Brown Avatar asked Jan 04 '19 02:01

Bob Brown


2 Answers

I got the exact same error calling soap-webservices in java11. I finally got it to work in my testproject by adding the following dependency to pom.xml

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>rt</artifactId>
    <version>2.3.1</version>
</dependency>

As my production environment is not converted to maven yet, I then found out that I needed these jar-files on the classpath:

jaxb-runtime-2.3.1.jar
jaxws-api-2.3.1.jar
javax.xml.soap-api-1.4.0.jar
rt-2.3.1.jar
streambuffer-1.5.3.jar
policy-2.7.5.jar
stax-ex-1.8.jar
javax.jws-api-1.1.jar
saaj-impl-1.5.0.jar
gmbal-api-only-3.1.0-b001.jar 
like image 153
runholen Avatar answered Nov 04 '22 05:11

runholen


I worked this out with this artifact:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.3.5</version>
</dependency>

or gradle

implementation 'com.sun.xml.ws:jaxws-rt:2.3.5'

You can check other versions and which artifacts depends this one here: https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt/2.3.5 .

like image 39
ZooMMX Avatar answered Nov 04 '22 03:11

ZooMMX