您的位置:首页 > 编程语言 > Java开发

spring整合activemq问题小结

2017-09-30 15:35 363 查看
1.通配符的匹配很全面, 但无法找到元素 ‘amq:connectionFactory’

在activemq.xml文件里有配置

<amq:connectionFactory id="amqConnectionFactory"
brokerURL="tcp://localhost:61616"
userName="admin"
password="admin" /> -->
<!-- <amq:connectionFactory id="amqConnectionFactory" brokerURL="tcp://localhost:61616"
userName="admin" password="admin"/> -->

<!-- 配置JMS连接工长 -->
<bean id="connectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name = "brokerURL" ref="amqConnectionFactory"/>
<property name="sessionCacheSize" value="100" />
</bean>


目前不清楚该怎么改,只是换了一种写法

<bean id="mqConnectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory">
<property name = "brokerURL" value="tcp://localhost:61616" />
</bean>


2.类型转换错误:

Error creating bean with name ‘redisTemplate’ defined in URL [file:/F:/Java/workspace/user-project/user-app/target/classes/spring-redis-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ‘org.apache.activemq.spring.ActiveMQConnectionFactory’ to required type ‘org.springframework.data.redis.connection.RedisConnectionFactory’ for property ‘connectionFactory’; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.spring.ActiveMQConnectionFactory] to required type [org.springframework.data.redis.connection.RedisConnectionFactory] for property ‘connectionFactory’: no matching editors or conversion strategy found

原因:在redis配置中也用到了connectionFactory,所以这里的connectionFactory改名为mqConnectionFactory即可。如1中所示
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: