wtorek, 16 stycznia 2018

Wildfly: NoSuchMethodError: Logger.tracef

When adding Arquillian based integration tests to older projects I often encounter exception:
Exception in thread "Remoting "endpoint" task-4" java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;I)V
        at org.jboss.remotingjmx.VersionedConectionFactory$ClientVersionReceiver.handleMessage(VersionedConectionFactory.java:158)
        at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:456)
        at org.jboss.remoting3.EndpointImpl$TrackingExecutor$1.run(EndpointImpl.java:717)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
It is caused a mismatch in versions of jboss-logging. The solution is to find additional version:
$ mvn dependency:tree |grep jboss-logging
...

[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- org.jboss.resteasy:resteasy-client:jar:3.0.19.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.19.Final:compile
[INFO] |  |  +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar:1.0.0.Final:compile
[INFO] |  |  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  |  +- javax.activation:activation:jar:1.1.1:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.1:compile
[INFO] |  |  \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] |  \- org.jboss.logging:jboss-logging:jar:3.1.4.GA:compile
And to exclude it in pom.xml:
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>3.0.19.Final</version>
            <scope>provided</scope>
            <type>jar</type>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.logging</groupId>
                    <artifactId>jboss-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>