I am using tomcat 9, And trying to load all the project related jar's from below PreResources tag.
<Resources className="org.apache.catalina.webresources.StandardRoot" cachingAllowed="true" cacheMaxSize="100000" allowLinking="true">
<PreResources className="org.apache.catalina.webresources.DirResourceSet"
base="D:\SomePath\apache-tomcat-9.0.0.M17-windows-x64-2\apache-tomcat-9.0.0.M17"
internalPath="/External-lib"
webAppMount="/WEB-INF/classes" />
The External-lib folder lies in tomcat directory as per the path mentioned in 'base'. but when application gets deployed, I get below error.
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
This gets called from web.xml,
org.springframework.web.context.ContextLoaderListener
in tomcat lib, we have just tomcat libraries, where as rest all jar's are in External-lib folder. Since we have similar webApp and jar's are too many, we are trying to externalize them and not to load in webapp/web-inf/lib folder.
Please suggest, am I missing anything when loading the jar's from meta-inf/context.xml using PreResources element.
There is very less examples and documentation for this PreResources element. Any direction or help would be appreciated.
This should have been the content of context.xml. It worked and fixed my issues.
"Base" is the path to the external resources and "webAppMount" is where you want to mount these resources.