todvora / eet-client

Client and library for #EET communication - http://www.etrzby.cz/ , written in Java
MIT License
48 stars 26 forks source link

Support for Java 16 - use latest Apache CXF version #49

Closed Dacesilian closed 3 years ago

Dacesilian commented 3 years ago

If you encounter this issue with Java 16, change cxf dependency to latest version and it is resolved.

My pom.xml dependencies:

<eet.client.version>4.0.1</eet.client.version>
<cxf.version>3.4.4</cxf.version>

<!-- EET client dependencies -->
        <dependency>
            <groupId>cz.tomasdvorak</groupId>
            <artifactId>eet-client</artifactId>
            <version>${eet.client.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15on</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>${cxf.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>geronimo-javamail_1.4_spec</artifactId>
                    <groupId>org.apache.geronimo.specs</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <!-- Add bcprov jars to classpath -->
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>1.69</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0.1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.0.2</version>
        </dependency>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
            <version>1.2.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.messaging.saaj</groupId>
            <artifactId>saaj-impl</artifactId>
            <version>1.4.0</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>
        <!-- EET client dependencies END -->

Error (solved with newer dependencies above):

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:?]