Bom dia a todos,
Seguinte, hoje tenho um client que abre N Threads que consumem SessionBeans Remotos do EJB. Para isso utilizo a classe abaixo. Mas o que acontece é que toda semana esse client pára de conectar ao EJB, ele parece perder a conexão e não estabelece sozinho, eu tenho que fechar e abrir o client. Eu estou conectando no EJB em modo stand-alone. Peço a ajuda de você, se existir outra forma de conectar ao EJB por favor me digam, ou se estou comendo bola em algum ponto também me digam. Detalhe, estou utilizando o GlassFish 2.1 como servidor. Muito obrigado por enquanto, abraços.
O arquivo com o a configuraçao JNDI:
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
#optional. Defaults to localhost. Only needed if web server is running
#on a different host than the appserver
org.omg.CORBA.ORBInitialHost = 127.0.0.1
#optional. Defaults to 3700. Only needed if target orb port is not 3700.
org.omg.CORBA.ORBInitialPort = 3700
E por fim a classe que faz o lookup:
package br.com.empresa.util;
import java.io.FileInputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
public class FactoryJNDI
{
private static Context getConnectionJNDI() throws Exception
{
Properties props = new Properties();
props.load(new FileInputStream("/app/jndiPosBrowser.properties"));
return new InitialContext(props);
}
public static Object getObjeto(String nomeClasse) throws Exception
{
Context ctx = getConnectionJNDI();
Object refObject = ctx.lookup(nomeClasse);
return refObject;
}
}