0 Replies Latest reply on Aug 6, 2006 7:43 AM by P Suthland

    JNDI/OpenLdap ClassCastException

    P Suthland Newbie

      Hi there,

      I have managed to get openldap setup with jboss connecting to it (by the method of editing jboss-service.xml and a properties file).

      Properties file:


      addition to jboss-service.xml:
       <mbean code="org.jboss.naming.ExternalContext" name=":service=ExternalContext,jndiName=/ldap/configuration" >
       <attribute name="JndiName">/ldap/configuration</attribute>
       <attribute name="PropertiesURL">configuration.ldap</attribute>
       <attribute name="InitialContext">javax.naming.directory.InitialDirContext</attribute>
       <attribute name="RemoteAccess">true</attribute>

      This all seems to work fine as when I start up Jboss I can see openldap logging say that a manager has connected.

      In my servlet however I try to look up the JNDI resource.

       InitialDirContext iniCtx = new InitialDirContext();
       Object ldap = iniCtx.lookup("/ldap/configuration");

      This works fine, but I am not sure what to cast it as. I try casting as LdapCtxFactory and I get a java.lang.ClassCastException: $Proxy61

      Any ideas?