Glassfish3.1中openMq的调用
公司现在用Glassfish中集成的openMq作为消息中间件,我在Glassfish中配置好了,然后测试,异常为
javax.naming.CommunicationException: Failed to get registry service for URL: rmi://localhost:7676/ [Root exception is java.rmi.ConnectIOException: Failed to create connection; nested exception is:
org.exolab.jms.net.connector.ConnectException: Failed to lookup connection proxy, host=localhost, port=7676]
at org.exolab.jms.jndi.InitialContextFactory.getInitialContext(InitialContextFactory.java:146)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at QueueSend.main(QueueSend.java:18)
Caused by: java.rmi.ConnectIOException: Failed to create connection; nested exception is:
org.exolab.jms.net.connector.ConnectException: Failed to lookup connection proxy, host=localhost, port=7676
at org.exolab.jms.net.orb.Locator.getProxy(Locator.java:137)
at org.exolab.jms.net.orb.Locator.getRegistry(Locator.java:103)
at org.exolab.jms.net.orb.DefaultORB.getRegistry(DefaultORB.java:285)
at org.exolab.jms.client.net.SharedORB.getRegistry(SharedORB.java:121)
at org.exolab.jms.jndi.InitialContextFactory.getInitialContext(InitialContextFactory.java:144)
... 5 more
Caused by: org.exolab.jms.net.connector.ConnectException: Failed to lookup connection proxy, host=localhost, port=7676
at org.exolab.jms.net.rmi.RMIManagedConnection.<init>(RMIManagedConnection.java:160)
at org.exolab.jms.net.rmi.RMIManagedConnectionFactory.createManagedConnection(RMIManagedConnectionFactory.java:99)
at org.exolab.jms.net.connector.DefaultConnectionPool.createManagedConnection(DefaultConnectionPool.java:233)
at org.exolab.jms.net.connector.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:140)
at org.exolab.jms.net.connector.AbstractConnectionFactory.getConnection(AbstractConnectionFactory.java:167)
at org.exolab.jms.net.connector.AbstractConnectionManager.getConnection(AbstractConnectionManager.java:208)
at org.exolab.jms.net.orb.Locator.getProxy(Locator.java:131)
... 9 more
对应的抛异常的代码
//取得JNDI上下文和连接
Hashtable properties = new Hashtable();
properties.put(
Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.InitialContextFactory");
//openJms默认的端口是1099
properties.put(Context.PROVIDER_URL,
"rmi://localhost:1099/");
Context context = new InitialContext(properties);
之前自己单独做OpenJms没有什么问题,很正常,现在集成Glassfish中的OpenMq不行,默认端口改成7676也没有用,
高手帮帮忙,谢拉