Skip to content

The project once installed onto the tomcat server allows the tomcat administrator to specify a central location for all web-applications properties files. From the central config location the web-app context path is appended allowing each web-app to store their config file within their own context-path folder.

Notifications You must be signed in to change notification settings

doodo477/tomcat-classloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overview 

The project once installed onto the tomcat server allows the tomcat
administrator to specify a centeral location for all web-applications
properties files. Web-applications that load their properties using the
classpath can take advantage this project to change their logging/database
connection details without the need to re-deploy the web application. Web-
applications that dont use the class loader to load properties files and or
configuration files can be easily be modified to use LoadResources or
configured depending on the framework to look for resources on the default
classpath.

DynamicVirtualWebappLoader under the hood works by taking the context-path of
the web-application when it is loaded by the servlet container (in this
situation tomcat) and appending it to the specified virtualClasspath. This
creates a new virtualClassPath that is unique to each web-application. The new
virtualClassPath is searched first before the Servlet Container classpath.

Some examples are given bellow.

eg... 
Web Application context: ntflora
virtualClasspath=/root/pswd

LoadResources first searches the virtualclasspath for the requested resource
before using the default classpath.
/root/pswd/ntflora

eg.. 
Web Application context: key-server
virtualClasspath=/root/pswd

LoadResources first searches the virtualclasspath for the requested resource
before using the default classpath.
/root/pswd/key-server

Installation

Download the follow DynamicVirtualWebappLoader.jar file and place it into your
$CATALINA_BASE/lib directory.

Apply the following modification to $CATALINA_BASE/conf/context.xml.
Change the virtualClasspath to the required path on the server.

<Context>
    <!-- Add this to the context -->
    <Loader
      searchVirtualFirst="true" 
      className="rds.DynamicVirtualWebappLoader"
      virtualClasspath="/path/to/base/config/path"
    />
</Context>

Restart tomcat instance

About

The project once installed onto the tomcat server allows the tomcat administrator to specify a central location for all web-applications properties files. From the central config location the web-app context path is appended allowing each web-app to store their config file within their own context-path folder.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages