---
title: "javax.naming.NameNotFoundException: QueueConnectionFactory not bound"
author: "soon13"
date: "2009-08-20T15:25:51Z"
tags: []
slug: "javax-naming-namenotfoundexception-queueconnectionfactory-not-bound"
draft: false
lastmod: "2009-08-20T16:36:09Z"
id: 453667
url: "https://soon13.iteye.com/blog/453667"
---

<span style="color:red">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)</span>

产生这个错误，主要是因为在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");