简体   繁体   中英

How do I connect to Weblogic JMS from Websphere server?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM