ClassNotFoundException on a com.sun.* class available in the rt.jar when custom module depends on javax.api module in JBoss EAP 6
Issue
- Why can't a module see something inside rt.jar even though it's added as a dependancy. I'm getting an error where my spring.ldap module has a ClassNotFoundException on com.sun.jndi.ldap.LdapCtxFactory (this exists in rt.jar). My module has a dependency on rt.jar in the form of
(I'm assuming this is the right dependancy). The error in the log is:
Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "spring.ldap:main" from local module loader @1038de7 (roots: /var/lib/jboss-eap-6.0/modules)]
Here's my full module for spring.ldap :
<module xmlns="urn:jboss:module:1.1" name="spring.ldap">
<resources>
<resource-root path="spring-ldap-core-1.3.0.jar"/>
</resources>
<dependencies>
<module name="javax.api" export="true"/>
<module name="javaee.api" export="true"/>
<module name="org.apache.commons.logging"/>
<module name="spring" slot="2.5.6"/>
<module name="spring.security"/>
</dependencies>
</module>
- Spring ldap failing with NoClassDefError :
ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-1) Caused by: java.lang.NoClassDefFoundError
ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-1) at org.springframework.ldap.core.support.AbstractContextSource.class$(AbstractContextSource.java:67)
12:51:50,247 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-1) at org.springframework.ldap.core.support.AbstractContextSource.<clinit>(AbstractContextSource.java:67)
...
ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8080-1) Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "org.springframework.spring:main" from local module loader @5219f360 (finder: local module finder @25b94dbc (roots: /opt/jboss-eap-6.3/modules,/opt/jboss-eap-6.3/modules/system/layers/base))]
...
Environment
- JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.