Matt Drees [
http://community.jboss.org/people/matt.drees] created the discussion
"Unable to use com.sun.jndi.ldap.LdapCtxFactory"
To view the discussion, visit:
http://community.jboss.org/message/608523#608523
--------------------------------------------------------------
Hi all,
My project has a piece that needs to read from our ldap. My code looks something like
this:
public DirContext createLdapContext()
{
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
...
return new InitialDirContext(env);
}
However, it appears the ModuleClassLoader won't load the
com.sun.jndi.ldap.LdapCtxFactory:
...
Caused by: javax.naming.NamingException: Failed instantiate InitialContextFactory
com.sun.jndi.ldap.LdapCtxFactory from classloader ModuleClassLoader for Module
"deployment.ccp.war:main" from Service Module Loader
at
org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:58)
[jboss-as-naming-7.0.0.Beta4-SNAPSHOT.jar:7.0.0.Beta4-SNAPSHOT]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:664)
[:1.6.0_24]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) [:1.6.0_24]
at javax.naming.InitialContext.init(InitialContext.java:223) [:1.6.0_24]
at javax.naming.InitialContext.<init>(InitialContext.java:197) [:1.6.0_24]
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:82)
[:1.6.0_24]
at
org.ccci.ccp.security.LdapContextProducer.createLdapContext(LdapContextProducer.java:59)
[classes:]
... 65 more
In digging some, I found the "jboss.modules.system.pkgs" property, and it looks
like i could set this to "com.sun.jndi.ldap" and this exception should go away.
Is this the right way to address this?
Thanks!
-Matt
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/608523#608523]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]