4 Replies Latest reply on Apr 13, 2005 5:01 PM by darranl

    javax.naming.NameNotFoundException: UIL2ConnectionFactory no

    k_s_ashok

      I tried one simple Queue program.(mentioned at the botom)
      I am getting the follwing exception
      *****************************************************
      javax.naming.NameNotFoundException: UIL2ConnectionFactory not bound
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:240)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:117)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
      at javax.naming.InitialContext.lookup(InitialContext.java:345)
      at SimpleSender.(SimpleSender.java:39)
      at SimpleSender.main(SimpleSender.java:23)

      *******************************************************
      QueueConnectionFactory myQConnFactory;
      Queue myQueue;

      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");

      Context ctx = new InitialContext(properties);

      myQConnFactory = (QueueConnectionFactory)ctx.lookup
      ("UIL2ConnectionFactory");
      myQueue = (Queue) ctx.lookup("queue/testQueue");

      ctx.bind ("SimpleSender", myQueue);

      QueueConnection con = myQConnFactory.createQueueConnection();
      QueueSession session = con.createQueueSession(false,
      Session.AUTO_ACKNOWLEDGE);
      TextMessage textMessage = session.createTextMessage();
      QueueSender sender = session.createSender(myQueue);
      con.start();

      for (int i=0; i<10; i++) {
      textMessage.setText("Hello World #" + i);
      sender.send(textMessage);
      }