创建名为'inboundJms.container'的bean时出错:无法解析对bean的连接'connectionFactory'

时间:2017-10-26 08:49:27

标签: java weblogic spring-integration

我试图在Spring integration.getting下面的Exception

的帮助下监听weblogic队列

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

的Config.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"/>

1 个答案:

答案 0 :(得分:1)

默认情况下,需要ConnectionFactory的Spring集成JMS组件将查找名为&#39; connectionFactory&#39;的bean。这指向ConnectionFactory实现。另一方面,你有一个名为&#39; wlConnectionFactory&#39;的ConnectionFactory bean。因此要么将其名称更改为&#39; connectionFactory&#39;或者定义一个连接工厂&#39;您的&#39;消息驱动频道适配器&#39;。

上的属性

干杯