Skip to content

Instantly share code, notes, and snippets.

@ricardojob
Last active June 22, 2018 05:42
Show Gist options
  • Save ricardojob/33606ef255ca9e56d9aa0e5be5048d64 to your computer and use it in GitHub Desktop.
Save ricardojob/33606ef255ca9e56d9aa0e5be5048d64 to your computer and use it in GitHub Desktop.
private static final String SERVICE_INTEGRANTE = "java:global/core/ServiceDeIntegrante";
public Service lookup() {
try {
Properties properties = new Properties();
properties.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");
properties.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
properties.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
Context context = new InitialContext(properties);
return (Service) context.lookup(SERVICE_INTEGRANTE);
} catch (NamingException ex) {
Logger.getLogger(ServiceLocator.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment