【问题标题】:cannot instantiate message-driven-channel-adapter无法实例化消息驱动通道适配器
【发布时间】:2015-02-04 04:22:34
【问题描述】:

我是 Spring 集成的新手,目前我面临一个与 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

【问题讨论】:

    标签: spring-integration spring-jms


    【解决方案1】:

    您似乎遇到了类路径问题 - 特别是...

    spring-integration-core-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)。

    【讨论】:

    • 谢谢加里。此问题已解决,我们删除了 org.springframework.integration-1.0.3.RELEASE.jar 及其与 spring-integration-core-2.0.5.RELEASE.jar spring-integration-jms-2.0.5.RELEASE 的正常工作.jar
    猜你喜欢
    • 2014-01-23
    • 2011-04-29
    • 1970-01-01
    • 2017-04-29
    • 1970-01-01
    • 2021-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多