26.8. How BASE load plug-in classes

We recommend that plug-in JAR files are installed outside the web server's classpath. If you are using Tomcat this means that you should not install the plug-in in the <base-dir>/www/WEB-INF/lib directory or any other directory where the web server keeps it's classes. The rest of the information in this section only applies to plug-ins that have been installed following this restriction.

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-5.5-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.