public class UseInitialContext { public UseInitialContext() { try { InitialContext ic = new InitialContext(); Object myObject = ic.lookup("myObject"); System.out.println(myObject); } catch (NamingException e) { e.printStackTrace(); } } }
try { doSimpleBind(args[0], args[1], args[2]); } catch (NamingException e) { e.printStackTrace(); }
/** * Prints the stack trace, preferring the root cause if it exists. */ public void printStackTrace(PrintStream os) { if (_rootCause != null) _rootCause.printStackTrace(os); else super.printStackTrace(os); }
/** * Prints the stack trace, preferring the root cause if it exists. */ public void printStackTrace(PrintWriter os) { if (_rootCause != null) _rootCause.printStackTrace(os); else super.printStackTrace(os); }
public static final void closeQuietly(Context ctx){ if(ctx != null){ try{ ctx.close(); }catch(NamingException ne){// do-nothing ne.printStackTrace(); } } } }
/** * Prints the stack trace, preferring the root cause if it exists. */ public void printStackTrace() { if (_rootCause != null) _rootCause.printStackTrace(); else super.printStackTrace(); }
Object lookedUp = null; try { InitialContext initialContext = new InitialContext(); lookedUp = initialContext.lookup("java:/comp/env/testEnvEntry"); } catch (NamingException e) { e.printStackTrace(); }
//TEST Object l_test = null; try { Context l_ctx = new InitialContext(); l_test = l_ctx.lookup("java:comp/env/DocStorageLocation"); } catch (NamingException e1) { // TODO e1.printStackTrace(); }
public LogConsequence() { Context ctx = null; try { ctx = new InitialContext(); logInterfaceRules = (LogInterfaceRulesRemote) ctx.lookup("log_interface"); } catch (NamingException e) { e.printStackTrace(); } }
public class BeanHelper { public static BeanManager getBeanManager() { try { InitialContext initialContext = new InitialContext(); return (BeanManager) initialContext.lookup("java:comp/BeanManager"); } catch (NamingException e) { e.printStackTrace(); return null; } }
myfirstpackage.ejb3.TriggerManually triggerManually; try { InitialContext ctx = new InitialContext(props); triggerManually = (myfirstpackage.ejb3.TriggerManually) ctx.lookup("myjdniname"); triggerManually.resetTasks(); } catch (NamingException e) { e.printStackTrace(); }
Context context; try { context = new InitialContext(); HelloBeanRemote beanRemote = (HelloBeanRemote)context.lookup("HelloBean/remote"); beanRemote.test(); } catch (NamingException e) { e.printStackTrace(); throw new RuntimeException(e); }
try { InitialContext ic = new InitialContext(); String value = (String) ic.lookup("MyCustomResource"); System.out.println("MyCustomResource = " + value); } catch (NamingException e) { e.printStackTrace(); }
public void updateCtxBindings(Map bindings) { Iterator it = bindings.keySet().iterator(); try { while (it.hasNext()) { String key = (String)it.next(); ctx.bind(key, bindings.get(key)); } } catch (NamingException ne) { ne.printStackTrace(); } }
try { Context initCxt = new InitialContext(); Boolean isConn = (Boolean)initCxt.lookup("java:comp/env/isConnected"); System.out.println(isConn.toString()); // one could use relative names into the sub-context Context envContext = (Context) initCxt.lookup("java:comp/env"); Boolean isConn2 = (Boolean)envContext.lookup("isConnected"); System.out.println(isConn2.toString()); } catch (NamingException e) { e.printStackTrace(); }
public static void reset() { try { init(); } catch (NamingException ex) { ex.printStackTrace(); } }
public Context getRealCtx() { if (ctx == null) try { return getDefaultInitCtx(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ctx; }
try { for (NamingEnumeration attr = rsa.getAll(); attr.hasMore();) { Attribute attribute= (Attribute) attr.next(); System.out.println("Attribute id: " + attribute.getID()); for (NamingEnumeration val = attribute.getAll(); val.hasMore();){ System.out.println("Attribute value: " + val.next()); } } } catch (NamingException e) { e.printStackTrace(); }
public ActiveMQCoreAdmin() { super(); jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); try { Hashtable<String, String> env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); env.put("java.naming.provider.url", "tcp://localhost:61616"); context = new InitialContext(env); } catch (NamingException e) { e.printStackTrace(); } }