gpt4 book ai didi

java - JNDI Context::Name jms 未绑定(bind)在此上下文中

转载 作者:行者123 更新时间:2023-11-30 06:00:27 24 4
gpt4 key购买 nike

我正在尝试将 JMS 服务器 (OpenJMS) 配置到 Spring 应用程序中,当我使用符号“jms/<>”引用资源时,出现“名称”未绑定(bind)异常。

知道缺少什么吗?

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 定义为:

<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 库,并且 openjms 服务器正在运行。

最佳答案

在 web.xml 中,我们无法将其引用为接口(interface) (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>

关于java - JNDI Context::Name jms 未绑定(bind)在此上下文中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1293453/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com