eclipse-ee4j / eclipse-ee4j/jersey

Jersey 2.34 with HTTPS and PATCH method fails with error when run with JDK 16

Open
#4,825 27 comments 3 reactions 0 assignees View on GitHub
Connector
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

Configuration:
- JAX-RS client API
- Jersey 2.34 as the JAX-RS provider
- REST service utilizing HTTPS and the PATCH method
- JDK 16

This configuration implies that the default `HttpsUrlConnection` is used as the connector.

When making a PATCH request to the REST service with this configuration, the PATCH request fails with the stack trace shown below. JDK versions up to and including JDK 15.0.2 work successfully with the same configuration. Could work around using a different connector, if willing to use Jersey-specific API to specify the connector implementation.

Stack trace:
```
javax.ws.rs.ProcessingException: Unable to make field private final sun.net.www.protocol.https.DelegateHttpsURLConnection sun.net.www.protocol.https.HttpsURLConnectionImpl.delegate accessible: module java.base does not "opens sun.net.www.protocol.https" to unnamed module @76e041cf

at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:309)
at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:675)
at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697)
at org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
at org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:674)
[snip]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final sun.net.www.protocol.https.DelegateHttpsURLConnection sun.net.www.protocol.https.HttpsURLConnectionImpl.delegate accessible: module java.base does not "opens sun.net.www.protocol.https" to unnamed module @76e041cf
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 org.glassfish.jersey.client.internal.HttpUrlConnector$3.run(HttpUrlConnector.java:493)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at org.glassfish.jersey.client.internal.HttpUrlConnector.setRequestMethodViaJreBugWorkaround(HttpUrlConnector.java:480)
at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:324)
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:266)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:297)
... 52 more
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.