简体   繁体   中英

Error creating bean with name 'inboundJms.container': Cannot resolve reference to bean 'connectionFactory'

Am trying to listen weblogic queue with help of Spring integration.getting below Exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inboundJms.container': Cannot resolve reference to bean 'connectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'connectionFactory' available

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"/>

By default spring integration JMS components that require ConnectionFactory will be looking for a bean named 'connectionFactory' that points to ConnectionFactory implementation. You on the other hand have a ConnectionFactory bean under the name 'wlConnectionFactory'. So either change its name to 'connectionFactory' or define a 'connection-factory' attribute on your 'message-driven-channel-adapter'.

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM