java.lang.reflect.InaccessibleObjectException: Unable to make field private static volatile java.net.Authenticator java.net.Authenticator.theAuthenticator accessible: module java.base does not "opens java.net" to unnamed module @2f687a1a
at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) ~[?:?]
at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
at java.lang.reflect.Field.checkCanSetAccessible(Field.java:177) ~[?:?]
at java.lang.reflect.Field.setAccessible(Field.java:171) ~[?:?]
at org.apache.cxf.common.util.ReflectionUtil$11.run(ReflectionUtil.java:194) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at org.apache.cxf.common.util.ReflectionUtil$11.run(ReflectionUtil.java:192) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at java.security.AccessController.doPrivileged(AccessController.java:312) ~[?:?]
at org.apache.cxf.common.util.ReflectionUtil.setAccessible(ReflectionUtil.java:192) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at org.apache.cxf.transport.http.CXFAuthenticator.addAuthenticator(CXFAuthenticator.java:55) ~[org-apache-cxf-cxf-rt-transports-http-3.2.5.jar:3.2.5]
at org.apache.cxf.transport.http.URLConnectionHTTPConduit.<init>(URLConnectionHTTPConduit.java:90) ~[org-apache-cxf-cxf-rt-transports-http-3.2.5.jar:3.2.5]
at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:236) ~[org-apache-cxf-cxf-rt-transports-http-3.2.5.jar:3.2.5]
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:226) ~[org-apache-cxf-cxf-rt-bindings-soap-3.2.5.jar:3.2.5]
at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:153) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:108) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at org.apache.cxf.endpoint.UpfrontConduitSelector.selectConduit(UpfrontConduitSelector.java:77) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at org.apache.cxf.endpoint.ClientImpl.getConduit(ClientImpl.java:884) ~[org-apache-cxf-cxf-core-3.2.5.jar:3.2.5]
at cz.tomasdvorak.eet.client.security.SecureEETCommunication.configureTimeout(SecureEETCommunication.java:151) ~[cz-tomasdvorak-eet-client-3.0.0-java10-20180820.jar:?]
at cz.tomasdvorak.eet.client.security.SecureEETCommunication.getPort(SecureEETCommunication.java:91) ~[cz-tomasdvorak-eet-client-3.0.0-java10-20180820.jar:?]
at cz.tomasdvorak.eet.client.EETClientImpl.sendSync(EETClientImpl.java:54) ~[cz-tomasdvorak-eet-client-3.0.0-java10-20180820.jar:?]
If you encounter this issue with Java 16, change
cxf
dependency to latest version and it is resolved.My pom.xml dependencies:
Error (solved with newer dependencies above):