2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

01/10/2003: How to set the root cause when throwing an exception

How to set the root cause when throwing an exception

NamingException ne = new NamingException("foo bar blah blah");
ne.setRootCause(e);
throw ne;

01/09/2003: An Example Using NamingEnumeration to Find JBOSS JNDI Names

An Example Using NamingEnumeration to Find JBOSS JNDI Names

  Hashtable ht = new Hashtable();
  ht.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  ht.put(Context.PROVIDER_URL, "localhost");
  ht.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
  Context lContext = new InitialContext(ht);
  String a = "java:/";
  NamingEnumeration ne = lContext.list(a);
  while (ne.hasMore()) {
    System.out.println("A: " + ne.next().toString());
  }