jndi context :: 이름 jms이 컨텍스트에 묶여 있지 않습니다.
문제
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)를 참조 할 수 없었습니다. 정확한 클래스를 사용해야했습니다. 이것은 WebSphere가 아닌 OpenJMS의 문제였습니다.
허용되지 않음 :
<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>
다른 팁
당신도 보인다
- Spring이보고있는 동일한 JNDI 트리를 사용하도록 OpenJMS를 구성하지 않았습니다. 여기
- JNDI에서 잘못된 경로를 찾고 있습니다. 직감으로 Jndiname에서 "jms/"를 떨어 뜨립니다.
제 경우에는 Tomcat의 Server.xml에서 jms/xxx 자원을 컨텍스트.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>
제휴하지 않습니다 StackOverflow