eclipse-ee4j / metro-jax-ws

metro-jax-ws
https://eclipse-ee4j.github.io/metro-jax-ws/
BSD 3-Clause "New" or "Revised" License
72 stars 40 forks source link

ClientContainer NullPointerException under Java 8 and embedded JVM #566

Open Tomas-Kraus opened 2 years ago

Tomas-Kraus commented 2 years ago

Something has changed in the classloading between Java 6 and Java 8 which leads to the following stack trace when:

  1. attempting to use the proxy method of initializing the connection to a JAX-WS web service, which dynamically creates the stub on the client side using the WSDL hosted on the server side, and
  2. running Java 8 as an embedded JVM from within a Windows process.

The code in ClientContainer.java does not seem to handle the scenario with both of its attempts to resolve a classloader result in the bootstrap classloader being returned. Thus the result is a NullPointerException on line 45.

The stack trace is as follows:

java.lang.NullPointerException
    at com.sun.xml.internal.ws.client.ClientContainer$1.getResource(Unknown Source)
    at com.sun.xml.internal.ws.assembler.MetroConfigLoader.locateResource(Unknown Source)
    at com.sun.xml.internal.ws.assembler.MetroConfigLoader.locateResource(Unknown Source)
    at com.sun.xml.internal.ws.assembler.MetroConfigLoader.init(Unknown Source)
    at com.sun.xml.internal.ws.assembler.MetroConfigLoader.<init>(Unknown Source)
    at com.sun.xml.internal.ws.assembler.TubelineAssemblyController.getTubeCreators(Unknown Source)
    at com.sun.xml.internal.ws.assembler.MetroTubelineAssembler.createClient(Unknown Source)
    at com.sun.xml.internal.ws.client.Stub.createPipeline(Unknown Source)
    at com.sun.xml.internal.ws.client.Stub.<init>(Unknown Source)
    at com.sun.xml.internal.ws.client.Stub.<init>(Unknown Source)
    at com.sun.xml.internal.ws.client.Stub.<init>(Unknown Source)
    at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getStubHandler(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at javax.xml.ws.Service.getPort(Unknown Source)
    at myclient.stub.MyService.<init>(MyService.java:38)

This problem is documented at StackOverflow: http://stackoverflow.com/questions/32720458/jaxws-webservice-client-for-java-6-not-working-in-java-8

A workaround for the problem is also provided at http://stackoverflow.com/questions/32720458/jaxws-webservice-client-for-java-6-not-working-in-java-8/33305743#33305743

Affected Versions

[2.2.8, 2.2.10]

Source: https://github.com/javaee/metro-jax-ws/issues/1178 Author: glassfishrobot