users@glassfish.java.net

Re: N number of remote JMS clients = N number of application servers?

From: <glassfish_at_javadesktop.org>
Date: Wed, 23 Jan 2008 16:00:17 PST

Still doesn't work.

I changed the JMS service type to remote, restarted glassfish, and started the imqbrokerd. Verified JMS was ready with 'asadmin jms-ping' and returned successfully. I successfully connected the JMS client locally but once I moved the client to another box and tried to connect to Glassfish, it failed.

Code:
import javax.jms.*;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;

public class TestClient {

    public static void main(String[] args) throws Exception {
        
        Properties props = System.getProperties();
        props.setProperty("java.naming.provider.url", "iiop://localhost:3700");
        props.setProperty("java.naming.factory.initial", "com.sun.appserv.naming.S1ASCtxFactory");
        props.setProperty("com.sun.appserv.iiop.endpoints", "localhost:3700");
        props.setProperty("org.omg.CORBA.ORBSingletonClass", "com.sun.corba.ee.impl.orb.ORBSingleton");

        Context context = new InitialContext(props);
        ConnectionFactory factory = (ConnectionFactory)context.lookup("jms/ump/ConnectionFactory");
        Destination destination = (Destination)context.lookup("jms/ump/Topic");

        Connection connection = null;
        try {
            connection = factory.createConnection();
            connection.start();
            System.out.println("Test client is ready...");
        }
        finally {
            try {
                connection.close();
            }
            catch (JMSException jmse) {}
        }
    }
}
//////////////////////////////////////////
The above code works fine locally. If I move it to another box and change 'localhost' to the proper IP address, recompile, and run, it cannot connect. Am I missing another java property?

I captured the output and attached the file. Thanks for any help.

-pn42
[Message sent by forum member 'pnguyen42' (pnguyen42)]

http://forums.java.net/jive/thread.jspa?messageID=255493