activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mathias <math...@afjochnick.net>
Subject can't get tomcat to pick up activemq.xml and store.dir!
Date Fri, 15 Oct 2010 11:52:35 GMT

Hi, 

i am trying my best to get 2 webapps to communicate over activeMQ5.4.1 JMS
on Tomcat 6 on osx.

GOAL:
I am trying to install a "global" broker in tomcat that both webapps will
use, and have a "global" activemq.xml that sets that broker up. All activeMQ
processing should use that broker.

PROBLEM:
I get access to a connectionfactory and can look up queues in my webapp, but
it seems that activemq is initialized with some "default" config
automatically, driven by my connectionfactory and queues config,  and the
activemq.xml isn't picked up. Also, all activemq data is put under
/bin/activemq-data even though i have specified activemq.store.dir (see
below).


If anyone can give me pointers i'd be much obliged!


SETUP:
This is what i have done:
( all '/' referring to tomcat root dir)

1. i put all activemq libs under /lib and i've tried the activemq.xml both
under /common and under /conf

2. modified my catalina.sh script thus:
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dactivemq.store.dir=/activeMQ"
(notice especially the last "store.dir")

3. i modified the /conf/server.xml:
<GlobalNamingResources>
    ...
    <Resource auth="Container" description="JMS Connection Factory"
name="jms/ConnectionFactory" brokerURL="vm://localhost"
brokerName="myBroker"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
type="org.apache.activemq.ActiveMQConnectionFactory"
useEmbeddedBroker="true"/>
	<Resource auth="Container" description="JMS Queue" name="jms/messaging/in"
type="org.apache.activemq.command.ActiveMQQueue"
physicalName="messaging.out"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"/>
	<Resource auth="Container" description="JMS Queue" name="jms/messaging/out"
type="org.apache.activemq.command.ActiveMQQueue"
physicalName="messaging.out"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"/>
  </GlobalNamingResources>

4. i modified the /conf/context.xml:
   <ResourceLink global="jms/ConnectionFactory" name="jms/ConnectionFactory"
type="javax.jms.ConnectionFactory"/>
   <ResourceLink global="jms/messaging/in" name="jms/messaging/in"
type="javax.jms.Topic"/>
   <ResourceLink global="jms/messaging/out" name="jms/messaging/out"
type="javax.jms.Topic"/>

5. i set up resource-ref's in my webapps' web.xml:
    <resource-ref>
        <description>Connection Factory</description>
        <res-ref-name>jms/connectionFactory</res-ref-name>
        <res-type>javax.jms.QueueConnectionFactory</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

    <!-- Queue ref -->
    <resource-ref>
        <description>Connection Factory</description>
        <res-ref-name>jms/messaging/in</res-ref-name>
        <res-type>javax.jms.QueueConnectionFactory</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>


That's it. but what i get in the console seems to be some sort of
default-init:
Oct 15, 2010 1:30:01 PM org.apache.activemq.broker.BrokerService start
INFO: ActiveMQ JMS Message Broker (localhost,
ID:Neo.local-56119-1287142201288-0:0) started
Oct 15, 2010 1:30:01 PM org.apache.activemq.broker.TransportConnector start

And as mentioned above, all data ends up under /bin/activemq-data.


For reference, my activemq.xml:
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
      <broker useJmx="true" xmlns="http://activemq.apache.org/schema/core"
name="nubaBroker" persistent="true">
            <transportConnectors>
                  <transportConnector name="defaulttrans"
uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
            </transportConnectors>
            <destinationPolicy>
            <policyMap>
                <policyEntries>
                        <!-- Set the following policy on all queues using
the '>' wildcard -->
                  <policyEntry queue=">"> 
                        <deadLetterStrategy> 
                                        <!-- Use the prefix 'DLQ.' for the
destination name, and make the DLQ a queue rather than a topic -->
                              <individualDeadLetterStrategy
queuePrefix="DLQ." useQueueForQueueMessages="true" /> 
                        </deadLetterStrategy> 
                  </policyEntry>
                </policyEntries>
            </policyMap>
        </destinationPolicy>
            <networkConnectors>
            <!-- by default just auto discover the other brokers -->
            <networkConnector name="default" uri="multicast://default"/>
            <!--
            <networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
            -->
          </networkConnectors>    
            <persistenceAdapter>
                  <!--amqPersistenceAdapter directory="activemq-data"
maxFileLength="32mb"/-->
                  <jdbcPers	istenceAdapter
dataDirectory="/activeMQ/activemq-data/jdbc"/>
            </persistenceAdapter>
      </broker>
</beans>

-- 
View this message in context: http://activemq.2283324.n4.nabble.com/can-t-get-tomcat-to-pick-up-activemq-xml-and-store-dir-tp2996886p2996886.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message