jboss5.1开发MessageDrivenBean时找不到QueueConnectionFactory

avax.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)

这个错误是因为在Jboss51下找不到QueueConnectionFactory。登陆jboss5.1的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)