jms的问题:入站通道适配器

时间:2018-05-08 03:01:27

标签: spring-integration

我为入站通道适配器提供了以下Spring Integration配置:

<bean id="inputQueue"
    class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="INBOUND.QUEUE" />
</bean>
<int:channel id="inputChannel">
    <int:queue ref="inputQueue"></int:queue>
</int:channel>

<jms:inbound-channel-adapter
    channel="inputChannel" connection-factory="activemqConnectionFactory"
    destination-name="inputQueue"></jms:inbound-channel-adapter>

我在启动应用程序时遇到问题,因为它无法创建inputChannel bean。请帮忙。

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inputChannel': Unsatisfied dependency expressed through constructor parameter 0: Could not convert argument value of type [org.apache.activemq.command.ActiveMQQueue] to required type [java.util.Queue]: Failed to convert value of type 'org.apache.activemq.command.ActiveMQQueue' to required type 'java.util.Queue'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.apache.activemq.command.ActiveMQQueue' to required type 'java.util.Queue': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:697) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at com.example.demo.Example1Application.main(Example1Application.java:12) [classes/:na]

1 个答案:

答案 0 :(得分:0)

"org.apache.activemq.command.ActiveMQQueue未实现Java.util.Queue。这就是你到目前为止在堆栈跟踪中所拥有的。另一方面,您不需要向频道发布<queue>声明:您定义了一个JMS频道适配器来处理ActiveMQ。

您声明destination-name="inputQueue"的另一个问题是 bean名称。您应该考虑仅使用destination,它确实是对bean的引用,或者只是在INBOUND.QUEUE中使用destination-name