2012-04-10 8 views
0

永続的な組み込みブローカを持つ同じマシンで、この1つのサービスの複数インスタンス(別々のJVM)を起動する必要があります。すべての設定ファイルはあらかじめ生成されており、サービスの開始前に変数の置換がコンパイル時に行われます。私はいくつかのインスタンスでAMQデータディレクトリとKahaDBのロックを取得しようとすると問題が発生しています。明らかに最初のインスタンスはロックを成功させ、残りは失敗し続けます。ActiveMQ設定とSpring Expression Language(SpEL)

私はこのような何かを設定する必要があります

. . . 
<amq:broker dataDirectory="${activemq.directory}/data" id="broker" persistent="true" useJmx="false" > 
. . . 

を私はPropertyPlaceholderConfigurerを試してみましたが、私は理解して、それはSpring構成で指定されたファイルからプロパティをロードし、一度にそれが起動し、すでに手遅れです。私は

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '{systemProperties['activemq.directory']}/data' is defined 

を参照してくださいログで

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:p="http://www.springframework.org/schema/p" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:jms="http://www.springframework.org/schema/jms" 
     xmlns:amq="http://activemq.apache.org/schema/core" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans.xsd 
          http://www.springframework.org/schema/context 
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
          http://www.springframework.org/schema/jms 
          http://www.springframework.org/schema/jms/spring-jms-3.0.xsd 
          http://activemq.apache.org/schema/core 
          http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd"> 


    <!-- Embedded ActiveMQ Broker   --> 
    <amq:broker dataDirectory="#{systemProperties['activemq.directory']}/data" id="broker" persistent="true" useJmx="false" > 
    ... 
私は、コマンドラインで渡す

-Dactivemq.directory=<my-directory> 

:私はので、私はこのようなもので終わる春の式言語を使用しようとしていますAMQとSpring3 SpELで何かが欠けているようですか?そこに私は行方不明かもしれないと思ういくつかの他の解決策はありますか?

答えて

0

良い古いPropertyPlaceholderConfigurerを使い、SpEL表記を削除すると、魅力的に機能します。

2

1. PropertyPlaceholderConfigurerを使用する場合は、非常に厄介ですが(少なくとも動作しますが)、最初に空白を入れてください。

<amq:broker useJmx="false" persistent="false"> 
    <amq:transportConnectors> 
    <amq:transportConnector uri=" #{myconf.getConfigurationValue('JMS_URI')}" /> 
    </amq:transportConnectors> 
</amq:broker> 

myconf.properties:JMS_URI = TCP:// localhostを:0また、明示的に、少なくともプロトコルを設定した場合、それはまた、働くことは興味深い何デーモン= falseを

2.? :

<amq:broker useJmx="false" persistent="false"> 
    <amq:transportConnectors> 
    <amq:transportConnector uri="tcp://#{myconf.getConfigurationValue('JMS_URI')}" /> 
    </amq:transportConnectors> 
</amq:broker> 

myconf.properties:JMS_URI = localhostを:?0デーモン=偽

関連する問題