2016-01-21 71 views
0

我有一個使用嵌入式activeMQ 5.11的應用程序。在應用程序開始時,它會在類路徑位置創建activemq-data \ producerBroker \ KahaDB文件夾。我確實想改變位置,但是spring.xml並不需要一個位置。Java中的ActiveMQ數據永久性問題Spring

Spring.xml給出,

<bean id="producerBroker" class="org.apache.activemq.broker.SslBrokerService"> 
    <property name="brokerName" value="producerBroker" /> 
    <property name="persistent" value="true" /> 
    <property name="persistenceAdapter" ref="persistenceAdapter"/> 
    <property name="transportConnectors"> 
     <list> 
      <bean class="org.apache.activemq.broker.TransportConnector"> 
       <property name="name" value="xxx"></property> 
       <property name="uri" value="${transportConnectorURIs}"></property> 
      </bean> 
     </list> 
    </property> 
    <property name="jmsBridgeConnectors"> 
     <list> 
      <bean class="org.apache.activemq.network.jms.JmsQueueConnector"> 
       <property name="outboundQueueConnectionFactory"> 
        <bean class="org.apache.activemq.ActiveMQSslConnectionFactory"> 
         <property name="brokerURL" value="${brokerURL}" /> 
         <property name="userName" value="${username}" /> 
         <property name="password" value="${password}" /> 
         <property name="trustStore" value="${trust.store.path}" /> 
         <property name="trustStorePassword" value="${trust.store.password}" /> 
         <!-- <property name="keyStore" value="${key.store.path}"/> --> 
         <!-- <property name="keyStorePassword" value="${key.store.password}"/> --> 
        </bean> 
       </property> 
       <property name="outboundQueueBridges"> 
        <list> 
         <bean class="org.apache.activemq.network.jms.OutboundQueueBridge"> 
          <constructor-arg value="${screenshotQueueName}" /> 
         </bean> 
         <bean class="org.apache.activemq.network.jms.OutboundQueueBridge"> 
          <constructor-arg value="${resultXmlQueueName}" /> 
         </bean> 
        </list> 
       </property> 

      </bean> 
     </list> 
    </property> 
</bean> 


<bean id="persistenceAdapter" class="org.apache.activemq.store.kahadaptor.KahaPersistenceAdapter"> 
<property name="directory" value="E:\test"/> 

目前的問題是,它拋出一個錯誤「的例外是org.springframework.beans.factory.CannotLoadBeanClassException:找不到類[org.apache。 activemq.store.kahadaptor.KahaPersistenceA apter],用於在類路徑資源[spring/resultupload/resultupload.xml]中定義名稱爲'kahaPersistenceAdapter'的Bean;嵌套異常爲java.la g.ClassNotFoundException:org.apache.activemq.store .kahadaptor.KahaPersistenceAdapter「

任何人都有java spring中activeMQ 5.11目錄變化的經驗嗎?

回答

2

持久性位置的目的地必須在代理級別定義。

kahaPersistenceAdapter(這是基於文件)已被刪除5.9版本。你應該使用kahaDB。

kahaDB - 使用KahaDB嵌入式輕便非關係型數據庫

<broker brokerName="broker" persistent="true" useShutdownHook="false"> 
    <transportConnectors> 
    <transportConnector uri="tcp://localhost:61616"/> 
    </transportConnectors> 
    <persistenceAdapter> 
    <kahaDB directory="e:/temp" ... /> 
    </persistenceAdapter> 
</broker> 

的所有有效屬性:http://activemq.apache.org/schema/core/activemq-core-5.11.0-schema.html#kahaDB

+0

非常感謝。我能夠使它與給定的信息一起工作。 – CCoder