如何从 Websphere 服务器连接到 Weblogic JMS?
我使用以下方法创建了一个小型独立客户端:
weblogic.jndi.WLInitialContextFactory
t3://weblogic-server:7001
jms.xyz.jmsXyzCf
jms/xyz/jmsXyzLogQueue
并且它运行完美。
当尝试从我的 websphere 服务器运行相同的代码时,我收到 NullPointerException
。我知道发生这种情况是因为我的类路径中没有 weblogic 类:
Caused by: java.lang.NullPointerException
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:235)
at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357)
at javax.naming.InitialContext.internalInit(InitialContext.java:295)
at javax.naming.InitialContext.(InitialContext.java:212)
当我尝试添加它们时,我收到一些“安全”错误
Current Java 2 Security policy reported a potential violation of Java 2 Security Permission.
java.security.AccessControlException: Access denied (java.lang.RuntimePermission exitVM.0)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:533)
at com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java:211)
at java.lang.SecurityManager.checkExit(SecurityManager.java:745)
at java.lang.Runtime.exit(Runtime.java:100)
at java.lang.System.exit(System.java:297)
作为最后一个资源,我尝试使用 websphere 自己的上下文工厂进行连接:com.ibm。 websphere.naming.WsnInitialContextFactory
但它当然会失败,因为它不理解 t3。
问题
如何从 Websphere 连接到 weblogic JMS?
I created a small standalone client using:
weblogic.jndi.WLInitialContextFactory
t3://weblogic-server:7001
jms.xyz.jmsXyzCf
jms/xyz/jmsXyzLogQueue
And it works flawlessly.
When a try to run the same code from my websphere server I get NullPointerException
. I understand this happens because I don't have weblogic classes in the classpath:
Caused by: java.lang.NullPointerException
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:235)
at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357)
at javax.naming.InitialContext.internalInit(InitialContext.java:295)
at javax.naming.InitialContext.(InitialContext.java:212)
When I try to add them I get some "Security" errors
Current Java 2 Security policy reported a potential violation of Java 2 Security Permission.
java.security.AccessControlException: Access denied (java.lang.RuntimePermission exitVM.0)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:533)
at com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java:211)
at java.lang.SecurityManager.checkExit(SecurityManager.java:745)
at java.lang.Runtime.exit(Runtime.java:100)
at java.lang.System.exit(System.java:297)
As last resource, I tried to connect using websphere own context factory: com.ibm.websphere.naming.WsnInitialContextFactory
but of course it fails because it doesn't understand t3.
Question
How can I connect to a weblogic JMS from Websphere?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

WebSphere 并不以其对使用第三方实现运行系统级功能(例如 JNDI)的友好性而闻名。最后,您必须使用WebSphere 的类(包括WebSphere 的InitialContextFactory 实现)。
在 WebSphere 下运行时,您不需要(实际上,不应该)显式指定 InitialContextFactory 实现; WebSphere 可以(并且应该)自行得出结论。
如果我理解正确的话,您正在尝试从 WebSphere 服务器进程内连接到 WebLogic JMS 管理对象。为此,我能想到的唯一方法是获取 WebLogic JMS 的实现类并将其添加为 JMS 提供程序,然后使用 JNDI 进行查找。不过,我很乐意接受纠正。
WebSphere isn't exactly known for its friendliness towards running system-level functionality (such as JNDI) using third party implementations. You will have to, at the end, use WebSphere's classes (including WebSphere's InitialContextFactory implementation).
When running under WebSphere, you don't need (and actually, shouldn't) explicitly specify the InitialContextFactory implementation; WebSphere can (and should) conclude it itself.
If I understand correctly, you're trying to connect to WebLogic JMS Administered Objects from within a WebSphere server process. The only way I can think of, to do that, would be to obtain WebLogic JMS's implementation classes and adding it as a JMS provider, then use JNDI to look it up. I'll be happy to stand corrected, though.