What's the correct Maven dependencies to use Spring JMS and ActiveMQ?

Pomario picture Pomario · Sep 24, 2012 · Viewed 8.1k times · Source

This is quite a common problem and I have found plenty solutions that do not work for me on the web. I am declaring:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-jms</artifactId>
  <version>3.0.7.RELEASE</version>
</dependency>

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

And jetty plug-in

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
</plugin>

But I keep on getting the following exception when issuing "mvn jetty:run":

org.springframework.beans.FatalBeanException: NamespaceHandler class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] for namespace [http://activemq.apache.org/schema/core] not found; nested exception is java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler

What would be the correct maven dependencies to run Jetty, ActiveMQ and Spring JMS?

Answer

Claus Ibsen picture Claus Ibsen · Sep 24, 2012

You need dependency on xbean-spring

<dependency>
  <groupId>org.apache.xbean</groupId>
  <artifactId>xbean-spring</artifactId>
  <version>3.7</version>
</dependency>