I am not entirely sure this is an error in Equinox, but there is no indication this might be an platform problem. I am trying to start a JAX-WS web service in an Eclipse Neon bundle, but I get an exception:
java.lang.Error: Failed to create new instance of com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory$1
at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:63)
at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.get(ContextClassloaderLocal.java:47)
at com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory.get(XMLStreamWriterFactory.java:175)
at com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory.create(XMLStreamWriterFactory.java:199)
at com.sun.xml.internal.ws.server.SDDocumentImpl.writeTo(SDDocumentImpl.java:271)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.publishWSDL(HttpAdapter.java:769)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handleGet(HttpAdapter.java:278)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:251)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:98)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.access$000(WSHttpHandler.java:47)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler$HttpHandlerRunnable.run(WSHttpHandler.java:122)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.NullPointerException
at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:354)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:352)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
at javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:130)
at com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory$1.initialValue(XMLStreamWriterFactory.java:79)
at com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory$1.initialValue(XMLStreamWriterFactory.java:66)
at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:61)
... 15 more
The same code works fine in Mars and Luna.
I wrote a minimal example as a plugin test. Here is the service interface;
package jaxws.example;
import javax.jws.WebService;
@WebService(serviceName = "Foo", targetNamespace = "http://bar")
public interface TestService {
String hello(String name);
}
And here the test class with service implementation:
package jaxws.example;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.concurrent.ForkJoinPool;
import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.ws.Endpoint;
import javax.xml.ws.Service;
public class Test {
@WebService(endpointInterface = "jaxws.example.TestService")
public static class TestServiceImpl implements TestService {
@Override
public String hello(final String name) {
return "Hello " + name;
}
}
@org.junit.Test
public void test() throws MalformedURLException {
final ForkJoinPool pool = ForkJoinPool.commonPool();
final String address = "http://localhost:8888/service";
final WebService annotation = TestService.class.getAnnotation(WebService.class);
final String namespaceURI = annotation.serviceName();
final String localPart = annotation.targetNamespace();
final QName serviceName = new QName(namespaceURI, localPart);
final TestServiceImpl tsi = new TestServiceImpl();
final Endpoint endpoint = Endpoint.create(tsi);
final HashMap<String, Object> props = new HashMap<String, Object>();
props.put(Endpoint.WSDL_SERVICE, serviceName);
endpoint.setProperties(props);
endpoint.setExecutor(pool);
endpoint.publish(address);
final URL wsdlURL = new URL(address + "?wsdl");
final Service s = Service.create(wsdlURL, serviceName);
final TestService port = s.getPort(TestService.class);
System.out.println(port.hello("World"));
}
}
If something changed and some additional configuration is needed to make this code work, it would be good to mention this in the migration guide. If this is a bug, it would be great if this would be resolved until the Neon release.