I deployed some code that uses an InitialLdapContext and I'm seeing these errors in the logs:
javax.naming.NotContextException: Not an instance of LdapContext
It appears that Wildfly sets a custom InitialContextFactoryBuilder when it starts which produces org.jboss.as.naming.InitialContext.
This custom InitialContext class extends javax.naming.directory.InitialDirContext which I believe has the side-effect of not allowing deployers to use InitialLdapContext, because these context objects perform internal validation that they are of the correct type.
Is this a bug or do I need to override/customize the InitialContextFactoryBuilder in this case?
It was a bug, but it's fixed already. WildFly 8.0.0.Final includes such fix.