2013-07-23 17 views
0

有沒有一種方法來定位特定的glassfish服務器實例並打開在該服務器上部署的模塊?也就是說,無論該模塊是否部署在同一集羣中的其他服務器上。如何定位特定的glassfish服務器

謝謝大家提前!

回答

0

如果有人在將來想要一個答案,我用這個,我發現here

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"); 

// Defaults to localhost. 
props.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1"); 
// Defaults to 3700. 
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); 

InitialContext ic = new InitialContext(props); 
RemoteBean beanInstance = (RemoteBean) ic.lookup("java:global/ExampleEJB/RemoteBean!com.example.RemoteBean");