Search code examples
javatomcatclassloadertomcat9

Custom user library folder in tomcat


I need to include a few custom jar files in Tomcat that are referenced by a Java web application deployed on Tomcat.

If I add these libraries under <tomcat_base_folder>/lib, my application work perfectly fine, but I wanted to check if I can logically group them and move to different folders and modify any config files on Tomcat to pick these additional locations.

For example, can I create a folder by name drivers under <tomcat_base_folder> and add the ojdbc and db2cc jar files under this folder and reference the drivers folder also in the classpath somehow? Is there a way to include the custom library locations?

Appreciate any pointers on this.


Solution

  • As documented in Tomcat's class-loader-howto, you need to edit conf/catalina.properties and add your libraries to this property : common.loader

    The syntax is quite self understanding.