File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes JNDI Initial Context resource file V. runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JNDI Initial Context resource file V. runtime" Watch "JNDI Initial Context resource file V. runtime" New topic

JNDI Initial Context resource file V. runtime

Brian Willy

Joined: Jan 13, 2004
Posts: 2
Why can't I set the JBoss Initial context factory at runtime? Instead, I am forced to use the file. If I rely on the code, I get the following exception: "MBeanException: javax.naming.NoInitialContextException:"
I have done a sys.out on the hashtable of context props using both the prop file and runtime approaches and they are identical.
Any idea? I have provided snippets below. Thanks, Brian.
Properties props = new Properties();
props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");
//Context ctxt = SessionEJBInitialContext.getInitialContext();
Context ctxt = new InitialContext(props);
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Moving to the JBoss Forum...
wood burning stoves
subject: JNDI Initial Context resource file V. runtime
It's not a secret anymore!