【问题标题】:Error creating bean with name 'inboundJms.container': Cannot resolve reference to bean 'connectionFactory'创建名为“inboundJms.container”的 bean 时出错:无法解析对 bean“connectionFactory”的引用
【发布时间】:2017-10-26 19:50:15
【问题描述】:

我正在尝试借助 Spring integration.getting below Exception 来监听 weblogic 队列

org.springframework.beans.factory.BeanCreationException:创建名为“inboundJms.container”的bean时出错:设置bean属性“connectionFactory”时无法解析对bean“connectionFactory”的引用;嵌套异常是 org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'connectionFactory' available

配置.xml

<bean id="wljndiTemplate" class="org.springframework.jndi.JndiTemplate" lazy-init="true">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                <prop key="java.naming.provider.url">-------</prop>
                <prop key="java.naming.security.principal">-------</prop>
                <prop key="java.naming.security.credentials">-------</prop>
            </props>
        </property>
    </bean>

    <bean id="wlConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="wljndiTemplate" />
        <property name="jndiName" value="QueueConnFactory" />
    </bean>

    <bean id="wlDestinationResolver"  class="org.springframework.jms.support.destination.JndiDestinationResolver">
        <property name="jndiTemplate" ref="wljndiTemplate" />
        <property name="cache" value="true" />
    </bean>

    <bean id="inboundResponseQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="wljndiTemplate" />
        <property name="jndiName" value="OutboundQueue" />

InboundAdapter.xml

<jms:message-driven-channel-adapter id="inboundJms" destination="ContactOutboundQueue" channel="messageReceiver" />

    <!--<router id="msgRouter" auto-startup="true" input-channel="messageReceiver"  default-output-channel=""       ref="routeInfo"         method="getQueueMessage"/>-->

    <integration:service-activator id="msgRouter" input-channel="messageReceiver" ref="routeInfo" method="getQueueMessage"/>

【问题讨论】:

    标签: java weblogic spring-integration


    【解决方案1】:

    默认情况下,需要 ConnectionFactory 的 spring 集成 JMS 组件将寻找一个名为“connectionFactory”的 bean,该 bean 指向 ConnectionFactory 实现。另一方面,您有一个名为“wlConnectionFactory”的 ConnectionFactory bean。因此,要么将其名称更改为“connectionFactory”,要么在“消息驱动通道适配器”上定义一个“连接工厂”属性。

    干杯

    【讨论】:

    • 谢谢你知道了
    猜你喜欢
    • 2015-06-29
    • 2018-04-29
    • 1970-01-01
    • 2020-09-27
    • 1970-01-01
    • 2021-09-14
    • 2020-03-24
    • 1970-01-01
    • 2021-11-21
    相关资源
    最近更新 更多