CreateQueue: This destination does not exist
thecrow Aug 10, 2004 5:35 AMHi, i get the following Errormessage:
rg.jboss.mq.SpyJMSException: Cannot get the Queue from the provider; - nested throwable: (javax.jms.JMSException: This destination does not exist !) at org.jboss.mq.SpyConnection.createQueue(SpyConnection.java:258) at org.jboss.mq.SpySession.createQueue(SpySession.java:783) at jms.Client1.setLogEntry(Client1.java:48) at jms.start.main(start.java:17) Caused by: javax.jms.JMSException: This destination does not exist ! at org.jboss.mq.server.JMSDestinationManager.createQueue(JMSDestinationManager.java:678) at org.jboss.mq.server.JMSServerInterceptorSupport.createQueue(JMSServerInterceptorSupport.java:149) at org.jboss.mq.server.TracingInterceptor.createQueue(TracingInterceptor.java:314) at org.jboss.mq.server.JMSServerInvoker.createQueue(JMSServerInvoker.java:149) at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:111) at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:356) at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748) at java.lang.Thread.run(Thread.java:534) Exception in thread "main"
after i hava run this code:
package jms; import java.util.Properties; import javax.jms.Message; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueReceiver; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; public class Client1 { private static final String QUEUE_CONNECTION_FACTORY="ConnectionFactory"; private static Queue queue = null; public static void main(String[] args) throws Exception { } public void setLogEntry(String msg, String name) throws Exception { log.info("Creating jndi context - alternatively use a jndi.properties"); Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); properties.put(Context.PROVIDER_URL, "localhost"); InitialContext ctx = new InitialContext(properties); log.info("Looking up connection factory"); QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("UIL2ConnectionFactory"); log.info("Creating connection"); QueueConnection qc = qcf.createQueueConnection(); try { log.info("Creating session"); QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); log.info("Creating Queue"); this.queue = qs.createQueue(name); log.info("Creating sender with Queue: "+name); QueueSender sender = qs.createSender(queue); log.info("Creating message"); TextMessage message = qs.createTextMessage(msg); log.info("Sending message"); sender.send(message); } finally { qc.close(); } } public String getLogEntry(String name) throws Exception { log.info("Creating jndi context - alternatively use a jndi.properties"); Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); properties.put(Context.PROVIDER_URL, "localhost"); InitialContext ctx = new InitialContext(properties); log.info("Looking up connection factory"); QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup( "UIL2ConnectionFactory"); log.info("Creating connection"); QueueConnection qc = qcf.createQueueConnection(); try { log.info("Creating session"); QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); log.info("Creating receiver"); QueueReceiver receiver = qs.createReceiver(this.queue); log.info("Try to receive message, it will not work"); Message received = receiver.receiveNoWait(); if (received != null) throw new RuntimeException( "Maybe you forget to clear the queue before running this test?"); log.info("You have to start the connection before receiving messages"); qc.start(); log.info("This receive will work"); received = receiver.receive(); log.info("Got message: " + received); return received.getStringProperty("text"); } finally { qc.close(); } } }
Where is my mistake ?
Thanks!