Weblogic部署无法解析本地队列

时间:2016-05-09 10:10:43

标签: jms jndi weblogic-10.x spring-jms

我们有一个基于Spring的应用程序无法在Weblogic 10.3容器上部署。在部署时,应用程序尝试在Weblogic容器的JMS模块中查找两个本地JMS队列,并且在部署发生时,应用程序可以找到一个本地队列,但不能找到另一个本地队列。

两个队列的配置完全相同,只是它们的名称不同。为什么应用程序找到一个队列可以,但不能找到另一个队列?

我已多次检查队列名称JNDI名称,但我看不到任何拼写错误或类似错误。

我已经开启了跟踪日志记录,我可以看到用于查找两个队列的连接工厂是相同的,两个队列的弹簧JMS配置完全相同,但是它找不到另一个队列。

我不知道还有什么可以检查以确定问题可能是什么......任何想法?

这是我无法在Weblogic JNDI树中查找其中一个队列时遇到的错误:

Caused by: javax.naming.NameNotFoundException: Unable to resolve 'QUEUE_NAME'. Resolved ''; remaining name 'QUEUE_NAME' at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)

PS:两个队列都具有相同的子部署和相同的目标配置。

----编辑后添加工件的Spring XML Configuration片段----

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:security="http://www.springframework.org/schema/security"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               http://www.springframework.org/schema/tx 
               http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
               http://www.springframework.org/schema/context
               http://www.springframework.org/schema/context/spring-context-3.0.xsd
               http://www.springframework.org/schema/security 
               http://www.springframework.org/schema/security/spring-security-3.0.xsd
               http://www.springframework.org/schema/lang 
               http://www.springframework.org/schema/lang/spring-lang-3.0.xsd">

    <context:component-scan base-package="com.company.service" />

    <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
            </props>
        </property>
    </bean>

    <!-- this is the Message Driven POJO (MDP) -->
    <bean id="messageListener" class="com.company.service.controller.ServiceJMSListener" />
    <!-- this is the message listener container -->
    <bean id="jmsContainer"
        class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="queueConnectionFactory" />
        <property name="destination" ref="inboundQueue" />
        <property name="messageListener" ref="messageListener" />
        <property name="concurrentConsumers" value="1" />
    </bean>
    <!-- JNDI Connection Factory -->
    <bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>SERVICE_QCF</value>
        </property>
    </bean>
    <!-- Queue to listen to -->
    <bean id="inboundQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>QUEUE_A</value>
        </property>
    </bean>

    <bean id="outboundQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>QUEUE_B</value>
        </property>
    </bean>

    <bean id="queueTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <ref bean="queueConnectionFactory" />
        </property>
        <property name="destinationResolver">
            <ref bean="jmsDestinationResolver" />
        </property>
    </bean>

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

</beans>

1 个答案:

答案 0 :(得分:1)

您是否可以查看正在运行的服务器中的JDNI树,以检查是否已创建队列,以及它绑定到哪个jndi名称?使用管理控制台实现此目的。

相关问题