Java webservices (JAX-WS) with Ignition 7.9.10 and Java 9

I have a module which use java webservices (JAX-WS) in Client and Gateway scope.
Works fine with Ignition 7.9.9 / Java 8 (Client/Gateway scope)
This module don’t have any external dependency for webservices.

I upgraded to Ignition 7.9.10-beta / Java 9 on the Gateway (I use the JRE 9 provided by the client launcher)
Does the gateway Ignition 7.9.10 support Java 9 ???

From Java 9, java webservices (JAX-WS) have been remove from JRE
http://openjdk.java.net/jeps/320
and we need to add external dependency to run theses webservices.

I’ve tried to add various dependencies to replace those that are not packaged with JRE 9.
Following this :

But when my module create the webservice I always have the following error (Gateway Scope) :

javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found

if I add this in Ignition.conf, it solve the issue for the gateway scope,

wrapper.java.additional.7=--add-modules=java.se.ee

but not in the client scope…is it possible to do the same whith args for the clientlauncher.exe ???
…Yes, seem just putting the parameter at the end do the job…

clientlauncher.exe gateway.addr=127.0.0.1:8088:8043 retries=3 scope=C project=MODULES windowmode=fullscreen --add-modules=java.se.ee

I’m looking too for a better solution working too for Java 11 / Ignition 8.0…

With Ignition 8 - Java 11,

the same module give the same error, despide of the dependecies for JAX-WS and more :

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)

at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58)

at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103)

at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:112)

at javax.xml.ws.spi.Provider.provider(Provider.java:96)

at javax.xml.ws.Service.(Service.java:112)

at javax.xml.ws.Service.create(Service.java:765)

at com.bouyguesenergiesservices.ignition.common.videoviewer.onvif.OnvifDeviceAction.actionCreateDevicePort(OnvifDeviceAction.java:174)

at com.bouyguesenergiesservices.ignition.common.videoviewer.onvif.OnvifDeviceAction$1.run(OnvifDeviceAction.java:84)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)

at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:503)

at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:90)

at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:123)

at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:101)

... 7 common frames omitted

dependency added for all scopes in the module :

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.4.0-b180830.0359</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.4.0-b180830.0438</version>
        </dependency>

        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-ri</artifactId>
            <version>2.3.1</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>

        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.1</version>
            <type>pom</type>
        </dependency>

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


        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.1</version>
        </dependency>

Is there anythings else in Ignition class loader process to explain this error ???

Wild guess here, but:

Try adding a src/main/resources/META-INF/services/javax.xml.ws.spi.Provider file containing the value com.sun.xml.ws.spi.ProviderImpl (note the lack of internal in that package).

Make sure this file ends up in the META-INF folder in the JAR of your built module.

Thanks @Kevin.Herron , I added the file in the common jar loaded for CDG scope. I think this file is at the right place in the jar : when I unzip it in the modl, can you confirm it’s ok or not ???

I have still the same error. Did I miss something ???

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)

at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58)

at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103)

at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:112)

at javax.xml.ws.spi.Provider.provider(Provider.java:96)

at javax.xml.ws.Service.(Service.java:112)

at javax.xml.ws.Service.create(Service.java:765)

at com.bouyguesenergiesservices.ignition.common.videoviewer.onvif.OnvifMediaAction.actionCreateMediaPort(OnvifMediaAction.java:222)

at com.bouyguesenergiesservices.ignition.common.videoviewer.onvif.OnvifMediaAction$1.run(OnvifMediaAction.java:81)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)

at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:503)

at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:90)

at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:123)

at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:101)

Looks right to me... I don't know if you missed anything, it was just a guess :-/

If I have still com.sun.xml.internal.ws.spi.ProviderImpl in my error og, I suppose that the file had not be used ?

I don’t think you need it, it looks like jaxws-rt jar already has it.

There’s probably some issue with ClassLoaders here. I’d try running this in IDE in debug mode and breakpointing in javax.xml.ws.spi.FactoryFinder#find(String, String)

Maybe the context ClassLoader needs to be set or unset when you try to instantiate a service.

When I debug, on the line with eception, I obtain this :
I don’t find javax.xml.ws.spi.FactoryFinder#find(String, String) ???

It’s part of the jaxws-api jar, do you have that in your module?

Sorry, when I step into line with the exception, I found the classLoader


1 Like

Try setting the context ClassLoader to be your module’s ClassLoader or null?

Thread.currentThread().setContextClassLoader(MyModuleHook.class.getClassLoader());

Set that before you try to make a web service or whatever leads down that code path.

I've tried it in the GatewayHook::setup but I've still the issue :tired_face:

    @Override
    public void setup(GatewayContext gatewayContext) {
        logger.info("setup()");
        this.context = context;
        Thread.currentThread().setContextClassLoader(GatewayHook.class.getClassLoader());
        
    }

It needs to happen immediately before the call to create a WebService otherwise you might be setting the context ClassLoader on the wrong thread or it could get reset by some other code.

There is now an error with ignition lib/core/gateway/axis-saaj-1.4.jar

Error Attached.
old_SAAJ.txt (6.1 KB)

I will PM a link to DL my module source code if you could have a look at the at the POM.
I probably attached to many dependencies for WS ?

Try deleting axis-saaj-1.4.jar from the lib/core/gateway folder of your Ignition install.

No more Error on startup !!! :grinning:
but the designer don’t start anymore :scream:

Not sure it was linked…
Designer don’t start if I put axis-saaj-1.4.jar in lib/core/gateway and restart the GW

Enable the Java console and launch again, get the logs