users@glassfish.java.net

Check Remote EJB is available

From: <glassfish_at_javadesktop.org>
Date: Mon, 15 Dec 2008 06:30:06 PST

I am trying to connect my application to multiple remote EJB's running on different Glassfish servers. These EJB's might or might not be up when my application tries to connect to them. If they are available then all is well, but if for ome reason either the remote server is down or the remote EJB is not available in the registry then my application hangs. My application connects at startup and since the lookup hangs the entire server fails to start.

I am connecting with the following code:

Properties properties = new Properties();
properties.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
properties.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
properties.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
properties.setProperty("org.omg.CORBA.ORBInitialHost", host);
properties.setProperty("org.omg.CORBA.ORBInitialPort", Integer.toString(port));
Context jndiContext = new InitialContext(properties);

Object remoteEJB = jndiContext.lookup(jndiName);


How do I fix or get around this?

Thanks
[Message sent by forum member 'cedricfranz' (cedricfranz)]

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