I was writing a JMS app and found that we specify the provider url having the
port as 1098 the lookup call get stuck and never returns whereas it should
throw some kind of exception.
I will appreciate if somebody can tell if its a bug in the JBOSS or am I
missing something. I am attaching a sample code with which the behavior can be
reproduced.
|
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
| import javax.jms.*;
| import java.util.Hashtable;
|
| public class TestMessagePublisher {
| public static void main(String[] args) {
| String initialContextFactory =
"org.jnp.interfaces.NamingContextFactory";
| String providerUrl = "jnp://10.10.10.121:1098";
| String namingUrlPackage = "org.jboss.naming:org.jnp.interfaces";
| String topicName = "queue/A";
| Hashtable<String, String> env = new Hashtable<String, String>();
| env.put("java.naming.factory.initial", initialContextFactory);
| env.put("java.naming.provider.url", providerUrl);
| env.put("java.naming.factory.url.pkgs", namingUrlPackage);
| Context cntxt = null;
| try {
| cntxt = new InitialContext(env);
| ConnectionFactory factory = (ConnectionFactory)
cntxt.lookup("TopicConnectionFactory");
| Destination topic = (Destination) cntxt.lookup(topicName);
| javax.jms.Connection conxn= (Connection)
factory.createConnection();
| Session session = conxn.createSession(false,
Session.AUTO_ACKNOWLEDGE);
| MessageProducer producer = session.createProducer(topic);
| TextMessage msg = session.createTextMessage();
| msg.setText("Hello this is published by Manoj test util");
| conxn.start();
| producer.send(msg);
| } catch (NamingException e) {
| e.printStackTrace(); //To change body of catch statement use
File | Settings | File Templates.
| } catch(JMSException e) {
| e.printStackTrace(); //To change body of catch statement use
File | Settings | File Templates.
| }
| }
|
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100821#4100821
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100821
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user