2 Replies Latest reply on Feb 15, 2008 8:58 PM by jaya_srini

    JMS communication between Tomcat app and JBOSS AS 4.2.2`

    jaya_srini

      Hello

      Apologies is advance if this has been asked before.

      I have a tomcat app that needs to send and recieve JMS messages with the JBOSS App Server (4.2.2 with JBOSS messaging) which is my JMS provider. I was wondering what changes I need to make on the Tomcat side to achieve this? I basically need to pass the followig JNDI properties so that I can access the JBOSS connection factory from within TOmcat

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://10.195.4.123:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      If there is a link that explains this or if someone can tell what changes need to be done to tomcat context.xml or server.xml , that would be really
      helpful!

      thank you
      jaya

        • 1. Re: JMS communication between Tomcat app and JBOSS AS 4.2.2`

          Hi,

          I have recieved messages on my tomcat application.Following is the code

          Properties props = new Properties();
           props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
           props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
           props.setProperty("java.naming.provider.url", "jnp://localhost:1099");
          
           Context context = new InitialContext(props);
          
           TopicConnectionFactory tcf = (TopicConnectionFactory) context.lookup("TopicConnectionFactory");;
           conn = tcf.createTopicConnection();
           topic = (Topic) context.lookup("topic/testTopic");
          
           session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
           conn.start();
          
           TopicSubscriber recv = session.createSubscriber(topic);
           recv.setMessageListener(this);


          For listening messages i have placed the following jars in commom/lib
          jbossall-client.jar and jnp-client.jar.
          My application is able to recieve messages from Jboss JMS.

          Hope this helps you.

          • 2. Re: JMS communication between Tomcat app and JBOSS AS 4.2.2`
            jaya_srini

            thank you very much!!

            jaya