JBoss EAP 6 remote JNDI client throws - javax.naming.NameNotFoundException: test -- service jboss.naming.context.java.jboss.exported.test
Issue
- We are getting this exception in our remote JNDI client trying to lookup the JNDI name 'test':
javax.naming.NameNotFoundException: test -- service jboss.naming.context.java.jboss.exported.test
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Our client code looks like this:
Hashtable<String, Object> p = new Hashtable<String, Object>();
p.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
p.put(InitialContext.PROVIDER_URL, "remote://localhost:4447");
p.put(Context.SECURITY_PRINCIPAL,"jndiuser"); // add this user as ApplicationRealm user added via script add-user.sh
p.put(Context.SECURITY_CREDENTIALS, "redhat");
Context ctx = new InitialContext(p);
String testValue = ctx.lookup("test");
Environment
- JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
