-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java 11 - Unable to make field private static final jdk.internal.misc.Unsafe jdk.internal.misc.Unsafe.theUnsafe accessible: module java.base does not "opens jdk.internal.misc" #225
Comments
I created the example in https://github.com/vogellacompany/eclipsercp-javaws-java11/tree/maven-example simply import the Maven project "com.example.maven" and run in on Java 16. Here is my build information: Eclipse SDK |
JDK - as of latest JDK 17 - does not provide clean API to make the functionality required by xml ws spec working properly "on the fly". The only way to get around this at runtime is to run wsgen to generate required wrapper beans during the build. Note that this only moves the error from runtime to build time. |
alternative way to get around this would be to use customizations. Relevant part in the spec is section 3.7 which among other things says:
(JDK currently does not provide an API to define new package in running JVM; it only allows dynamically creating classes in existing packages.) |
Thanks @lukasj for the answer, could you point me to the documentation how to make xml ws work on Java 17? From your answer I understand that I have two alternatives but don't know how to apply them. |
to create wrapper beans during the build, one can use sth like: <plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>create-wrapperbeans</id>
<goals>
<goal>wsgen</goal>
</goals>
<configuration>
<sei>org.acme.SampleWS</sei>
<genWsdl>true</genWsdl>
</configuration>
</execution>
</executions>
</plugin> (plugin doc is at https://eclipse-ee4j.github.io/metro-jax-ws/jaxws-maven-plugin/wsgen-mojo.html) |
Thanks @lukasj Shall I leave this ticket open or close it? |
keep it open for now |
Hey folks, we have a similar problem. We do not use maven based on the customer's specifications. We have to use the standalone version from metro (metro-standalone-3.0.1, Java 16, Eclipse 2021-03 (4.19.0) and Tomcat 10.0.6). The container only starts when we set the SOAPBinding to RPC. Otherwise the following exception occurs. thx for support
|
Similar to #60 but on Java 16 creation of a webservice crashes with: Exception in thread "main" java.lang.ExceptionInInitializerError
at com.sun.xml.ws.model.WrapperBeanGenerator.createRequestWrapperBean(WrapperBeanGenerator.java:276)
at com.sun.xml.ws.model.RuntimeModeler.getRequestWrapperClass(RuntimeModeler.java:345)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:771)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:701)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:461)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:290)
at com.sun.xml.ws.db.DatabindingImpl.(DatabindingImpl.java:70)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:44)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:28)
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:90)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:491)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:270)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:134)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:578)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at com.sun.xml.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:304)
at com.sun.xml.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:217)
at com.sun.xml.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:111)
at jakarta.xml.ws.Endpoint.publish(Endpoint.java:224)
at com.example.maven.WebServiceExample.main(WebServiceExample.java:21)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private static final jdk.internal.misc.Unsafe jdk.internal.misc.Unsafe.theUnsafe accessible: module java.base does not "opens jdk.internal.misc" to unnamed module @6bf256fa
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
at com.sun.xml.ws.model.Injector$2.run(Injector.java:71)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at com.sun.xml.ws.model.Injector.(Injector.java:66)
... 20 more
Example:
Maven dependency:
The text was updated successfully, but these errors were encountered: