如何在ActiveMQ-5.11中将默认KAHA DB替换为Oracle数据库

时间:2015-11-16 19:31:50

标签: apache activemq

我们开始使用Apache ActiveMQ和默认的Kaha数据库。

现在我们将非常有效地使用它来降低数据丢失的风险我们希望用Orcale数据库替换默认数据库。我们如何做到这一点我试图改变actvemq.xml

    <bean id="Orcale-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
      <property name="url" value="jdbc:oracle:thin:*.*.*.*:1521/xe"/>
      <property name="username" value="username"/>
      <property name="password" value="password"/>
      <property name="poolPreparedStatements" value="true"/>
     </bean>
Below  one is adapter configuration

     <persistenceAdapter>
          <jdbcPersistenceAdapter dataSource="Orcale-ds"/>
       </persistenceAdapter>

但服务器没有启动,所以如何使用activeMQ配置oracle数据库。 日志文件中的错误位于

之下
    at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.11.1]
2015-11-18 16:58:30,251 | ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Cannot create inner bean '(inner bean)#141e366' of type [org.apache.activemq.store.jdbc.JDBCPersistenceAdapter] while setting bean property 'persistenceAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#141e366' defined in class path resource [activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found | org.apache.activemq.xbean.XBeanBrokerFactory | main
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Cannot create inner bean '(inner bean)#141e366' of type [org.apache.activemq.store.jdbc.JDBCPersistenceAdapter] while setting bean property 'persistenceAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#141e366' defined in class path resource [activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:287)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]

错误从一些对话开始。

ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' 
defined in class path resource [activemq.xml]: Cannot create inner bean '(inner bean)#dca1b0' of type [org.apache.activemq.store.jdbc.JDBCPersistenceAdapter] 
while setting bean property 'persistenceAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'(inner bean)#dca1b0' defined in class path resource [activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: 
Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: 
Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found | 
org.apache.activemq.xbean.XBeanBrokerFactory | main

1 个答案:

答案 0 :(得分:0)

你必须添加bean(带#)而不是字符串 -

<jdbcPersistenceAdapter  dataSource="#Orcale-ds"/>

它把 datasrouce 当作 String 而不是数据源 bean