3 Replies Latest reply on Dec 17, 2004 11:59 AM by Adrian Brock

    Configuration of JMS on JBoss

    Jagdish Mane Newbie

      Hi,

      We are having the following error when we try to communicate to Jboss 4.0 via JNDI. Here is my code. Can anybody help me out with this ?
      public SimpleSender() {

      try {

      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.jboss.naming:org.jnp.interfaces");
      properties.put(Context.PROVIDER_URL,"jnp://localhost:1099");
      Context ctx = new InitialContext(properties);
      myQConnFactory = (QueueConnectionFactory) ctx.lookup("java:/ConnectionFactory");
      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);
      }
      con.close();
      ctx.close();
      } catch(Exception ex) {
      ex.printStackTrace() ;
      }
      }

      Is there anything that I missing out.

      Jagdish