我正在使用在我的子網(192.168.1.3:3700)中運行的GlassFish-3.1.2服務器。我已經部署了一個企業應用程序,其中包括一個我定義業務方法的EJB。現在我想從我的Java應用程序客戶端遠程訪問EJB。我該如何設置JNDI和。用於查找EJB的InitialContext對象?我如何需要定義屬性?順便說一句。我必須運行「asadmin enabled-secure-admin」才能使GlassFish服務器在LAN上工作。也許我還需要發送我的憑據與屬性?如何訪問遠程服務器上的EJB?
這裏是我當前的「解決方案」,這似乎是completley錯誤:
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.1.3");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ctx = new InitialContext(props);
TestentityFacadeRemote tfr = (TestentityFacadeRemote)ctx.lookup("java:global/TestEE/TestEE-ejb/TestentityFacadeRemote");
當我運行這個PROGRAMM,它只是等待無限......
任何幫助,不勝感激!
退房http://stackoverflow.com/a/3783501/1037626 - 有那裏描述了更多的屬性。用於'IIOP'查找的 – mgaert 2012-03-22 23:22:39