What dependencies are needed for the integrated ActiveMQ broker?

I am trying to use the built-in ActiveMQ broker for unit testing, as described here: http://activemq.apache.org/how-to-unit-test-jms-code.html

What Maven dependencies need to be included? At the moment, I only have these:

<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-core</artifactId> <version>5.5.0</version> </dependency> 

This is what I get:

 java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException 

When trying to create a broker instance:

 final BrokerService broker = new BrokerService(); 

What else should be added to the Maven dependency list? (I'm not using Spring)

+6
source share
3 answers

The solution is simple, you just need to remove the javax:javaee-api dependency.

+7
source

can try activemq-all :

 <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-all</artifactId> <version>5.5.0</version> </dependency> 
+4
source

moved the javaee dependency to the end of the class path. This solved my problem.

+3
source

Source: https://habr.com/ru/post/890433/


All Articles