CORBA lookup on a LAN hangs

582 views Asked by At

Is there any specific Glassfish configuration required to allow remote CORBA lookup across a LAN? Or, does, perhaps, the routers firewall need configuration?

How do I troubleshoot this connection?

The CORBA lookup client just hangs:

BUILD SUCCESSFUL
Total time: 3 seconds
Nov 22, 2014 3:45:26 AM aggregatorclient.AggregatorClient remoteEJB
WARNING: {org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, Context.SECURITY_CREDENTIALS=pass123, org.omg.CORBA.ORBInitialHost=192.168.0.119, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, Context.SECURITY_PRINCIPAL=user1}

When run from localhost (ie, from localhost, connecting to localhost), with everything on the same computer, the connection works fine.

The CORBA connection lookup parameters, in jndi.properties:

java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
Context.SECURITY_PRINCIPAL=user1
Context.SECURITY_CREDENTIALS=pass123
org.omg.CORBA.ORBInitialHost=192.168.0.119
org.omg.CORBA.ORBInitialPort=3700

the connecting clients code:

package aggregatorclient;

import dur.ejb.AnswerSessionBeanRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class AggregatorClient {

    private static final Logger log = Logger.getLogger(AggregatorClient.class.getName());

    public static void main(String[] args) {
        try {
            new AggregatorClient().remoteEJB();
        } catch (NamingException ex) {
            Logger.getLogger(AggregatorClient.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void remoteEJB() throws NamingException {
        Context ctx = new InitialContext();
        log.warning(ctx.getEnvironment().toString());
        Object obj = ctx.lookup("dur.ejb.AnswerSessionBeanRemote");
        AnswerSessionBeanRemote asbr = (AnswerSessionBeanRemote) obj;
        log.info("answer\t" + asbr.lifeTheUniverseAndEverything());
    }

}

The client is executed with Glassfish appclient.

1

There are 1 answers

0
mmuller On

Been having the same "hanging forever" lookup behavior with a standalone ejb client running on a remote host. It turned out to be related to the server host's ability to resolve its own hostname into its own non-loopback address. I resolved it by adding / fixing an entry in /etc/hosts:

10.0.10.102    my-server-hostname

I checked that the server could actually resolve the right ip address with hostname -i :

$ hostname -i
10.0.10.102

After restarting GlassFish, remote lookup and call to EJB worked like a charm!

Explanation

I found this solution after sniffing the traffic between my client and server. The underlying protocol is GIOP (had never heard of it).

When executing the remote lookup, my client's request was actually able to reach GlassFish. But the server replied with a misleading "Location Forward" response, indicating 127.0.1.1 as a IIOP:Profile_host. 127.0.1.1 was the loopback ip address that my server's hostname resolved to before I fixed the /etc/hosts.