NoClassDefFoundError issue with a custom LDAP authenticator


We are using XWiki 9.9 with the LDAP authenticator extension installed, version 9.2.5. We have defined our own authenticator [1] which extends org.xwiki.contrib.ldap.XWikiLDAPAuthServiceImpl and basically converts XWiki usernames to lowercase. In xwiki.cfg, when setting the parameter xwiki.authentication.authclass to its default value, everything works as expected. However, when setting the value to the custom authenticator class name, we get a NoClassDefFoundError exception as shown below. At the moment we have no idea on how to debug this. Any help would be greatly appreciated.


Raised exception:

Caused by: java.lang.NoClassDefFoundError: org/xwiki/contrib/ldap/XWikiLDAPAuthServiceImpl at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass( at at at$100( at$ at$ at Method) at at org.eclipse.jetty.webapp.WebAppClassLoader.foundClass( at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at java.lang.Class.forName0(Native Method) at java.lang.Class.forName( at com.xpn.xwiki.XWiki.getAuthService( at com.xpn.xwiki.XWiki.checkAuth(

Thank you,


According to the error your extension is in a lower classloader than the LDAP authenticator. The LDAP authenticator being installed on root namespace maybe it means you put your custom authenticator JAR in WEB-INF/lib (which means it does not have access to any classloader containing extensions classes).

If that’s the case you will need either move the LDAP authenticator to WEB-INF/lib or, better, install your custom authenticator as extension with the LDAP authenticator as dependency.

Thanks a lot Thomas, we will try to install the custom authenticator as an extension then.
PS: the JAR file was put in the WEB-INF/lib directory indeed.

A follow up on this issue was posted as another topic.

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available at compile time. After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader (in this case, which is responsible for dynamically loading classes, cannot find the .class file for the class that you’re trying to use.

NoClassDefFoundError can occur for multiple reasons like

  • ClassNotFoundException – .class not found for that referenced class irrespective of whether it is available at compile time or not(i.e base/child class).
  • Class file located, but Exception raised while initializing static variables
  • Class file located, Exception raised while initializing static blocks