3 Replies Latest reply on Nov 4, 2003 5:02 PM by Adrian Brock

    Configuring JMS with jboss-3.2.1_tomcat-4.1.24

    sajiv narayanan kartha Newbie

      Hi everybody,

      I need to know how to configure jboss-3.2.1_tomcat-4.1.24 with JMS. I have been going through the forum for the past 3 days trying to figure out for any step-by step instruction to do this.. There are quite a few answers that are applicable to earlier versions of jboss.

      There is a folder jms in the server\default\server\deploy directory. This consists of 3 xml files. Now what do I do with them. I tried to run some sample programs. but ran into problems stating that ...

      javax.naming.NameNotFoundException: ConnectionFactory not bound. This is the same answer that I get for whatever program I run.....
      Is there anything wrong with the Connection Factory ?? How do I know what is to be done ??

      Here's the sample code that I wanted to run....

      import javax.jms.*;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.naming.Context;
      import java.util.*;


      public class TestSender {

      public static void main(String args[])
      {
      Context ctx=null;
      Hashtable ht=new Hashtable();
      QueueConnectionFactory qConnectionFactory=null;
      QueueConnection qConnection=null;
      QueueSession qSession=null;
      QueueSender qSender=null;
      Queue q=null;
      TextMessage textMsg=null;
      String msg;

      try{

      ht.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      ht.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      ht.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      ctx = new InitialContext(ht);

      qConnectionFactory=(QueueConnectionFactory)ctx.lookup("java:/ConnectionFactory");
      qConnection=qConnectionFactory.createQueueConnection();
      qSession=qConnection.createQueueSession(false, javax.jms.QueueSession.AUTO_ACKNOWLEDGE);
      q=(Queue)ctx.lookup("acculeonQueue");
      qSender=qSession.createSender(q);
      System.out.println("Sending messages........");
      textMsg=qSession.createTextMessage();
      for(int i=1;i<=5;i++)
      {
      msg="Message # "+i;
      textMsg.setText(msg);
      System.out.println("Sending messages..."+msg);
      qSender.send(textMsg);
      }
      msg="Stop";
      textMsg.clearBody();
      textMsg.setText(msg);
      qSender.send(textMsg);


      }catch(Exception e)
      {
      e.printStackTrace();
      }
      finally{
      try{
      qSender.close();
      qSession.close();
      qConnection.close();
      }catch(Exception e)
      {
      e.printStackTrace();
      }


      }

      }

      }


      I keep reading the forum where in there are lots of suggestions, but nothing specific to this error.

      Can anyone throw some light.... I need answers very badly, as this is supposed to

      luv,
      Sajiv, India.