1 Reply Latest reply on Sep 27, 2002 6:06 PM by Phil Clay

    java.net.ConnectionException when deleting a temp Q

    david Newbie

      i wrote a small test program to create and delete a temporary queue. at the point of deletion, a ConnectionException is thrown. is this a bug? below is my test and the System.out results.

      TEST CODE:
      ==================================
      import javax.naming.*;
      import javax.jms.*;
      import java.util.*;

      public class TempQ
      {
      public static void main (String[] args)
      throws Exception
      {
      QueueConnection conn1 = null;

      try
      {
      System.out.println("GET JNDI ROOT CONTEXT");
      Properties prop = new Properties();
      prop.put("java.naming.factory.initial",
      "org.jnp.interfaces.NamingContextFactory");
      prop.put("java.naming.provider.url",
      "jnp://localhost:1099");
      Context context = new InitialContext(prop);

      System.out.println("DO JNDI LOOKUP FOR QUEUE CONNECTION FACTORY");
      QueueConnectionFactory factory = (QueueConnectionFactory)
      context.lookup("java:/ConnectionFactory");

      System.out.println("CREATE A QUEUE CONNECTION");
      conn1 = factory.createQueueConnection();

      System.out.println("CREATE A QUEUE SESSION");
      QueueSession session1 =
      conn1.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      System.out.println("CREATE A TEMPORARY QUEUE");
      TemporaryQueue tempQueue = session1.createTemporaryQueue();

      System.out.println("DELETE THE TEMPORARY QUEUE");
      tempQueue.delete();

      System.out.println("END OF TEST");
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
      finally
      {
      if (conn1 != null)
      {
      conn1.close();
      }
      }
      }
      }

      OUTPUT:
      ==================================
      d:\temp\testing\jboss-jms>javac TempQ.java
      javac TempQ.java

      d:\temp\testing\jboss-jms>java TempQ
      java TempQ
      GET JNDI ROOT CONTEXT
      DO JNDI LOOKUP FOR QUEUE CONNECTION FACTORY
      CREATE A QUEUE CONNECTION
      CREATE A QUEUE SESSION
      CREATE A TEMPORARY QUEUE
      DELETE THE TEMPORARY QUEUE
      ERROR [main] (Logger.java:194) - Cannot connect to the ConnectionReceiver/Server
      java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
      at java.net.Socket.connect(Socket.java:425)
      at java.net.Socket.connect(Socket.java:375)
      at java.net.Socket.(Socket.java:290)
      at java.net.Socket.(Socket.java:146)
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175)
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.deleteTemporaryDestination(OILClientIL.java:97)
      at org.jboss.mq.SpyTemporaryQueue.delete(SpyTemporaryQueue.java:44)
      at TempQ.main(TempQ.java:37)
      org.jboss.mq.SpyJMSException: Cannot delete the TemporaryQueue
      at org.jboss.mq.SpyTemporaryQueue.delete(SpyTemporaryQueue.java:46)
      at TempQ.main(TempQ.java:37)
      linked exception is:
      java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:183)
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.deleteTemporaryDestination(OILClientIL.java:97)
      at org.jboss.mq.SpyTemporaryQueue.delete(SpyTemporaryQueue.java:44)
      at TempQ.main(TempQ.java:37)
      linked exception is:
      java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:183)
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.deleteTemporaryDestination(OILClientIL.java:97)
      at org.jboss.mq.SpyTemporaryQueue.delete(SpyTemporaryQueue.java:44)
      at TempQ.main(TempQ.java:37)

      d:\temp\testing\jboss-jms>