You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Jiri Daněk (JIRA)" <ji...@apache.org> on 2018/04/04 10:59:00 UTC

[jira] [Created] (ARTEMIS-1783) Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/common/base/Supplier

Jiri Daněk created ARTEMIS-1783:
-----------------------------------

             Summary: Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/common/base/Supplier
                 Key: ARTEMIS-1783
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1783
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: Broker
    Affects Versions: 2.5.0
            Reporter: Jiri Daněk


When using my program cli-artemis-jms at https://github.com/rh-messaging/cli-java, which depends on activemq-artemis-jms-client, I get the following stack trace

{noformat}
junit5(?) $ java -jar systemtests/client_executable/cli-artemis-jms.jar receiver --address test --log-msgs json --count 0
Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/common/base/Supplier
        at org.apache.activemq.artemis.core.message.impl.CoreMessageObjectPools.<init>(CoreMessageObjectPools.java:26)
        at org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.<init>(ClientPacketDecoder.java:36)
        at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createPacketDecoder(ActiveMQClientProtocolManager.java:520)
        at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.connect(ActiveMQClientProtocolManager.java:412)
        at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.establishNewConnection(ClientSessionFactoryImpl.java:1273)
        at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:891)
        at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:795)
        at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:238)
        at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:784)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:813)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:277)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:272)
        at com.redhat.mqe.acc.AccConnectionManager.<init>(AccConnectionManager.java:68)
        at com.redhat.mqe.acc.AccConnectionManagerFactory.make(AccConnectionManagerFactory.java:33)
        at com.redhat.mqe.acc.AccConnectionManagerFactory.make(AccConnectionManagerFactory.java:27)
        at com.redhat.mqe.lib.CoreClient.createConnection(CoreClient.java:86)
        at com.redhat.mqe.lib.ReceiverClient.consumeMessage(ReceiverClient.java:170)
        at com.redhat.mqe.lib.ReceiverClient.startClient(ReceiverClient.java:147)
        at com.redhat.mqe.lib.Main.main(Main.java:50)
        at com.redhat.mqe.acc.Main.main(Main.java:74)
Caused by: java.lang.NoClassDefFoundError: com/google/common/base/Supplier
        ... 20 more
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Supplier
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 20 more
{noformat}

I get this with artemis-jms-client 2.5.0, but not with artemis-jms-client 2.4.0.

I believe the guilty commit is in ARTEMIS-1586, "794e56da99456e Refactor to make more generic", which introduced usage of Google Guava, without adding it to the package's pom file, causing my maven to miss that transitive dependency when building uberjar.

The command above runs when triggered from Intellij IDE, where the dependency is on classpath, for some reason.

Workaround is easy, add Guava to dependencies of your own program which is using the artemis jms library.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)