Hi all,
I'm newbie, u just use glassfish server. It seems very good when work with
netbean on local. But i can not lookup ejb when deploy enterprice app on
linux server with other ip . I used standalone application.
ejbclient code is below
/* * To change this template, choose Tools | Templates * and open the
template in the editor. */ package ejb.client; import java.util.Date; import
java.util.Hashtable; import java.util.Properties; import
javax.naming.Context; import javax.naming.InitialContext; import
javax.naming.NamingException; import org.bca.ejb.UserAccountRemote; /** * *
@author xuantoan2510 */ public class EjbClient { private static
UserAccountRemote myBean; /** * @param args the command line arguments */
public static void main(String[] args) { //EjbClient.testPool();
EjbClient.testEjb(); } public static void testEjb(){ try {
System.out.println(new Date()); //Context ctx = new InitialContext(); Context
ctx = EjbClient.getInitialContext(); System.out.println(new Date());
UserAccountRemote h =
(UserAccountRemote)ctx.lookup("org.bca.ejb.UserAccountRemote");
System.out.println(new Date() + h.toString()); System.out.println("ejb
results " + h.sayHello() + " " + new Date()); } catch (Exception e) {
e.printStackTrace(); } } private static Context getInitialContext() throws
NamingException { Properties 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", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.7.14");
//props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.1.10"); //
optional. Defaults to 3700. Only needed if target orb port is not 3700.
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); return new
InitialContext(props); } }
My app works well when i deploy ear file to glassfish run on Windows. But
when deploy on linux, ejbClient dont run, ejb lookup is hold.
I config orb-listener-1 with extend ip: 192.168.7.14.
Please, help me. Thanks
--
[Message sent by forum member 'xuantoan2510']
View Post: http://forums.java.net/node/788634