日期:2014-05-16  浏览次数:20532 次

带你走进EJB--MDB的NameNotFoundException


    在上一篇文章中我们对MDB用一个实例进行了了解,在实例的过程中出现了这样的一个异常.服务器和客户端的异常分别如下.

Jboss端的错误提示:

	19:38:19,749 INFO  [JmsActivation] Attempting to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@ed8545(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1b7c40 destination=topic/mytopic destinationType=javax.jms.Topic tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
	19:38:19,752 ERROR [JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@ed8545(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1b7c40 destination=topic/mytopic destinationType=javax.jms.Topic tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
	javax.naming.NameNotFoundException: mytopic 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 org.jnp.server.NamingServer.lookup(NamingServer.java:399)
		at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
		at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
		at javax.naming.InitialContext.lookup(InitialContext.java:411)
		at org.jboss.util.naming.Util.lookup(Util.java:222)
		at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:464)
		at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:352)
		at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:292)
		at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:733)
		at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
		at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
		at java.lang.Thread.run(Thread.java:722)

客户端的错误提示.

	Exception in thread "main" javax.naming.NameNotFoundException: mytopic 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 org.jnp.server.NamingServer.lookup(NamingServer.java:399)
		at sun.reflect