2008-11-16 19 views

Respuesta

19

Ok ... Lo encontré yo mismo. :)

Aquí está el código que utilicé para conectarme a EJB remoto desde el cliente ligero.

Hashtable env = new Hashtable(5); 
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); 
//Assuming weblogic server is running on localhost at port 7001 
env.put(Context.PROVIDER_URL, "t3://localhost:7001"); 

Context ic = new InitialContext(env); 

//obtain a reference to the home or local home interface 
FooHome fooHome = (FooHome)ic.lookup("MyBeans/FooHome"); 

//Get a reference to an object that implements the beans remote (component) interface 
Foo foo = fooHome.create(); 

//call the service exposed by the bean 
foo.shoutFoo() 

Y me funcionó.

+7

Debe aceptar su propia respuesta si esto es lo que funcionó para usted. –

+0

Si usa un 'weblogic.jndi.WLInitialContextFactory'it significa que debe llamar a su EJB solo desde un cliente que esté tomando algunas bibliotecas de weblogic, que probablemente no sea tan delgada. –

+0

debe cerrar el contexto inicial en un bloque final – mnp

Cuestiones relacionadas