0 Replies Latest reply on Mar 15, 2013 4:40 AM by thangavel_14

    Issue with connecting JMS Client in JBoss AS7...

    thangavel_14

      Hi Techies,

       

                  I have created a simple MDB JMS Queue in JBoss AS7. My MDB code looks as below,

       

      <code>

       

      @MessageDriven(activationConfig = {

              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "/jms/SiebelQueue") })

       

       

      public class SiebelMessageListener implements MessageListener {

       

          private static Logger logger = Logger.getLogger(SiebelMessageListener.class);

       

          public void onMessage(Message message) {

              try {

                  if (message instanceof TextMessage) {

                      System.out.println("Queue: I received a TextMessage from  Siebel CRM at"+ new Date());

                      TextMessage msg = (TextMessage) message;

                      System.out.println("Message is : " + msg.getText());

                  } else

                      System.out.println("Not a valid message for this Queue MDB from  Siebel CRM");

       

              } catch (JMSException e) {

                  System.out.println("Exception is in JMS Queue");

              }

          }

      }

       

      </code>

       

      I have create this file as jms.jar and add in application.xml file as ejb module such as,

       

      <code>

       

      <application>

          <display-name>jms-mdb</display-name>

          <module>

              <ejb>jms.jar</ejb>

          </module>

      </application>

       

      </code>

       

      Then i have added depedency jar file,

       

      ejb-api-3.0.jar

      jms-api-1.1-rev-1.jar

      log4j-1.2.15.jar

       

      Created as EAR file and deployed in JBoss AS7 sucessfully and JNDI Queue name "/jms/SiebelQueue" as well in domain.xml, standalone.xml and standalone-full.xml.

       

      I am starting the server using domain.bat so these Queue names are picking from the domain.xml file.

       

      I have a standalone client code as below,

       

      <code>

       

      public class QueueSender {

       

          public final static String JNDI_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";

          // *************** Connection Factory JNDI name *************************

          public final static String JMS_FACTORY = "jms/RemoteConnectionFactory";

          // *************** Queue Factory JNDI name *************************

          public final static String QUEUE = "/jms/SiebelQueue";

       

          private QueueConnectionFactory qconFactory;

          private QueueConnection qcon;

          private QueueSession qsession;

          private QueueSender qsender;

          private Queue queue;

          private TextMessage msg;

       

          public void init(Context ctx, String queueName) throws NamingException,    JMSException {

              qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);

              // *************** Creating Queue Connection using the UserName &

              // Password *************************

              qcon = qconFactory.createQueueConnection("abc123", "abc@123"); //  This application user name created by add-user.bat

              qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

              queue = (Queue) ctx.lookup(queueName);

              qsender = (QueueSender) qsession.createSender(queue);

              msg = qsession.createTextMessage();

              qcon.start();

          }

       

          public void close() throws JMSException {

              qsender.close();

              qsession.close();

              qcon.close();

          }

       

          public void send(String message) throws JMSException {

              qsender.send(message);

          }

          public static void main(String[] args) throws Exception {

              // *************** Queue Factory JNDI name *************************

              InitialContext context = ClientUtility.getInitialContext("remote://localhost:4447");

              QueueSender queueSender = new QueueSender();

              queueSender.init(context, QUEUE);

              queueSender.send("Hellow world !!");

              queueSender.close();

          }

      }

       

      </code>

       

      I have added jboss-client-7.1.0.Final.jar file in my class path and set user roles in domain.xml file as well.

       

      I'm getting the below exception in server log while running my client program,

       

      <error>

       

      13:58:50,342 INFO  [org.jboss.as.naming] (Remoting "master:server-one" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 5532f070 (inbound) of Remoting connection 00a70122 to /127.0.0.1:64930

      14:00:52,085 WARN  [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] (hornetq-failure-check-thread) Connection failure has been detected: Did not receive data from /127.0.0.1:64931. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=3]

       

      </error>

       

       

      I have Googled and tried not able to resolve this issue. Could you please help me on this.?

       

      If you have any reference or sample program please send me. My Publisher and Subscriber will be running different server.

       

       

      --

      Thanks,

       

      Thangavel L Nathan.