0 Replies Latest reply on Apr 1, 2013 7:39 AM by Haitham Safi

    JNDI Remote Queue over web service

    Haitham Safi Newbie

      Hi everybody,,,

      iI create a web service to send a message, for local queue on local PC ( it is correcte  but  for remote queue ( as same queue name on remote PC return < D queue not bound> Error :

      i used jboss 4.2.3 + axis2 + with eclipse

      Same configuration for queue and username,password on local and remote machines.


      package edu;

      import java.io.IOException;
      import java.net.URISyntaxException;


      import java.util.Properties;

      import javax.jms.Connection;
      import javax.jms.ConnectionFactory;
      import javax.jms.JMSException;
      import javax.jms.MessageProducer;
      import javax.jms.Session;
      import javax.jms.TextMessage;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.servlet.ServletException;


      public class MessageWS
      String body = "";
      public String Send_Messages(String msg) throws ServletException, IOException, URISyntaxException {
           Context init =MessageWS.getInitialContext();
           javax.jms.Queue destination =        (javax.jms.Queue) init.lookup("queue/D");

                ConnectionFactory connectionFactory =   (ConnectionFactory) init.lookup("ConnectionFactory");
                Connection connection = connectionFactory.createConnection("jone","pas123");//
                Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                MessageProducer producer = session.createProducer(destination);
                Date date =new Date();
                TextMessage message = session.createTextMessage();


                body = message.getText();

          catch (Exception e)

      return body    ;


      public static Context getInitialContext () throws JMSException,NamingException
        Properties prop = new Properties();
           prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
        prop.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
        prop.setProperty("java.naming.provider.url", ";

        Context context = new InitialContext(prop);
        return context;

           i execute the code in side JAVA Application it was workini correct, but Through web service i got an error

      So any idea or help?