在wildfly8中创建jms桥的问题
Posted
技术标签:
【中文标题】在wildfly8中创建jms桥的问题【英文标题】:Problems creating jms bridge in wildfly8 【发布时间】:2014-05-17 12:01:26 【问题描述】:我正在尝试创建从 WildFly 8 到 openmq 的 jms 桥。我尝试的每个示例都不起作用。有人能帮我吗。我以前从未创建过 jms 网桥。
standalone-full.xml 中的 jms-bridge 条目
<source>
<connection-factory name="jms/ConnectionFactory"/>
<destination name="jms/TestQueue"/>
<context>
<property key="java.naming.factory.initial" value="com.sun.enterprise.naming.SerialInitContextFactory"/>
<property key="java.naming.provider.url" value="mq://localhost:7676"/>
</context>
</source>
<target>
<connection-factory name="jmsConnectionFactory"/>
<destination name="/"jms/TestQueue"/>
</target>
<quality-of-service>AT_MOST_ONCE</quality-of-service>
<failure-retry-interval>500</failure-retry-interval>
<max-retries>1</max-retries>
<max-batch-size>500</max-batch-size>
<max-batch-time>500</max-batch-time>
<add-messageID-in-header>true</add-messageID-in-header>
</jms-bridge>
我从 imqjmsra.rar 创建了一个模块。
module.xml
<resource-root path="fscontext.jar"/>
<resource-root path="imqbroker.jar"/>
<resource-root path="imqjmsbridge.jar"/>
<resource-root path="imqjmsra.jar"/>
<resource-root path="imqjmx.jar"/>
<resource-root path="imqstomp.jar"/>
<!-- add the dependencies required by JMS Bridge code -->
<module name="javax.api" />
<module name="javax.jms.api" />
<module name="javax.transaction.api"/>
<module name="javax.resource.api"/>
我得到的错误是
2014-04-04 14:36:04,846 WARN [org.hornetq.jms.server] (pool-3-thread-1) HQ122010:无法连接 JMS 桥:javax.naming.NamingException:JBAS011843:实例化失败来自类加载器 ModuleClassLoader 的 InitialContextFactory com.sun.enterprise.naming.SerialInitContextFactory 来自本地模块加载器 @6b573f80 的模块“org.glassfish:main”(查找器:本地模块查找器 @2d0a238e(根:C:\Installs\JBoss\wildfly-8.0. 0.Final\modules,C:\Installs\JBoss\wildfly-8.0.0.Final\modules\system\layers\base)) [root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory from [来自本地模块加载器@6b573f80 的模块“org.glassfish:main”(查找器:本地模块查找器@2d0a238e(根目录:C:\Installs\JBoss\wildfly-8.0.0.Final\modules,C:\Installs\JBoss\ wildfly-8.0.0.Final\modules\system\layers\base))]]
at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:116)
at org.jboss.as.naming.InitialContext.init(InitialContext.java:99)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:153) [rt.jar:1.7.0_45]
at org.jboss.as.naming.InitialContext.<init>(InitialContext.java:90)
at org.jboss.as.naming.InitialContextFactory.getInitialContext(InitialContextFactory.java:44)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) [rt.jar:1.7.0_45]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) [rt.jar:1.7.0_45]
at javax.naming.InitialContext.init(InitialContext.java:242) [rt.jar:1.7.0_45]
at javax.naming.InitialContext.<init>(InitialContext.java:216) [rt.jar:1.7.0_45]
at org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:53)
at org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:38)
at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1217)
at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjectsWithRetry(JMSBridgeImpl.java:1457)
at org.hornetq.jms.bridge.impl.JMSBridgeImpl.access$2000(JMSBridgeImpl.java:76)
at org.hornetq.jms.bridge.impl.JMSBridgeImpl$FailureHandler.run(JMSBridgeImpl.java:2046)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
【问题讨论】:
【参考方案1】:我想通了。我需要将 module.xml 文件更改为
<module xmlns="urn:jboss:module:1.0" name="org.glassfish">
<resources>
<resource-root path="glassfish-embedded-all-3.1.1.jar"/>
</resources>
<dependencies>
<system export="true">
<paths>
<path name="sun/corba"/>
</paths>
</system>
<module name="javax.api" />
<module name="javax.jms.api" />
<module name="javax.transaction.api"/>
<module name="javax.resource.api"/>
<module name="javax.rmi.api"/>
</dependencies>
</module>
【讨论】:
以上是关于在wildfly8中创建jms桥的问题的主要内容,如果未能解决你的问题,请参考以下文章