[jboss-dev-forums] [JBoss Web Development] - Jboss Web Service
Haitham Safi
do-not-reply at jboss.com
Thu Mar 28 06:39:08 EDT 2013
Haitham Safi [https://community.jboss.org/people/haithamnor] created the discussion
"Jboss Web Service"
To view the discussion, visit: https://community.jboss.org/message/805246#805246
--------------------------------------------------------------
Hi everybody,,,
iI create a web service to send a message, for local queue on local PC (127.0.0.1) it is correcte but for remote queue (192.168.20.35) 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 {
try
{
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();
message.setText(msg);
connection.start();
producer.send(message);
body = message.getText();
session.close();
connection.close();
}
catch (Exception e)
{
return(e.toString());
}
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", "192.168.20.35:1099);
Context context = new InitialContext(prop);
return context;
}
}
So any idea or help? :(
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/805246#805246]
Start a new discussion in JBoss Web Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2112]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130328/9bdbb498/attachment.html
More information about the jboss-dev-forums
mailing list