You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With OpenJDK 11.0.2 and JAX-WS 2.3.2, calling javax.xml.ws.Service.getPort(QName, Class<T>) (e.g. from a service implementation) leads to a java.lang.NoSuchMethodException (after fixing issue #54 by the workaround mentioned there). This exception is thrown in com.sun.xml.ws.model.Injector, as the method sun.misc.Unsafe.defineClass(...) no longer exists in Java 11 after being deprecated in Java 9 (see also https://bugs.openjdk.java.net/browse/JDK-8193033):
java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.Injector.<clinit>(Injector.java:75)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.WrapperBeanGenerator.createRequestWrapperBean(WrapperBeanGenerator.java:265)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.RuntimeModeler.getRequestWrapperClass(RuntimeModeler.java:345)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:771)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:701)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:461)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:290)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:70)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:44)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:28)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:90)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:852)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:869)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:832)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:421)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:390)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:372)
at java.xml.ws/javax.xml.ws.Service.getPort(Service.java:139)
[...]
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)
at java.base/java.lang.Class.getMethod(Class.java:2109)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.Injector$3.run(Injector.java:79)
at com.sun.xml.ws.jaxws/com.sun.xml.ws.model.Injector$3.run(Injector.java:75)
... 60 more
A possible workaround is to start your application with the --add-opens java.base/java.lang=com.sun.xml.ws.jaxws flag. In this case, the defineClass(...) method of java.lang.ClassLoader is used instead than the one from sun.misc.Unsafe.
However, I would expect the JAX-WS library to work without any additional --add-opens statements.
The text was updated successfully, but these errors were encountered:
Well, I am afraid that is not that easy. Opening java.lang to com.sun.xml.ws.jaxws would only be possible in java.base. Replacing the method sun.misc.Unsafe.defineClass(...) with another alternative is not that straight-forward either, from what I've read: While there is a replacement method, classes can no longer be injected into packages that did not intend to give such access. As I have no idea how this Injector is actually used, I am not able to provide a usable PR here.
With OpenJDK 11.0.2 and JAX-WS 2.3.2, calling
javax.xml.ws.Service.getPort(QName, Class<T>)
(e.g. from a service implementation) leads to ajava.lang.NoSuchMethodException
(after fixing issue #54 by the workaround mentioned there). This exception is thrown in com.sun.xml.ws.model.Injector, as the methodsun.misc.Unsafe.defineClass(...)
no longer exists in Java 11 after being deprecated in Java 9 (see also https://bugs.openjdk.java.net/browse/JDK-8193033):A possible workaround is to start your application with the
--add-opens java.base/java.lang=com.sun.xml.ws.jaxws
flag. In this case, thedefineClass(...)
method ofjava.lang.ClassLoader
is used instead than the one fromsun.misc.Unsafe
.However, I would expect the JAX-WS library to work without any additional
--add-opens
statements.The text was updated successfully, but these errors were encountered: