List of usage examples for javax.naming InitialContext InitialContext
public InitialContext() throws NamingException
From source file:com.wso2telco.refund.utils.DbUtils.java
/** * Initialize datasources./* w w w . j a v a 2 s . c o m*/ * * @throws SQLException the SQL exception * @throws DBUtilException the axata db util exception */ public static void initializeDatasources() throws SQLException, DBUtilException { if (Datasource != null) { return; } try { Context ctx = new InitialContext(); Datasource = (DataSource) ctx.lookup(DATA_SOURCE); } catch (NamingException e) { handleException("Error while looking up the data source: " + DATA_SOURCE, e); } }
From source file:org.osgpfoundation.osgp.webdemoapp.application.config.WebDemoInitializer.java
@Override public void onStartup(final ServletContext servletContext) throws ServletException { try {//ww w . j a va2 s.c om TimeZone.setDefault(TimeZone.getTimeZone("UTC")); final Context initialContext = new InitialContext(); final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(ApplicationContext.class); final ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING); servletContext.addListener(new ContextLoaderListener(rootContext)); } catch (final NamingException e) { throw new ServletException("naming exception", e); } }
From source file:br.ufac.sion.converter.VagaConverter.java
private VagaFacadeLocal lookupVagaFacadeLocal() { try {//from ww w .j a v a 2 s . com Context c = new InitialContext(); return (VagaFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/VagaFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }
From source file:com.google.gerrit.httpd.ReviewDbDataSourceProvider.java
private DataSource open() { final String dsName = "java:comp/env/jdbc/ReviewDb"; try {/*from w w w . j av a 2 s . co m*/ return (DataSource) new InitialContext().lookup(dsName); } catch (NamingException namingErr) { throw new ProvisionException("No DataSource " + dsName, namingErr); } }
From source file:br.ufac.sion.converter.GpConverter.java
private GrupoFacadeLocal lookupGrupoFacadeLocal() { try {/*from w w w .ja v a 2 s . c o m*/ Context c = new InitialContext(); return (GrupoFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/GrupoFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }
From source file:br.ufac.sion.converter.NivelConverter.java
private NivelFacadeLocal lookupNivelFacadeLocal() { try {//from w w w . jav a2s . co m Context c = new InitialContext(); return (NivelFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/NivelFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }
From source file:br.ufac.sion.converter.SetorConverter.java
private SetorFacadeLocal lookupSetorFacadeLocal() { try {/*from w ww . ja v a2 s. com*/ Context c = new InitialContext(); return (SetorFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/SetorFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }
From source file:br.ufac.sion.converter.CidadeConverter.java
private CidadeFacadeLocal lookupCidadeFacadeLocal() { try {/* w w w. j ava 2s . c o m*/ Context c = new InitialContext(); return (CidadeFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/CidadeFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }
From source file:br.ufac.sion.converter.EstadoConverter.java
private EstadoFacadeLocal lookupEstadoFacadeLocal() { try {/*w w w .ja v a2s . c o m*/ Context c = new InitialContext(); return (EstadoFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/EstadoFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }
From source file:br.ufac.sion.converter.EmpresaConverter.java
private EmpresaFacadeLocal lookupEmpresaFacadeLocal() { try {// ww w. j av a 2 s . c o m Context c = new InitialContext(); return (EmpresaFacadeLocal) c.lookup("java:global/sion-ear/sion-ejb-2.0/EmpresaFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }