users@glassfish.java.net

ORBInitial parameters are ignored when connecting to Glassfish EJB 3.0 from

From: <glassfish_at_javadesktop.org>
Date: Fri, 29 Jun 2007 06:40:42 PDT

ORBInitial parameters are ignored when connecting to Glassfish EJB 3.0 from standalone J2SE Application.

The code that I post here connects to a glassfish v.2 b52 localserver and to a glassfish v.2 b52 remoteserver and doesn't work. Any one can help me please?

What happends is that whatever happends with the first server hapends then with the second one. The bean I'm looking for is deployed in one of those two servers. So on one of them should find it and on the other not. The thing is that if it finds the bean in the first one then it finds on the second one and... if it doesn't finds the bean in the first one then it also doesn't finds the bean in the second one. I've tried this changing connection's order several times.

That makes me think that connection parameters are ignored.

This is the code

public class LookupTest
{
    private static InitialContext context;
    
    public static void main(String[] args)
    {
        Properties props;

        props = new Properties();
        props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
        props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
        props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
        props.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
        props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
        
        try
        {
            context = new InitialContext(props);
            HS_Remote remote = (HS_Remote) context.lookup("ejb/HelloService_Bean");
            System.out.println("BINGO 1");
        }
        catch (CommunicationException ex)
        { ex.printStackTrace(); }
        catch (NamingException ex)
        { ex.printStackTrace(); }
        
        props = new Properties();
        props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
        props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
        props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
        props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.168.2");
        props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
        
        try
        {
            context = new InitialContext(props);
            HS_Remote remote = (HS_Remote) context.lookup("ejb/HelloService_Bean");
            System.out.println("BINGO 2");
        }
        catch (CommunicationException ex)
        { ex.printStackTrace(); }
        catch (NamingException ex)
        { ex.printStackTrace(); }
    }
}
[Message sent by forum member 'xavier_ferret' (xavier_ferret)]

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