java.lang.NoClassDefFoundError: Could not initialize class org.apache.activemq.util.IdGenerator

你。 提交于 2019-12-12 04:13:18

问题


I am trying to use ActiveMQ 5.10.0 with SoapUI 4.6 and Hermes 1.14. I get the error below when I try and add a queue. I presume Hermes can't find the type IdGenerator in any of the loaded jars. Which are:

activemq-client-5.10.0.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar

Does anyone know where this class is defined? I looked for activemq-util.jar in the binary distribution but I did not find such a file.

Error:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.activemq.util.IdGenerator 
        at org.apache.activemq.ActiveMQConnectionFactory.getClientIdGenerator(ActiveMQConnectionFactory.java:969) 
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:363) 
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:331) 
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:303) 
        at org.apache.activemq.ActiveMQConnectionFactory.createQueueConnection(ActiveMQConnectionFactory.java:260) 
        at hermes.impl.jms.ConnectionManagerSupport.createConnection(ConnectionManagerSupport.java:147) 
        at hermes.impl.jms.ConnectionManagerSupport.createConnection(ConnectionManagerSupport.java:92) 
        at hermes.impl.jms.ConnectionSharedManager.reconnect(ConnectionSharedManager.java:81) 
        at hermes.impl.jms.ConnectionSharedManager.connect(ConnectionSharedManager.java:91) 
        at hermes.impl.jms.ConnectionSharedManager.getConnection(ConnectionSharedManager.java:104) 
        at hermes.impl.jms.ConnectionSharedManager.getObject(ConnectionSharedManager.java:142) 
        at hermes.impl.jms.ThreadLocalSessionManager.connect(ThreadLocalSessionManager.java:190) 
        at hermes.impl.jms.ThreadLocalSessionManager.getSession(ThreadLocalSessionManager.java:570) 
        at hermes.impl.jms.AbstractSessionManager.getDestination(AbstractSessionManager.java:460) 
        at hermes.impl.DefaultHermesImpl.getDestination(DefaultHermesImpl.java:367) 
        at hermes.browser.tasks.BrowseDestinationTask.invoke(BrowseDestinationTask.java:141) 
        at hermes.browser.tasks.TaskSupport.run(TaskSupport.java:175) 
        at hermes.browser.tasks.ThreadPool.run(ThreadPool.java:170) 
        at java.lang.Thread.run(Unknown Source)

回答1:


The IdGenerator class is located in the activemq-client jar. Here is the result of a search in the source tree:

/activemq-client/src/main/java/org/apache/activemq/util/IdGenerator.java

There's been no recent changes so I'd guess that the error is misleading and that it's actually some other missing dependency that's being loaded when the class is created. Is there more information in the log or a 'caused by exception' ?




回答2:


This is very old but in case anyone else is trying to get this spun up... don't use the built in HermesJMS that comes with SoapUI. Apparently there's a bug in it that doesn't play nice with ActiveMQ v5.8 and following [I tried 5.11 & 5.13 and had the issue. The cheating fix is to install the standalone [I had to get it from sourceforge].

The sourceforge jar is installed with [assuming version 1.14]: java -jar hermes-installer-1.14.jar

Once installed you can tie this version to soapui or launch it with the bat/sh file. I still had issues with ActiveMQ version 5.13 but version 5.11 worked for me.




回答3:


For whom it may interest. This is kind of common issue I come accross from time to time. I call it jar version incompatibility. I was getting exception in title and other funny exceptions when using latest (but not actively developed) hermes 1.14 and currently latest Apache Active MQ 5.14. I've found out after a long struggle that it is fixed by using an older version of Active MQ - like 5.3.



来源:https://stackoverflow.com/questions/25030146/java-lang-noclassdeffounderror-could-not-initialize-class-org-apache-activemq-u

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!