我想要配置一个JMS服务器(OpenJMS)成弹簧的应用程序和时我指的是资源使用标记符号"jms/<我得到一个"名称"不能例外。

任何线索是什么丢失?

javax.naming.NameNotFoundException: Name jms is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:138)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:779)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:138)

豆定义为:

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jmsProvider"/>
    <property name="jndiName" value="jms/RefreshTopic_CF"/>
    <property name="resourceRef" value="true" />
</bean>

我JMS lib类中的路径和openjms服务器运行。

有帮助吗?

解决方案

在web.xml中我们不能参照的作为接口(的javax.jms.Topic)我们不得不使用的确切类。这与OpenJMS和不与WebSphere的问题。

<强>不允许:

<resource-ref id="ResourceRef_125180">
    <description>Topic</description>
    <res-ref-name>jms/MyTopic</res-ref-name>

    <res-type>javax.jms.Topic</res-type>

    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>        
</resource-ref>

<强>允许的:

<resource-ref id="ResourceRef_125180">
    <description>Topic</description>
    <res-ref-name>jms/MyTopic</res-ref-name>

    <res-type>org.exolab.jms.client.JmsTopic</res-type>

    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>        
</resource-ref>

其他提示

看来你要么

  • 没有配置OpenJMS使用相同的JNDI树弹簧看-看看 在这里,
  • 寻找错误的路径在JNDI。作为一种预感,删除"jms/"从jndiName.

在我来说,我不得不把资源即JMS / XXX从Tomcat的server.xml中移动到context.xml中,然后重新启动Tomcat的奏效了。

    **Create the file <webapp-root>/META-INF/context.xml**. 
here`Here is an example:
    <Context antiJARLocking="true">
        <Resource
            name="jms/ConnectionFactory"
            auth="Container"
            type="org.apache.activemq.ActiveMQConnectionFactory"
            description="JMS Connection Factory"
            factory="org.apache.activemq.jndi.JNDIReferenceFactory"
            brokerURL="tcp://localhost:61616"
            brokerName="LocalActiveMQBroker"
            useEmbeddedBroker="false"/>

        <Resource name="jms/topic/MyTopic"
            auth="Container"
            type="org.apache.activemq.command.ActiveMQTopic"
            factory="org.apache.activemq.jndi.JNDIReferenceFactory"
            physicalName="MY.TEST.FOO"/>
        <Resource name="jms/queue/MyQueue"
            auth="Container"
            type="org.apache.activemq.command.ActiveMQQueue"
            factory="org.apache.activemq.jndi.JNDIReferenceFactory"
            physicalName="MY.TEST.FOO.QUEUE"/>
    </Context>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top