In virtual hosting(Cpanel/WHM) environment, sometimes classes or servlets inside
WEB-INF/classes may not load into your JSP program. This is because, the path assigned to
appbase and
docbase might be same. For this purpose you can create a separate directory for Application Base.
First lets us know what is
appbase? and what is
docbase?
In virtual hosting , for every host there must be corresponding
<Host> element in server.xml. The
<Host> element contains
appbase attribute.
appbase - specifies the Application Base directory for the virtual host. This is the pathname of a directory that contains web applications to be deployed.
The
<Host> element contains
<Context> element. The
<Context> element specifies a web application, which runs within a particular virtual host. The
<Context> element contains
docbase attribute.
docbase - specifies Document base directory for a web application.
The directory which you specify as docbase must contain WEB-INF/ directory.
The classes in WEB-INF/classes may not load if both docbase and appbase are equal.
If classes inside
WEB-INF/classes is not loading, then you can create a separate directory for Application Base and make
appbase to point it.
An Example Configuration :
<Host name="hioxindia.com" appBase="/home/hiox/public_html/webapps" >
<Alias> hioxindia.com </Alias >
<Context path="" reloadable="true" docBase="/home/hiox/public_html" debug="1"/>
<Context path="/manager" debug="0" privileged="true"
docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
</Context>
</Host>
Here a separate directory called
webapps is created under
/home/hiox/ in which you can place
.war files. Here the document-base is
/home/hiox/public_html. The
.jsp,.html files are placed in
public_html and servlets, packages and class files are placed in
WEB-INF/class, which is inside
public_html.