无法实例化消息驱动的通道适配器

时间:2015-02-04 04:22:34

标签: spring-integration spring-jms

我是Spring Integration的新手,目前我面临着与IBM MQ的Spring-JMS集成的一个问题。目前只有Spring-JMS集成的问题。下面提到的Jar是考虑构建的。请帮我解决这个问题。

org.springframework.integration-1.0.3.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-core-3.0.5.RELEASE.jar
spring-integration-core-2.0.5.RELEASE.jar
spring-integration-jms-2.0.5.RELEASE.jar
spring-integration-stream-2.0.5.RELEASE.jar
spring-jms-3.0.6.RELEASE.jar
spring-xml-2.0.3.RELEASE.jar
org.springframework.integration-1.0.3.RELEASE.jar



   Code Snippet Starts: 
<?xml version="1.0" encoding="UTF-8"?>

<beans:beans xmlns="http://www.springframework.org/schema/integration" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:ctx="http://www.springframework.org/schema/context" 
    xmlns:jms="http://www.springframework.org/schema/integration/jms" 
    xmlns:stream="http://www.springframework.org/schema/integration/stream" 
    xmlns:si-xml="http://www.springframework.org/schema/integration/xml" 
    xmlns:util="http://www.springframework.org/schema/util" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-2.5.xsd 
            http://www.springframework.org/schema/integration 
            http://www.springframework.org/schema/integration/spring-integration-2.0.xsd 
            http://www.springframework.org/schema/integration/jms 
            http://www.springframework.org/schema/integration/jms/spring-integration-jms-2.0.xsd 
            http://www.springframework.org/schema/integration/stream 
            http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd 
            http://www.springframework.org/schema/integration/xml 
            http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd 
            http://www.springframework.org/schema/util 
            http://www.springframework.org/schema/util/spring-util.xsd">

    <ctx:component-scan base-package="com.iflexsolutions.fcpb"/>    

    <channel id="InputJMSChannel"/> 

    <jms:message-driven-channel-adapter id="TestJMSAdapter"
            destination="requestQueue" extract-payload="true" 
            connection-factory="connectionFactory" 
            channel="InputJMSChannel" 
    />

    <service-activator id="TestJMSServiceActivator" 
        input-channel="InputJMSChannel" 
        output-channel="stdout"
        ref="wmXMLTransformerBean"
        method="validateAndTransform"/>

    <stream:stdout-channel-adapter id="stdout"/>

</beans:beans>
    Code Snippet Starts: 

Error Details: 
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.jms.ChannelPublishingJmsMessageListener#0': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.integration.channel.DirectChannel' to required type 'org.springframework.integration.MessageChannel' for property 'requestChannel'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.channel.DirectChannel] to required type [org.springframework.integration.MessageChannel] for property 'requestChannel': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
    at com.iflexsolutions.fcpb.mobilebanking.jms.test.LoadApp.main(LoadApp.java:11)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.integration.channel.DirectChannel' to required type 'org.springframework.integration.MessageChannel' for property 'requestChannel'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.channel.DirectChannel] to required type [org.springframework.integration.MessageChannel] for property 'requestChannel': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:481)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:518)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:512)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    ... 11 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.channel.DirectChannel] to required type [org.springframework.integration.MessageChannel] for property 'requestChannel': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:233)
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:466)
    ... 17 more

1 个答案:

答案 0 :(得分:0)

看起来你有类路径问题 - 特别是......

弹簧一体化芯-2.0.5.RELEASE.jar org.springframework.integration-1.0.3.RELEASE.jar

1.0.x与2.0.x不兼容。

除了这种不匹配之外,我建议你使用当前版本的Spring Framework(4.1.4)和Spring Integration(4.1.2)。