2017-06-28 39 views
1

私は、以下のcontext.xmlでTomcatに組み込みActiveMQを作成しています。ブローカーURL brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml"のconfig xmlの場所を指定します。ActiveMQがactivemq.xmlを使用しているかどうかはどのようにわかりますか?

私はactivemq.xmlをWARファイルのベースに置いています(つまり、次はとWARのWEB-INFです)。それはそこにあるのだろうか?

MyWAR.war
        WEB-INF/
                    beans.xmlの
        activemq.xml

マイcontext.xmlファイル:

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

    <!-- JMS Factory and Queue --> 
    <Resource auth="Container" 
      name="jms/ConnectionFactory" 
      type="org.apache.activemq.ActiveMQConnectionFactory" 
      description="JMS Connection Factory" 
      factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
      brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" 
      brokerName="MyBroker" 
      useEmbeddedBroker="true" 
      trustAllPackages="true" 
      persistent="true" 
    /> 

    <Resource auth="Container" 
      name="jms/MyQueue" 
      type="org.apache.activemq.command.ActiveMQQueue" 
      description="Downtime Event JMS queue" 
      factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
      physicalName="MyQueue" 
      persistent="true" 
    /> 

    <Resource auth="Container" 
      name="jms/MyQueueRetry" 
      type="org.apache.activemq.command.ActiveMQQueue" 
      description="Downtime Event JMS queue" 
      factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
      physicalName="MyQueueRetry" 
      persistent="true" 
    /> 

</Context> 

EDIT:私の更新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.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> 

    <bean id="ioExceptionHandler" class="org.apache.activemq.util.DefaultIOExceptionHandler"> 
     <property name="ignoreAllErrors"><value>true</value></property> 
    </bean> 

    <!-- MySql DataSource Sample Setup --> 
    <bean id="mysql-ds" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> 
     <property name="driverClassName" value="com.mysql.jdbc.Driver"/> 
     <property name="url" value="jdbc:mysql://127.0.0.1:3306/activemq"/> 
     <property name="username" value="testuser"/> 
     <property name="password" value="password"/> 
     <property name="poolPreparedStatements" value="true"/> 
    </bean> 

    <broker 
      xmlns="http://activemq.apache.org/schema/core" 
      persistent="true" 
      ioExceptionHandler="#ioExceptionHandler" 
      useShutdownHook="true" 
      useJmx="false" 
      brokerName="EventBroker" 
    > 
     <persistenceAdapter> 
      <jdbcPersistenceAdapter dataSource="#mysql-ds" /> 
     </persistenceAdapter> 
    </broker> 
</beans> 

を私はまた、次の両方を試してみました:

brokerURL="vm://localhost?brokerConfig=xbean:classpath:activemq.xml"

(WEB-INFに入れて) brokerURL="vm://localhost?brokerConfig=xbean:classpath:WEB-INF/activemq.xml"

これは決してMySQLを使用しません。

答えて

1

カップルの方法..

クランクアップDEBUGにorg.apache.activemqのロギングや...

が開いているポート61618上の追加のエントリを追加します。TRACEそれはnetstatコマンドを使用して聞いていることを確認します。

また、実行中のJVMプロセスのJMXに接続し、存在するorg.apache.activemq JMX Beanを参照することもできます。

カップル参照:

+0

ありがとう、あなたは私はそれが私のWARファイルにactivemq.xmlを読むことができます方法を知っていますか?それはそれを使用していないようです。 –

+0

xbean:classpath:activemq.xmlを使ってみましたか? –

+0

いいえ、私はそれを試して、それが動作する場合は、おかげでお知らせします!ありがとう! –

0

(一部@Matt_Pavlovichのヘルプから)

あなたはxbeans下classpath:キーを使用する必要があり、それWARクラスパス(META-INFなど)にあるディレクトリになければなりません:

brokerURL="vm://localhost?brokerConfig=xbean:classpath:META-INF/activemq.xml" 
関連する問題