2

I am using Mule Studio 3.4 and would like to experiment with Active Mq. I understood that ActiveMq is embedded in Mule, so it's not necessary to add jars on the classpath, by the way activeMq classes cannot be found on the classpath. Where am I wrong? Here you are my configuration (copied from http://www.mulesoft.org/mule-activemq-integration-examples):

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
    xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
    <spring:beans>
    <spring:bean id="AmqDeadLetterStrategy"
                 class="org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy"
                 p:queuePrefix="DLQ." />

    <spring:bean id="AmqDefaultPolicyEntry"
                 class="org.apache.activemq.broker.region.policy.PolicyEntry"
                 p:queue="jobs.*"
                 p:deadLetterStrategy-ref="AmqDeadLetterStrategy" />

    <spring:bean id="AmqPolicyMap"
                 class="org.apache.activemq.broker.region.policy.PolicyMap"
                 p:defaultEntry-ref="AmqDefaultPolicyEntry" />

    <spring:bean name="AmqBroker"
                 class="org.apache.activemq.broker.BrokerService"
                 p:brokerName="esb-amq-broker"
                 p:persistent="true"
                 p:dataDirectory="${activemq.data.dir}"
                 p:useJmx="true"
                 p:useShutdownHook="false"
                 p:destinationPolicy-ref="AmqPolicyMap"
                 init-method="start"
                 destroy-method="stop" />

    <spring:bean name="AmqRedeliveryPolicy"
                 class="org.apache.activemq.RedeliveryPolicy"
                 p:useExponentialBackOff="true" />

    <spring:bean name="AmqConnectionFactory"
                 class="org.apache.activemq.spring.ActiveMQConnectionFactory"
                 p:brokerURL="vm://esb-amq-broker"
                 p:redeliveryPolicy-ref="AmqRedeliveryPolicy"
                 depends-on="AmqBroker" />
  </spring:beans>

  <jms:activemq-connector name="EsbJmsConnector"
                          specification="1.1"
                          connectionFactory-ref="AmqConnectionFactory"
                          disableTemporaryReplyToDestinations="true"
                          persistentDelivery="true" />

</mule>

The errors are "Unable to find type org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy on build path of project..." and similar others. Thanks!

David Dossot
  • 33,403
  • 4
  • 38
  • 72
user1820620
  • 672
  • 2
  • 13
  • 27

1 Answers1

4

Mule does not bundle activemq jars, nor the ones for any JMS broker, therefor you will need either to add it manually to your project or to the ${studio.home}/plugins/org.mule.tooling.server.${mule.version}_${mule.version}.${time.stamp}/mule/user if you want the container to provide it.

genjosanzo
  • 3,264
  • 2
  • 16
  • 21
  • Thank you for your help, I downloaded the file activemq-all-5.8.0.jar and put it in the location you suggested. It has all the classes needed. I restarted eclpise but I still get the same errors. – user1820620 Sep 09 '13 at 12:32
  • Where did you put the jar? Also are you using eclipse or studio? – genjosanzo Sep 09 '13 at 12:55
  • I am using the studio, if I remove the attribute "p:queuePrefix="DLQ." in the first bean, the error is not shown! Pehraps it's not related to jar loading itself – user1820620 Sep 09 '13 at 13:07
  • 1
    I don't know what happened, but re-pasting the property again solved the problem. Then I couldn't reproduce the error! Your answer could anyway bring me to the next troubleshooting step, thank you. – user1820620 Sep 09 '13 at 13:27