Hello:

        I  try jms  in  jboss 3.2.4 rc1 .

        I create  two  clients,one send and one receive  message.

the  sender is:

public class Sendtest {


public static void main(String[] args) {
    try {
           Object messaging = null;
            Hashtable hashTab = new Hashtable ();
            hashTab.put(Context.INITIAL_CONTEXT_FACTORY,
                "org.jnp.interfaces.NamingContextFactory");
            if (args.length>0)
         hashTab.put(Context.PROVIDER_URL,args[0]);
           else  hashTab.put(Context.PROVIDER_URL,"202.202.202.2:1099");
                
                
          InitialContext lContext = new InitialContext(hashTab);
                
          TopicConnectionFactory Tqcf=
              (TopicConnectionFactory)lContext.lookup("ConnectionFactory");
                        
          TopicConnection topicConnection =Tqcf.createTopicConnection();
          TopicSession session = topicConnection.createTopicSession(false,  
Session.CLIENT_ACKNOWLEDGE);            
          Topic weatherTopic = (Topic) lContext.lookup("topic/testTopic");
           topicConnection.start();

         TopicPublisher publisher =     session.createPublisher(weatherTopic);
         TextMessage message =  session.createTextMessage();
         message.setText("temperature: 35 degrees");
         publisher.publish(message);
        
         session.close();
         topicConnection.close();

                
        }
           catch( Exception e ){e.printStackTrace();    }       
    }
}

and the receiver is:

public class MyTopicSubscriber {

private static Object session;

public static void main(String[] args) {
   try {
          Object messaging = null;
          Hashtable hashTab = new Hashtable ();
          hashTab.put(Context.INITIAL_CONTEXT_FACTORY,
             "org.jnp.interfaces.NamingContextFactory");
          if (args.length>0)
           hashTab.put(Context.PROVIDER_URL,args[0]);
         else   hashTab.put  Context.PROVIDER_URL,"202.202.202.2:1099");
                
         InitialContext lContext = new InitialContext(hashTab);
                
         QueueConnectionFactory qcf=  
(QueueConnectionFactory)lContext.lookup("ConnectionFactory");
                    
          TopicConnectionFactory 
Tqcf=(TopicConnectionFactory)lContext.lookup("ConnectionFactory");
                        
          TopicConnection topicConnection =Tqcf.createTopicConnection("guest","guest");
         TopicSession session = topicConnection.createTopicSession(false, 
Session.CLIENT_ACKNOWLEDGE);      
         Topic weatherTopic = (Topic) lContext.lookup("topic/testTopic");

         TopicSubscriber  topicSubscriber = 
(TopicSubscriber) session.createSubscriber(weatherTopic);

         topicConnection.start();
 
         TextMessage message=  (TextMessage) topicSubscriber.receive();
         System.out.println(message.getText());
        
         session.close();
          topicConnection.close();
      } catch( Exception e ){e.printStackTrace();}      
     }
}


   the Sendtest.class  and MyTopicSubscriber.class   run succeed in local machine with 
the jboss server.

but when I run the Sendtest.class  and MyTopicSubscriber.class   on a  remote machine 
(202.202.202.3),the  Sendtest.class run succeed  and the MyTopicSubscriber.class   get 
an error:

org.jboss.mq.SpyJMSException: cannot authenticate user; -nseted  throwable:
(java.net.ConnectException:connection refused:connect)
.......

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3831523#3831523

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3831523


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to