jboss jndi context is empty

做~自己de王妃 提交于 2019-12-04 21:53:13

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 InitialContext with these JNDI properties?

properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote://localhost:4447");
properties.put(Context.SECURITY_PRINCIPAL, "user");
properties.put(Context.SECURITY_CREDENTIALS, "password");

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.bat script).

I did this on my own local server, but the NamingEnumeration returned by InitialContext.list() is still empty, even though the lookup below works fine. I posted an answer on JBoss forum, but no luck so far.

// This lookup works fine
System.out.println(ctx.lookup("jms/RemoteConnectionFactory").getClass().getName());
// ... but this list doesn't (empty enumeration)
NamingEnumeration<NameClassPair> list = ctx.list("");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!