javax.naming.NameNotFoundException: QueueConnectionFactory not bound

javax.naming.NameNotFoundException: QueueConnectionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)


产生这个错误,主要是因为在Jboss5.0下找不到QueueConnectionFactory/TopicConnectionFactory。登陆http://localhost:8090/jmx-console/,在jboss/service=JNDIView/list/Global JNDI Namespace下查找,只有ConnectionFactory!

因此解决办法有了,把发送消息的java类中的QueueConnectionFactory修改一下即可,如下:
QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("QueueConnectionFactory");
改为-->
QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");



你可能感兴趣的:(java,jboss,sun)