can not receiver message from remote

Help
2005-04-20
2013-03-22
  • I start mom4j server in internet ,I receive message from local machine ,but it can get nothing .
    the errors is:

    C:\test\JMS\mom4j\src\test>java -classpath .;..\..\lib\jms.jar;..\..\lib\mom4j.jar Sender
    javax.jms.JMSException: unknown host:WUSETU_COM
            at org.mom4j.jms.ConnectionImpl.<init>(ConnectionImpl.java:99)
            at org.mom4j.jms.ConnectionFactoryImpl.createConnectionInternal(ConnectionFactoryImpl.java:59)
            at org.mom4j.jms.ConnectionFactoryImpl.createQueueConnection(ConnectionFactoryImpl.java:100)

    file source code:

    import java.util.Properties;

    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.jms.*;

    public class Receiver {

        public static void main(String[] args)
        {
            QueueConnection qc = null;
            try {
                Properties p = new Properties();
                p.put(Context.INITIAL_CONTEXT_FACTORY, "org.mom4j.jndi.InitialCtxFactory");
                p.put(Context.PROVIDER_URL, "xcp://211.151.89.24:8001");
                Context ctx = new InitialContext(p);
                QueueConnectionFactory qcf =
                    (QueueConnectionFactory)ctx.lookup("QueueConnectionFactory");
                Queue queue = (Queue)ctx.lookup("testQueue");
                qc = qcf.createQueueConnection("system", "system");
                QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                QueueReceiver qr = qs.createReceiver(queue);
                TextMessage tm = (TextMessage)qr.receiveNoWait();
                if(tm != null) {
                    System.out.println("got text message: " + tm.getText());
                    System.out.println("string property: " + tm.getStringProperty("string"));
                    System.out.println("int property: " + tm.getIntProperty("int"));
                    System.out.println("float property: " + tm.getFloatProperty("float"));
                    System.out.println("long property: " + tm.getLongProperty("long"));
                } else {
                    System.out.println("got nothing");
                }
                qr.close();
                qs.close();
            } catch(Exception ex) {
                ex.printStackTrace();
            } finally {
                if(qc != null) {
                    try {
                        qc.close();
                    } catch(Exception ex) { }
                }
            }
        }

    }

    thanks any help!