Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What dependencies do I need for embedded ActiveMQ broker?

I'm trying to use embedded ActiveMQ broker for unit testing, as explained here: http://activemq.apache.org/how-to-unit-test-jms-code.html

What Maven dependencies I need to include? At the moment I have just 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'm getting:

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

When trying to instantiate a broker:

final BrokerService broker = new BrokerService();

What else should I add to the list of Maven dependencies? (I'm not using Spring)

like image 904
yegor256 Avatar asked Jun 13 '11 19:06

yegor256


3 Answers

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

like image 96
yegor256 Avatar answered Sep 20 '22 04:09

yegor256


can you try activemq-all:

<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>activemq-all</artifactId>
  <version>5.5.0</version>
</dependency>
like image 31
anubhava Avatar answered Sep 20 '22 04:09

anubhava


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

like image 28
satyendar d Avatar answered Sep 19 '22 04:09

satyendar d