An ejb-jar deployed to jboss 7 has a jdni binding “java:global/foo!IFoo”.
Jboss management console shows this binding.
The jndi port is 1099 as by default.
A client on jboss gets an object to that binding but a standalone client running on the same machine does not.
Properties properties = new Properties();
properties.put("java.naming.factory.initial",
"org.jboss.as.naming.InitialContextFactory");
properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url","jnp://localhost:1099");
Context ctx = new InitialContext(properties);
NamingEnumeration<NameClassPair> list = ctx.list("");
while (list.hasMore()) {
System.out.println(list.next().getName());
}
produces no results. Also the lookup to the name above fails.
Where is the problem ?
It seems remote JNDI lookup support was implemented only on JBoss AS 7.1.0.Final (AS7-1338).
The JNDI properties to perform remote lookups has also changed. Could you try to instantiate the
InitialContextwith these JNDI properties?The remote access to the JNDI tree is secured, so you need to provide a user and a password (add an Application User via
add-user.sh/add-user.batscript).I did this on my own local server, but the
NamingEnumerationreturned byInitialContext.list()is still empty, even though the lookup below works fine. I posted an answer on JBoss forum, but no luck so far.