Getting java.lang.NoClassDefFoundError for my JAR extension

I’ve implemented my own authenticator that extends XWikiAuthServiceImpl. My extension has one dependency (apart from servlet one):


I built this using mvn -e install and then manually copied the .jar file to WEB-INF/lib/ directory. And restarted the docker container. The extension fails to load with this error:

java.lang.NoClassDefFoundError: net/dongliu/requests/Requests

I understand that it’s not able to find the dependency. I’m not a Java/XWiki expert. I dont know whether it is a Java/maven issue, or it is specific to XWiki. I have no idea as to how dependencies are managed? Does the runtime download the missing dependencies? How do I solve it?

I see files like xwiki-platform-wiki-user-api-10.11.9.xed in the WEB-INF/lib directory. What is that? Required by what? Is that related to this issue? Do I need to create one and copy that too to this location?

This is called manual installation. If you do this then you need to make sure you also copy any dependency that your JAR may have. The build environment (where Maven downloads the dependencies for your) and the runtime environment are different.

I you want dependency resolution you need to publish your JAR as extension and install it with Extension Manager in the administration. XWiki has no control over what’s in WEB-INF/lib even if it was trying to download missing dependencies (which is not always easy to find).

To create an extension, see