Java examples for JNDI:Context
get Entity Service
import javax.naming.InitialContext; import javax.naming.NamingException; public class Main{ public static EntityService getEntityService() { InitialContext initialContext; try {//w ww.ja va 2s .c o m initialContext = new InitialContext(); EntityService es = (EntityService) initialContext .lookup("java:comp/env/EntityService"); initialContext.close(); return es; } catch (NamingException e) { System.err .println("Naming Exception in AccessHelper.getEntityService"); e.printStackTrace(); return null; } } }