tomcat - 尝试使用 JNDI 获取 OpenMQ 连接工厂时出现 NameNotFoundException
问题描述
我正在尝试通过 JNDI 将 OpenMQ 5.0 与 Tomcat 一起使用。以下是我在 Tomcat 中所做的配置。
server.xml
:
<Resource name="jms/sampleFactory"
auth="Container"
type="com.sun.messaging.QueueConnectionFactory"
description="OpenMQ Queue Connection Factory"
factory="com.sun.messaging.naming.QCFObjectFactory"
securityPort="7676"
parm="--"
subnet="0"
host="-s localhost"
ackTimeout="-t 30000"
version="1.1" />
<Resource name="jms/sampleQueue"
auth="Container"
type="com.sun.messaging.Queue"
description="OpenMQ Queue"
factory="com.sun.messaging.naming.QObjectFactory"
destName="sampleQueue"
version="1.1" />
context.xml
:
<Context>
<ResourceLink global="jms/sampleFactory" name="jms/sampleFactory"
type="javax.jms.ConnectionFactory"/>
<ResourceLink global="jms/sampleQueue" name="jms/sampleQueue"
type="javax.jms.Queue"/>
</Context>
网络应用web.xml
:
<resource-ref>
<res-ref-name>jms/sampleFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>jms/sampleQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
现在,当我尝试这样做时,initialContext.lookup("java:/comp/env/jms/sampleFactory")
它会抛出NameNotFoundException
。
代理已启动并正在运行。
谁能指导我可能是什么问题?
解决方案
推荐阅读
- python - 无法连接到在 AWS Ubuntu EC2 上运行的 django 应用程序
- syncfusion - 打开 ZIP 文件时出现 Zip 异常错误的 CRC 值 - Syncfusion
- azure-devops - 在推送之前测试 devops 管道中的 Nuget 包版本冲突
- google-maps - Google 地方信息自动完成 - 类型:地理编码、地址、机构 - 无法正常工作
- javascript - 画布描边和填充颜色
- groovy - 无法使用 Groovy 将 java 代码从 Eclipse 运行到 Jmeter
- javascript - Cognito 用户池“用户名”显示为 id 而不是电子邮件,如何解决?
- .net-core - 任何将 STEP 文件转换为 glTF 文件格式的开源库?
- microsoft-graph-api - 通过 Graph API 检索嵌套分发列表的邮件地址
- c# - 如何构造数据模型以绑定到具有 XML 列的 SQL 表