I use this code to create a subcontext in HAJNDI.
Properties p = new Properties();
p.putContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES,
"jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "WHATEVER"); // uses HAJNDI
Context ctx = new InitialContext(p);
try {
subctx = ctx.createSubcontext("TESTCTX123");
} catch(Exception e) {
e.printStackTrace();
}
I always catch this exception:
javax.naming.CommunicationException. Root exception is java.rmi.RemoteException: Service unavailable.
If I only do lookup or rebind, everything works fine in the HAJNDI. If I change the PROVIDER_URL to point to the standard JNDI, I can also create a subcontext.
I use JBoss 3.2.1, started with the "all" configuration. Can anybody tell me when this Exception occurs and how can I work around it ??
I'm currently working with JBoss 3.2.2RC4 and I noticed similar behavior. What appear to be happening is that HA-JNDI will not accept the '/' character. I have been binding using '_' instead of '/' and it works correctly.