tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <>
Subject Re: Tomcat deployment webapps and the whole stew
Date Fri, 28 Jun 2013 03:40:39 GMT
On 6/27/2013 7:32 PM, Narahari 'n' Savitha wrote:
> Here is what I tried.
> CATALINA_HOME=/opt/narahari/paas/apache-tomcat-7.0.37
> CATALINA_BASE=/opt/narahari/paas/adp-tomcat
> In the $CATALINA_BASE/conf/Catalina/localhost/ptl#cts.xml file the
> entry is

That's going to be much better than the previous.

How are you starting Tomcat?

Hopefully, you're following RUNNING.txt.

Something like this would be good:

export CATALINA_HOME=/opt/narahari/pass/apache-tomcat-7.0.37
export CATALINA_BASE=/opt/narahari/pass/adp-tomcat

In CATALINA_BASE, you have the following directory structure:

--- From RUNNING.txt ---
bin     (with tomcat-juli.jar, and possibly
conf    (all of the conf files copied from $CATALINA_BASE/conf)
lib     (most likely empty - you may have JDBC libraries here)
temp    (empty)
work    (empty)
webapps (where your WAR files go - see notes below)

> <Context docBase="/opt/narahari/paas/webapps/ptl#cts.war"
> antiResourceLocking="false" />

And this is not going to work - see below.

If you've copied the conf directory from $CATALINA_HOME into the conf 
directory of $CATALINA_BASE (per RUNNING.txt instructions), you'll have 
the following part in server.xml

<Host name="localhost"

This says that relative to $CATALINA_BASE, your web applications can be 
found in the webapps directory (shown above).

So place your WAR files (as you've done) in $CATALINA_BASE/webapps.

Thus if you have this setup, you no longer need your ptl.xml or 
ptl#cts.xml context files. This of course makes life much easier for 
deployment (now system independent).

In fact, it is an error to include them.

> =====================
> The contents of /opt/narahari/paas/webapps folder is
> virtual@cdl-pid-p1-01:/opt/narahari/paas/webapps> ls
> ptl#cts.war

This is fine, but it's not where your context file is pointing. Even if 
it was, see the notes above.

> ===================
> Now I start tomcat and I go check the logs to see if the ptl#cts.war
> got deployed and I see the following
> 22:18:34,426 INFO  [ConfigServlet]
> com.alp.rev.config.ConfigServlet.init(): Entering.
> 22:18:34,427 INFO  [ConfigServlet]
> com.alp.rev.config.ConfigServlet.init(): FILEINPUTSTREAM VERSION 1.0
> 22:18:34,427 INFO  [ConfigServlet]
> com.alp.rev.config.ConfigServlet.init(): configFiles =
> [/WEB-INF/faces-config.xml]
> 22:18:34,427 INFO  [ConfigServlet]
> com.alp.rev.config.ConfigServlet.init(): Full path to Faces
> configuration file [null]
> 22:18:34,427 ERROR [ConfigServlet]
> com.adp.rev.config.ConfigServlet.init(): Error trying to read file
> [null]. Exception = [java.lang.NullPointerException]
> java.lang.NullPointerException
> at<init>(
> at<init>(
> at com.alp.rev.config.ConfigServlet.init(
> at
> org.apache.catalina.core.StandardWrapper.initServlet(
>  at
> org.apache.catalina.core.StandardWrapper.loadServlet(
>  at
> org.apache.catalina.core.StandardWrapper.load(
>  at
> org.apache.catalina.core.StandardContext.loadOnStartup(
>  at
> org.apache.catalina.core.StandardContext.startInternal(
>  at
> org.apache.catalina.util.LifecycleBase.start(
> So as you can see I have the war file in the right
> location(/opt/narahari/paas/webapps) and is pointed to in the
> $CATALINA_BASE/conf/Catalina/localhost/ptl#cts.xml
> However I dont see the war initializing correctly.  It is trying to
> find the faces-config.xml file which does not seem to be found. (yes
> it is a part of the war file and exists under WEB-INF)
> So it looks like app running out of the war file directly is not
> working correctly.  I am not sure why but I would want your expert
> advice.
> Regards, -Narahari

Yep, because now you've pointed your context file to an appBase (if 
you've typo'ed your context file above).

So . . . here's the plan.


a. Create the directory structure given above (from RUNNING.txt)
b. Copy the files over that you need to copy
    1. tomcat-juli.jar from $CATALINA_HOME/bin tp $CATALINA_BASE/bin
    2. all of the files from $CATALINA_HOME/conf into $CATALINA_BASE/conf
c. Put your WAR files in $CATALINA_BASE/webapps
d. Set the following environment variables:
    1. export CATALINA_HOME=/opt/narahari/pass/apache-tomcat-7.0.37
    2. export CATALINA_BASE=/opt/narahari/pass/adp-tomcat
    3. export JRE_HOME=[wherever your JRE is]
e. Do NOT use any context files in conf/Catalina/localhost
f. run $CATALINA_HOME/bin/

Again, you can only use docBase in your context files if the following 
condition is met:

The WAR file or directory must be outside of the appBase directory 
defined in the Host element of server.xml.

If you point to a directory, the directory must be an expanded web 
application. If you have a WAR file, the docBase must point to the 
complete path of the WAR file.

By following RUNNING.txt, you're actually moving the appBase to 
/opt/narahari/paas/adp-tomcat/webapps, which is where you've put your 
WAR files.

Given the normal (default) behavior of Tomcat, the WAR files should be 
exploded in $CATALINA_BASE/webapps and happily run.

Your logs should be in $CATALINA_BASE/logs.

Your $CATALINA_HOME environment should remain blissfully pristine.

Hope that helps.

. . . . just my two cents.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message