users@glassfish.java.net

Re: InitialContext question

From: Mahesh Kannan <Mahesh.Kannan_at_Sun.COM>
Date: Mon, 09 Jul 2007 07:59:17 -0700

You need to bootstrap the InitialContext with the correct values to
point to the two servers.

Properties props1 = new Properties();
props1.setProperty("java.naming.factory.initial",
                               
"com.sun.enterprise.naming.SerialInitContextFactory");
props1.setProperty("org.omg.CORBA.ORBInitialHost", host1);
props1.setProperty("org.omg.CORBA.ORBInitialPort", port1); //Default
3700
InitialContext ctx1 = new InitialContext(props1);

Properties props2 = new Properties();
props2.setProperty("java.naming.factory.initial",
                               
"com.sun.enterprise.naming.SerialInitContextFactory");
props2.setProperty("org.omg.CORBA.ORBInitialHost", host2);
props2.setProperty("org.omg.CORBA.ORBInitialPort", port2); //Default
3700
InitialContext ctx2 = new InitialContext(props2);

You can use ctx1 and ctx2 respectively to lookup EJBs from the two
servers.

--Mahesh

On Jul 9, 2007, at 3:44 AM, glassfish_at_javadesktop.org wrote:

> Hi:
> I've tried several codes in order to connect to two servers at the
> same time and I've not been able to get it
>
> Anyone knows if is it possible to connect to two EJB servers at the
> same time.
>
> 1 InitialContext for server 1 and
> 1 InitialContext for server 2.
>
> And work with both of them at the same time!
>
> Any sample code?????
>
> Thanks is advance.
> [Message sent by forum member 'xavier_ferret' (xavier_ferret)]
>
> http://forums.java.net/jive/thread.jspa?messageID=225694
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>