为了账号安全,请及时绑定邮箱和手机立即绑定

总是报错无法找到 org.springframework.jms.connection.SingleConnectionFactory

producer.xml配置部分:

<context:annotation-config/>

    <!-- ActiveMQ为我们提供的ConnectionFactory -->

    <bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">

    <property name="brokerURL" value="tcp://localhost:61616"/>

    </bean> 

    <!-- spring jms 为我们提供连接池 -->  

<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">

<property name="targetConnectionFactory" ref="targetConnectionFactory"/>

</bean>

每次一运行就报如下错误:

Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jms.connection.SingleConnectionFactory] for bean with name 'connectionFactory' defined in class path resource [producer.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jms.connection.SingleConnectionFactory

at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1377)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:608)

at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1476)

at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:999)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:739)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

at com.imooc.jms.producer.AppProducer.main(AppProducer.java:10)

Caused by: java.lang.ClassNotFoundException: org.springframework.jms.connection.SingleConnectionFactory

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)

at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394)

at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1424)

at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1369)

... 10 more

正在回答

5 回答

spring集成jms的jar没有引进去!

0 回复 有任何疑惑可以回复我~
#1

书策稠浊3869507

我的包引进去了,还是不行
2017-12-11 回复 有任何疑惑可以回复我~

我也是同样的问题,4.2.5.RELEASE的版本一直没导进去,后来换了4.3.14的就可以,换成5.0.4的也可以

0 回复 有任何疑惑可以回复我~

我也这样,不过吧spring版本从5改到4就好了,不知道你是不是

1 回复 有任何疑惑可以回复我~

没办法创建连接池

0 回复 有任何疑惑可以回复我~

我也是同样的问题

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

总是报错无法找到 org.springframework.jms.connection.SingleConnectionFactory

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信