我正在尝试通过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应用程序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
。
经纪人已启动并正在运行。
任何人都可以引导我解决问题吗?