25.7. How BASE load plug-in classes

All plug-ins should be installed in the location specified by the plugins.dir setting in base.config. While it is possible to also install them in a location that is on the classpath, for example <base-dir>/www/WEB-INF/lib, it is nothing that we recommend. The rest of the information in this section only applies to plug-ins that have been installed in the plugins.dir location.

If the above recommendation has been followed BASE will use it's own classloader to load the plug-in classes. This have several benefits:

The classloading scheme used by BASE also means plug-in developers must pay attention to a few things:

Tomcat includes a good document describing how classloading is implemented in Tomcat: http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html. BASE's classloading scheme isn't as complex as Tomcat's, but it very similar to how Tomcat loads different web applications. The figure on the linked document could be extended with another level with separate classloaders for each plug-in as child classloaders to the web application classloaders.

As of BASE 2.13 the default search order for classes has been changed. The default is now to first look in the plug-ins class path (eg. in the same JAR file and in files listed in the MANIFEST.MF file). Only if the class is not found the search is delegated to the parent class loader. This behaviour can be changed by setting X-Delegate-First: true in the MANIFEST.MF file. If this property is set the parent class loader is search first. This is the same as in BASE 2.12 and earlier.

[Note] Note
The benefit with the new search order is that plug-ins may use a specific version of any external package even if the same package is part of the BASE distribution. This was not possible before since the package in the BASE distribution was loaded first.