You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Robinson, Eric" <er...@psmnv.com> on 2011/03/22 18:04:14 UTC

tomcat6 still deleting XML files from Catalina/localhost when the system is booted

This is really getting frustrating. We have 75 instances on tomcat6
running on the same server. Each instance runs from its own discrete
directory, where the tomcat-env.sh script and catalina.properties file
set environment vars to point to that unique instance's folders. Every
time we reboot the server, we find that certain XML files are getting
deleted from the Catalina/localhost folder. This causes the web app to
be unable to find certain files at runtime.
 
The main file that gets deteled is called "Attachment.xml". It's
contents look like this:
 

	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
	         debug="1" reloadable="false">
	</Context>
	

The siteXXX part differs from instance to instance to instance. It helps
the application locate certain files that users need at runtime.
 
We can stop and start any instance of tomcat whenever we wish by using
'service tomcat6_XXX stop' or 'service tomcat6_XXX start'. (These are
all symlinks in /etc/init.d that point to /opt/tomcat/bin/tomcat). That
works fine. But if we actually reboot the whole server, then when it
comes up, we find that about 80% of the instances have deleted the
Attachment.xml file and we have to manually put it back in. This really
puzzles me because the same script gets run whether at boot time or from
a shell prompt.
 
Someone suggested that it is caused by autoDeploy, so we changed all
instances to autoDeploy="false" but when we rebooted we got the same
thing. Most of the sites had lost their Attachment.xml file.
 
If anyone cares, here is the startup script...
 
#!/bin/bash
#
# Linux init script for the Apache Tomcat servlet container.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet container.
# processname: tomcat
# config: /opt/tomcat/conf/tomcat-env.sh
#
# Copyright (c) 2007, 2008 Jason Brittain <ja...@gmail.com>
#
# ----------------------------------------------------------------------
# $Id: init.linux 112 2008-08-05 10:04:53Z jasonb $
#
 
# Set the site ID; everything else derives from it
SID=`echo $0|cut -d"_" -f2`
 
# Set the multisite root folder
MULTISITE_ROOT=/alley
 
# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
 /etc/rc.d/init.d/functions
fi
 
APP_ENV="$MULTISITE_ROOT/site$SID/tomcat6/conf/tomcat-env.sh"
 
# Source the app config file, if it exists.
[ -r "$APP_ENV" ] && . "${APP_ENV}"
 
# The path to the Tomcat start/stop script.
TOMCAT_SCRIPT=$CATALINA_HOME/bin/catalina.sh
 
# The name of this program.
PROG="$0"
 
# Resolve links - $0 may be a soft link.
while [ -h "$PROG" ]; do
    ls=`ls -ld "$PROG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '.*/.*' > /dev/null; then
        PROG="$link"
    else
        PROG=`dirname "$PROG"`/"$link"
    fi
done
 
PROG="`basename $PROG`"

# If TOMCAT_USER is not set, use "tomcat".
if [ -z "$TOMCAT_USER" ]; then
    TOMCAT_USER="tomcat"
fi
 
# Since the daemon function will run $TOMCAT_SCRIPT, no environment
# stuff should be defined here anymore.  Please use the
# $MULTISITE_ROOT/site$SID/tomcati6/conf/tomcat-env.sh file instead.
 
let RETVAL=0
JVM_PID="0"
JVM_RUNNING="false"
 
start() {
    echo -n "Starting $PROG: "
    checkJvmRunning
    if [ "$JVM_RUNNING" == "true" ]; then
        echo -n "\"$JVM_ID\" JVM process already running. "
    else
        # Raise the process's maximum number of file descriptors to
4096.
        ulimit -n 4096
 
        # Exit with an explanation if our JAVA_HOME isn't found.
        if [ ! -d "$JAVA_HOME" ]; then
            echo "JAVA_HOME of $JAVA_HOME not found."
            echo "See ${APP_ENV}"
            if [ -x /etc/rc.d/init.d/functions ]; then
                echo -n "Starting $PROG: "
                echo_failure
                echo
            fi
            return 1
        fi
 
        # Start Tomcat, running as the $TOMCAT_USER.
        if [ "$USER" == "$TOMCAT_USER" ]; then
            # We're already the $TOMCAT_USER so just exec the script.
            exec bash -c "set -a; . $APP_ENV; $TOMCAT_SCRIPT start" \
                >/dev/null 2>&1
        else
            if [ -x /etc/rc.d/init.d/functions -a -x /sbin/runuser ];
then
                echo "APP_ENV='$APP_ENV'"
                echo "TOMCAT_SCRIPT='$TOMCAT_SCRIPT'"
                echo "TOMCAT_USER='$TOMCAT_USER'"
                #runuser -s /bin/bash - $TOMCAT_USER -c "set -a; .
$APP_ENV; $TOMCAT_SCRIPT start" &>/dev/null
                runuser -s /bin/bash - $TOMCAT_USER -c "set -a; .
$APP_ENV; $TOMCAT_SCRIPT run" &
            else
                su - $TOMCAT_USER -c "/bin/bash -c \
                    \"set -a; . $APP_ENV; $TOMCAT_SCRIPT start\"" \
                    >/dev/null 2>&1
            fi
        let RETVAL=$?
 
        # If the return value is zero, then the attempt to start it is
        # good so far.
        if [ $RETVAL -eq 0 ]; then
            # Sleep some seconds while Tomcat begins to start, then
check it.
            sleep 7
            checkJvmRunning
            if [ "$JVM_RUNNING" == "false" ]; then
                let RETVAL=1
            fi
        fi
    fi
 
    # Output "[  OK  ]" or "[  FAILED  ]"
    if [ $RETVAL -eq 0 ]; then
        if [ -x /etc/rc.d/init.d/functions ]; then
            echo_success
            echo
        else
            echo "[  OK  ]"
        fi
    else
 
        if [ -x /etc/rc.d/init.d/functions ]; then
            echo_failure
            echo
        else
            echo "[  FAILED  ]"
        fi
    fi
 
    return $RETVAL
}
 
stop() {
    echo -n "Stopping $PROG: "
 
    checkJvmRunning
    if [ "$JVM_RUNNING" == "true" ]; then
 
        # Exit with an explanation if our JAVA_HOME isn't found.
        if [ ! -d "$JAVA_HOME" ]; then
            echo "JAVA_HOME of $JAVA_HOME not found."
            echo "See ${APP_ENV}"
            echo -n "Stopping $PROG: "
            if [ -x /etc/rc.d/init.d/functions ]; then
                echo_failure
                echo
            else
                echo "[  FAILED  ]"
            fi
            return 1
        fi
        # Stop Tomcat, running as the $TOMCAT_USER.  We also unset any
        # JVM memory switches -- the stop client shouldn't start with
those.
        if [ "$USER" == "$TOMCAT_USER" ]; then
            # We're already the $TOMCAT_USER so just exec the script.
            exec bash -c "set -a; . $APP_ENV; shopt -s extglob; \
                export JAVA_OPTS=\"\${JAVA_OPTS//-Xm[sx]+([0-9])[mM]}\";
\
                shopt -u extglob; $TOMCAT_SCRIPT stop" &>/dev/null
        else
            if [ -x /etc/rc.d/init.d/functions -a -x /sbin/runuser ];
then
                runuser -s /bin/bash - $TOMCAT_USER \
                    -c "set -a; . $APP_ENV; shopt -s extglob; \
                    export
JAVA_OPTS=\"\${JAVA_OPTS//-Xm[sx]+([0-9])[mM]}\"; \
                    shopt -u extglob; $TOMCAT_SCRIPT stop" &>/dev/null
            else
                su - $TOMCAT_USER -c "/bin/bash -c \
                    \"set -a; . $APP_ENV; shopt -s extglob; \
                    export
JAVA_OPTS=\"\${JAVA_OPTS//-Xm[sx]+([0-9])[mM]}\"; \
                    shopt -u extglob; $TOMCAT_SCRIPT stop\"" &>/dev/null
            fi
        fi
 
        let RETVAL=$?
 
        if [ $RETVAL -eq 0 ]; then
 
            checkJvmRunning
            if [ "$JVM_RUNNING" == "true" ]; then
 
                # Loop here until either Tomcat shuts down on its own,
or
                # until we've waited longer than SHUTDOWN_WAIT seconds.
                let count=0
                until [ "`ps --pid $JVM_PID | grep -c $JVM_PID`" == "0"
] ||
                      [ $count -gt $SHUTDOWN_WAIT ]
                do
                    if [ $count -eq 0 ]; then
                        echo
                    fi
                    echo "Waiting for processes to exit.."
                    sleep 1
                    let count=$count+1
                done
 
                if [ $count -gt $SHUTDOWN_WAIT ]; then
                    # Tomcat is still running, so we'll send the JVM a
                    # SIGTERM signal and wait again.
                    echo "Sending the Tomcat processes a SIGTERM asking
them" \
                         "to shut down gracefully.."
                    /bin/kill -s SIGTERM $JVM_PID &>/dev/null
 
                    # Loop here until either Tomcat shuts down on its
own, or
                    # until we've waited longer than SHUTDOWN_WAIT
seconds.
                    let count=0
                    until [ "`ps --pid $JVM_PID | grep -c $JVM_PID`" \
                          == "0" ] || [ $count -gt $SHUTDOWN_WAIT ]
                    do
                        echo "Waiting for processes to exit.."
                        sleep 1
                        let count=$count+1
                    done
 
                    if [ $count -gt $SHUTDOWN_WAIT ]; then
                        # Tomcat is still running, and just won't shut
down.
                        # We'll kill the JVM process by sending it a
SIGKILL
                        # signal and wait again for the JVM process to
die.
                        echo "Killing processes which didn't stop after"
\
                         "$SHUTDOWN_WAIT seconds."
                        /bin/kill -s SIGKILL $JVM_PID &>/dev/null
 
                        # Loop here until either Tomcat shuts down on
its own,
                        # or until we've waited longer than
SHUTDOWN_WAIT
                        # seconds.
                        let count=0
                        until [ "`ps --pid $JVM_PID | grep -c $JVM_PID`"
\
                              == "0" ] || [ $count -gt $SHUTDOWN_WAIT ]
                        do
                            echo "Waiting for processes to exit.."
                            sleep 1
                            let count=$count+1
                        done
 
                        if [ $count -gt $SHUTDOWN_WAIT ]; then
                            # The JVM process won't shut down even with
a
                            # SIGKILL, so there is something really
wrong.
                            echo "The \"$JVM_ID\" JVM process is wedged
and" \
                                "won't shut down even when it is"
                            echo "sent a SIGKILL."
                            echo "Process ID $JVM_PID."
 
                            # Right here we may want to email an
administrator.
 
                            let RETVAL=1
                        fi
                    fi
 
                    # We need to sleep here to make sure the JVM process
dies.
                    sleep 2
                fi
            fi
        fi
    fi
 
    # Output "[  OK  ]" or "[  FAILED  ]"
    if [ $RETVAL -eq 0 ]; then
        if [ -x /etc/rc.d/init.d/functions ]; then
            echo_success
            echo
        else
            echo "[  OK  ]"
        fi
    else
        if [ -x /etc/rc.d/init.d/functions ]; then
            echo_failure
            echo
        else
            echo "[  FAILED  ]"
        fi
    fi
 
    return $RETVAL
}
 
getJvmPid() {
    JVM_PID="`ps awwx | grep \"jvm=$JVM_ID \" | grep -v grep | head -n 1
| \
        cut -c -5`"
}
 
checkJvmRunning() {
    getJvmPid
    if [ "$JVM_PID" != "" ]; then
        JVM_RUNNING="true"
    else
        JVM_RUNNING="false"
    fi
}
 
# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        if [ $RETVAL -eq 0 ]; then
            start
        fi
        ;;
    status)
        SERVICE_NAME="$PROG"
        checkJvmRunning
        if [ "$JVM_RUNNING" == "true" ]; then
            echo "$SERVICE_NAME (pid $JVM_PID) is running."
            let RETVAL=0
        else
            echo "$SERVICE_NAME is not running."
            let RETVAL=1
        fi
        exit $RETVAL
        ;;
    condrestart)
        # If it's already running, restart it, otherwise don't start it.
        checkJvmRunning
        if [ "$JVM_RUNNING" == "true" ]; then
        if [ "$JVM_RUNNING" == "true" ]; then
            stop
            if [ $RETVAL -eq 0 ]; then
                start
            fi
        fi
        ;;
    *)
        echo "Usage: $PROG {start|stop|restart|status|condrestart}"
        let RETVAL=1
        exit $RETVAL
esac
 
exit $RETVAL
                                              
 
 
And here is a sample tomcat-env.sh...
 
 
#!/bin/bash
APP_ENV="/alley/site001/tomcat6/conf/tomcat-env.sh"
JAVA_HOME="/usr/java/jdk1.6.0_21"
 
# Where your Tomcat installation lives.
CATALINA_HOME="/alley/site001/tomcat6"
JASPER_HOME="/alley/site001/tomcat6"
CATALINA_TMPDIR="/alley/site001/tomcat6/temp"
 
# The path to this application's writeable runtime Tomcat tree.
CATALINA_BASE="/alley/site001/tomcat6"
 
# The ID of this package's JVM.
JVM_ID="tomcat6_001"
 
# You can pass extra JVM startup parameters to java here if you wish.
JAVA_OPTS="-Djvm=$JVM_ID -Xms64M -Xmx512M -Djava.awt.headless=true \
  -Djava.net.preferIPv4Stack=true $JPDA_OPTS $JMX_OPTS"
 
# What user should run tomcat.
TOMCAT_USER="site001"
 
# Time to wait in seconds before sending signals to stop the JVM
process.
# The total maximum wait time is three times the number you set here!
let SHUTDOWN_WAIT=2

--
Eric Robinson
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


Disclaimer - March 22, 2011 
This email and any files transmitted with it are confidential and intended solely for users@tomcat.apache.org. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

Re: tomcat6 still deleting XML files from Catalina/localhost when the system is booted [OT]

Posted by André Warnier <aw...@ice-sa.com>.
Jason Pyeron wrote:
>> -----Original Message-----
>> From: Jeffrey Janner 
>> Sent: Thursday, March 24, 2011 17:56
>> To: 'Tomcat Users List'
>> Subject: RE: tomcat6 still deleting XML files from 
>> Catalina/localhost when the system is booted
>>
>>> -----Original Message-----
>>> From: Robinson, Eric [mailto:eric.robinson@psmnv.com] The idea of 
>>> having a loop in the script that waits for the directory to 
>> be mounted 
>>> sounds problematic to me. We have 75 instances of tomcat, so
>>> 75 startup scripts. Even though they all start with S96, I 
>> assume the 
>>> system picks one to start with, so that's the one that would spin 
>>> waiting for the NFS mount. Then the others would run quickly after 
>>> that.
>> Init will run the S96xxxx scripts in alphabetical order, if 
>> that helps you pick which one script to modify.
>>
>> Q: What happens to those 75 instances when the NFS directory 
>> goes off-line during production?
> 
> It triggers a stock option liquidation script.
> 
Yours ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted [OT]

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Jeffrey Janner 
> Sent: Thursday, March 24, 2011 17:56
> To: 'Tomcat Users List'
> Subject: RE: tomcat6 still deleting XML files from 
> Catalina/localhost when the system is booted
> 
> > -----Original Message-----
> > From: Robinson, Eric [mailto:eric.robinson@psmnv.com] The idea of 
> > having a loop in the script that waits for the directory to 
> be mounted 
> > sounds problematic to me. We have 75 instances of tomcat, so
> > 75 startup scripts. Even though they all start with S96, I 
> assume the 
> > system picks one to start with, so that's the one that would spin 
> > waiting for the NFS mount. Then the others would run quickly after 
> > that.
> 
> Init will run the S96xxxx scripts in alphabetical order, if 
> that helps you pick which one script to modify.
> 
> Q: What happens to those 75 instances when the NFS directory 
> goes off-line during production?

It triggers a stock option liquidation script.

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: Robinson, Eric [mailto:eric.robinson@psmnv.com]
> The idea of having a loop in the script that waits for the directory to
> be mounted sounds problematic to me. We have 75 instances of tomcat, so
> 75 startup scripts. Even though they all start with S96, I assume the
> system picks one to start with, so that's the one that would spin
> waiting for the NFS mount. Then the others would run quickly after
> that.

Init will run the S96xxxx scripts in alphabetical order, if that helps you pick which one script to modify.

Q: What happens to those 75 instances when the NFS directory goes off-line during production?
__________________________________________________________________________

Confidentiality Notice:  This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.  

If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Robinson, Eric" <er...@psmnv.com>.
> >> suppose that what you want to mount there, is the exported NFS 
> >> filesystem "server01:/some/exported/fs".  If you place a 
> small file 
> >> "not.yet.mounted" inside of the /mnt/nfs01 local 
> directory, it will 
> >> be visible, as long as the mount has not yet really happened.
> > 
> > I'm under the impression that mount points have to be empty 
> directories...
> 
> No (at least not under Linux) :
> 

Right, I've used this trick for a long time. I use a file called
unmounted.txt, which scripts look for to test whether the nfs mount is
mounted on the local directory. If unmounted.txt does not exist, the
remote fs is mounted.

The idea of having a loop in the script that waits for the directory to
be mounted sounds problematic to me. We have 75 instances of tomcat, so
75 startup scripts. Even though they all start with S96, I assume the
system picks one to start with, so that's the one that would spin
waiting for the NFS mount. Then the others would run quickly after that.
Still, if something bad happens with NFS, the script might never emerge
from the loop. I guess I could put a timeout in there, but then it's
back to a guessing game as to how long to wait.

What if we create the expected directory structure under the unmounted
directory so that when tomcat starts, its sees the directories it is
looking for regardless of whether the NFS mount is complete yet? Then
the web context would not fail and the XML file would not get deleted.
When the NFS mount finally completes, from tomcat's perspective the
directory suddenly gets populated with files. Would that cause a problem
for either tomcat or NFS? In other words, would tomcat have a handle to
the local file system that would keep the NFS mount from succeeding?

On the other hand, when I add a new instance (which I do all the time)
then I would not be able to create the expected directories on the
unmounted FS because the NFS mount is in production. Sigh. Maybe the
loop with the timeout is the best idea after all.

I think I will explore the service dependency possibilities that Andrew
mentioned.

--Eric



























Disclaimer - March 23, 2011 
This email and any files transmitted with it are confidential and intended solely for Tomcat Users List. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
>> From: André Warnier [mailto:aw@ice-sa.com] 
>> Subject: Re: tomcat6 still deleting XML files from Catalina/localhost when the system is booted
> 
>> Suppose one of your local system's mountpoints is "/mnt/nfs01",
>> and suppose that what you want to mount there, is the exported 
>> NFS filesystem "server01:/some/exported/fs".  If you place a 
>> small file "not.yet.mounted" inside of the /mnt/nfs01 local 
>> directory, it will be visible, as long as the mount has not
>> yet really happened.
> 
> I'm under the impression that mount points have to be empty directories...

No (at least not under Linux) :

vovm1:~# cd /mnt
vovm1:/mnt# mkdir test
vovm1:/mnt# cd test
vovm1:/mnt/test# touch not.mounted.yet
vovm1:/mnt/test# ls -l
total 0
-rw-r--r-- 1 root root 0 2011-03-23 13:43 not.mounted.yet
vovm1:/mnt/test# cd ..
vovm1:/mnt# mount -t nfs titanic1-int:/TEST/SRV /mnt/test
vovm1:/mnt# mount
...
titanic1-int:/TEST/SRV on /mnt/test type nfs (rw,addr=192.168.20.80)
...

vovm1:/mnt# ls -l /mnt/test
total 8
drwxr-xr-x+ 4 root     root     4 2011-01-04 20:10 DAV
drwxr-xr-x+ 2 root     root     2 2005-03-23 22:34 ftp
drwxr-xr-x+ 5 root     root     8 2011-02-06 22:09 tomcat5.5
drwxrws---  9 www-data www-data 9 2010-08-04 00:27 www
vovm1:/mnt# umount /mnt/test
vovm1:/mnt# ls -l /mnt/test
total 0
-rw-r--r-- 1 root root 0 2011-03-23 13:43 not.mounted.yet
vovm1:/mnt#


CQFD.

> 
>> And as soon as the mount has really happened, it will no longer 
>> be visible, because its parent directory "/mnt/fs01", will be 
>> "hidden" by the contents of "server01:/some/exported/fs".
> 
> Did you mean /mnt/nfs01 above, or is something else intended?

You are right, /mnt/nfs01 it should have been.

> 
>> Conversely, if you place a file "now.its.mounted" inside of the 
>> remote directory "server01:/some/exported/fs", it will not be 
>> visible locally in "/mnt/fs01", until the mount has really happened.
> 
> Assuming you mean /mnt/nfs01, that one should work.
> 

And the other one above too.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com] 
> Subject: Re: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

> Suppose one of your local system's mountpoints is "/mnt/nfs01",
> and suppose that what you want to mount there, is the exported 
> NFS filesystem "server01:/some/exported/fs".  If you place a 
> small file "not.yet.mounted" inside of the /mnt/nfs01 local 
> directory, it will be visible, as long as the mount has not
> yet really happened.

I'm under the impression that mount points have to be empty directories...

> And as soon as the mount has really happened, it will no longer 
> be visible, because its parent directory "/mnt/fs01", will be 
> "hidden" by the contents of "server01:/some/exported/fs".

Did you mean /mnt/nfs01 above, or is something else intended?

> Conversely, if you place a file "now.its.mounted" inside of the 
> remote directory "server01:/some/exported/fs", it will not be 
> visible locally in "/mnt/fs01", until the mount has really happened.

Assuming you mean /mnt/nfs01, that one should work.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by André Warnier <aw...@ice-sa.com>.
Robinson, Eric wrote:
>> Eric Robinson
>>> #!/bin/bash
>>> #
>>> # httpd        Startup script for the Apache HTTP Server
>>> #
>>> # chkconfig: - 85 15
>>> # description: Apache is a World Wide Web server.  It is 
>> used to serve 
>>> \
>>> #              HTML files and CGI.
>>> # processname: httpd
>>> # config: /etc/httpd/conf/httpd.conf
>>> # config: /etc/sysconfig/httpd
>>> # pidfile: /var/run/httpd.pid
>>>
>>> See the line with chkconfig - S## E##?
>>>
>>> Put those in your config before doing a chkconfig add, and it will 
>>> cause them to start in that order. Make sure they start 
>> after nfs and 
>>> die before nfs and you should be golden.
>>>
>>>
> 
> Hmmm... all of my tomcat scripts in /etc/rc.d/rc5.d start with S96. How
> do I ensure that they start after the NFS mount is available? The only
> NFS-related scripts that I see are S14nfslock and K20nfs. It looks like
> those are already starting well before the tomcat scripts.
> 
Right.
I think that there are several issues here.
One issue (the one discussed so far above), is the order in which the system startup 
scripts are started and/or run.
Obviously in this case, since your Tomcats depend on some NFS mounts being available, you 
want to make sure that the startup actions which make these mounts available, are run 
before you start the Tomcats.
Traditionally on Unix-like systems, this was achieved by the numbering scheme in the 
startup scripts links /etc/rcX.d/SnnScriptname.
More recently, other schemes have emerged, based on a kind of "registry", which allows to 
specify dependencies between the various startup scripts.
I think that this is what Jason earlier alluded to.
But I believe that the details of these schemes vary between Linux distributions, and are 
not necessarily portable.

But anyway, that is not enough, because the mere fact that these mounts-related startup 
scripts are run before the Tomcat-startup scripts are run, still does not guarantee that 
the NFS mounts themselves are available.  As far as I know, NFS mounts may be 
asynchronous, namely the "mount" instruction itself is run and has returned, but the real 
NFS mount is still ongoing, and the system does not "see" the distant directory yet, it 
still sees the local mountpoint directory.

So what you really want to do for example, is something like this :
Suppose one of your local system's mountpoints is "/mnt/nfs01", and suppose that what you 
want to mount there, is the exported NFS filesystem "server01:/some/exported/fs".
If you place a small file "not.yet.mounted" inside of the /mnt/nfs01 local directory, it 
will be visible, as long as the mount has not yet really happened.
And as soon as the mount has really happened, it will no longer be visible, because its 
parent directory "/mnt/fs01", will be "hidden" by the contents of 
"server01:/some/exported/fs".
Conversely, if you place a file "now.its.mounted" inside of the remote directory 
"server01:/some/exported/fs", it will not be visible locally in "/mnt/fs01", until the 
mount has really happened.
So what you could do in your Tomcat startup scripts, is having a small loop which waits 
until either of the above conditions above is verified, before letting the real Tomcat 
startup take place.
(Under Linux, there is also a nifty little program called "mountpoint" that can help you 
there, but that may be less portable).
The drawback of this, is that if something happens to the NFS server or that share, and 
you reboot your system or run a Tomcat startup script, it may appear to "hang" for quite a 
while instead of just failing. But that may be a small price to pay versus starting a 
Tomcat without its needed files.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Robinson, Eric" <er...@psmnv.com>.
> Eric Robinson
> > #!/bin/bash
> > #
> > # httpd        Startup script for the Apache HTTP Server
> > #
> > # chkconfig: - 85 15
> > # description: Apache is a World Wide Web server.  It is 
> used to serve 
> > \
> > #              HTML files and CGI.
> > # processname: httpd
> > # config: /etc/httpd/conf/httpd.conf
> > # config: /etc/sysconfig/httpd
> > # pidfile: /var/run/httpd.pid
> > 
> > See the line with chkconfig - S## E##?
> > 
> > Put those in your config before doing a chkconfig add, and it will 
> > cause them to start in that order. Make sure they start 
> after nfs and 
> > die before nfs and you should be golden.
> > 
> > 
> 

Hmmm... all of my tomcat scripts in /etc/rc.d/rc5.d start with S96. How
do I ensure that they start after the NFS mount is available? The only
NFS-related scripts that I see are S14nfslock and K20nfs. It looks like
those are already starting well before the tomcat scripts.


--Eric









Disclaimer - March 22, 2011 
This email and any files transmitted with it are confidential and intended solely for Tomcat Users List. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Robinson, Eric" <er...@psmnv.com>.

--
Eric Robinson
> #!/bin/bash
> #
> # httpd        Startup script for the Apache HTTP Server
> #
> # chkconfig: - 85 15
> # description: Apache is a World Wide Web server.  It is used 
> to serve \
> #              HTML files and CGI.
> # processname: httpd
> # config: /etc/httpd/conf/httpd.conf
> # config: /etc/sysconfig/httpd
> # pidfile: /var/run/httpd.pid
> 
> See the line with chkconfig - S## E##?
> 
> Put those in your config before doing a chkconfig add, and it 
> will cause them to start in that order. Make sure they start 
> after nfs and die before nfs and you should be golden.
> 
> 

Fantasic, Jason, I'll do that going forward!

--Eric












Disclaimer - March 22, 2011 
This email and any files transmitted with it are confidential and intended solely for Tomcat Users List. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Robinson, Eric [mailto:eric.robinson@psmnv.com] 
> Sent: Tuesday, March 22, 2011 13:30
> To: Tomcat Users List
> Subject: RE: tomcat6 still deleting XML files from 
> Catalina/localhost when the system is booted
> 
> 
> > --
> > > On 22/03/2011 17:04, Robinson, Eric wrote:
> > > > 	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
> > > > 	         debug="1" reloadable="false">
> > > > 	</Context>
> > >
> > > So are nfs mounts being used? If so, my guess is that the
> > mount isn't
> > > available when Tomcat starts which triggers the undeploy.
> > >
> > > Mark
> > >
> > 
> > That certainly seems to make sense. Would undeploy actually 
> delete the 
> > XML file? And would that happen even if autoDeploy="false"?
> > 
> 
> [Nick]
> 
> > Yes, for sure, to deleting the .XML file. I'm reasonably confident 
> > autoDeploy="false" doesn't affect undeploys. Even if it does, 
> > autoDeploy="false" only matters when the server is already 
> running. It 
> > does NOT matter when the server is started (i.e., even with 
> > autoDeploy="false", a WAR file would get auto-deployed when 
> the server 
> > was started, just not if it was added when the server was already 
> > running).
> > 
> > N
> > 
> 
> Good grief, thanks Mark and Nick. I am confident that we 
> found our culprit! Now I just need to figure out how to make 
> sure the tomcat scripts don't run until after the NFS mount 
> is available. I can't wait to implement these changes. Thanks again!

#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

See the line with chkconfig - S## E##?

Put those in your config before doing a chkconfig add, and it will cause them to
start in that order. Make sure they start after nfs and die before nfs and you
should be golden.


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Robinson, Eric" <er...@psmnv.com>.
> --
> > On 22/03/2011 17:04, Robinson, Eric wrote:
> > > 	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
> > > 	         debug="1" reloadable="false">
> > > 	</Context>
> >
> > So are nfs mounts being used? If so, my guess is that the 
> mount isn't 
> > available when Tomcat starts which triggers the undeploy.
> >
> > Mark
> >
> 
> That certainly seems to make sense. Would undeploy actually 
> delete the XML file? And would that happen even if autoDeploy="false"?
> 

[Nick]

> Yes, for sure, to deleting the .XML file. I'm reasonably 
> confident autoDeploy="false" doesn't affect undeploys. Even 
> if it does, autoDeploy="false" only matters when the server 
> is already running. It does NOT matter when the server is 
> started (i.e., even with autoDeploy="false", a WAR file would 
> get auto-deployed when the server was started, just not if it 
> was added when the server was already running).
> 
> N
> 

Good grief, thanks Mark and Nick. I am confident that we found our
culprit! Now I just need to figure out how to make sure the tomcat
scripts don't run until after the NFS mount is available. I can't wait
to implement these changes. Thanks again!

--Eric















Disclaimer - March 22, 2011 
This email and any files transmitted with it are confidential and intended solely for Tomcat Users List. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by Nick Williams <ni...@puresafety.com>.
Yes, for sure, to deleting the .XML file. I'm reasonably confident
autoDeploy="false" doesn't affect undeploys. Even if it does,
autoDeploy="false" only matters when the server is already running. It
does NOT matter when the server is started (i.e., even with
autoDeploy="false", a WAR file would get auto-deployed when the server was
started, just not if it was added when the server was already running).

N

--
Nick Williams, Senior Software Developer
PureSafety - Protecting Your People, Preserving Your Profits™

Toll Free: 888.202.3016 x177  |  Direct: 615.277.3177  |  Fax:
615.367.3887
730 Cool Springs Blvd. Suite 400 | Franklin, TN 37067 | www.puresafety.com


Learn How We Can Empower You. View Our Demos.


-----Original Message-----
From: Robinson, Eric [mailto:eric.robinson@psmnv.com]
Sent: Tuesday, March 22, 2011 12:21 PM
To: Tomcat Users List
Subject: RE: tomcat6 still deleting XML files from Catalina/localhost when
the system is booted

> On 22/03/2011 17:04, Robinson, Eric wrote:
> > 	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
> > 	         debug="1" reloadable="false">
> > 	</Context>
>
> So are nfs mounts being used? If so, my guess is that the
> mount isn't available when Tomcat starts which triggers the undeploy.
>
> Mark
>

That certainly seems to make sense. Would undeploy actually delete the
XML file? And would that happen even if autoDeploy="false"?

--Eric



















Disclaimer - March 22, 2011
This email and any files transmitted with it are confidential and intended
solely for Tomcat Users List. If you are not the named addressee you
should not disseminate, distribute, copy or alter this email. Any views or
opinions presented in this email are solely those of the author and might
not represent those of Physicians' Managed Care or Physician Select
Management. Warning: Although Physicians' Managed Care or Physician Select
Management has taken reasonable precautions to ensure no viruses are
present in this email, the company cannot accept responsibility for any
loss or damage arising from the use of this email or attachments.
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Robinson, Eric" <er...@psmnv.com>.
> On 22/03/2011 17:04, Robinson, Eric wrote:
> > 	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
> > 	         debug="1" reloadable="false">
> > 	</Context>
> 
> So are nfs mounts being used? If so, my guess is that the 
> mount isn't available when Tomcat starts which triggers the undeploy.
> 
> Mark
> 

That certainly seems to make sense. Would undeploy actually delete the
XML file? And would that happen even if autoDeploy="false"?

--Eric



















Disclaimer - March 22, 2011 
This email and any files transmitted with it are confidential and intended solely for Tomcat Users List. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by "Robinson, Eric" <er...@psmnv.com>.
> So are nfs mounts being used? If so, my guess is that the 
> mount isn't available when Tomcat starts which triggers the undeploy.
> 
> Mark
> 

Sadly, this turns out not to be the case. We modified the tomcat init
script so that it waits for the NFS mount to be available before trying
to start the java process. The script shows that the directories pointed
to by the Attachment.xml file are indeed readable before tomcat starts.
Nevertheless, tomcat still deletes the Attachment.xml file at boot time,
but not if you restart it later with the same init script.

For a reminder, here is the contents of the Attachment.xml file:

 <Context docBase="/ha_ftp.nfs/site001/mobiledoc"
         debug="1" reloadable="false">
 </Context>

I was so excited to think that we had figured it out.

New ideas, anyone?

--Eric

















Disclaimer - March 28, 2011 
This email and any files transmitted with it are confidential and intended solely for Tomcat Users List. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Physicians' Managed Care or Physician Select Management. Warning: Although Physicians' Managed Care or Physician Select Management has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by Nick Williams <ni...@puresafety.com>.
That would also explain why it's only happening on some of the servers,
but not all. The NFS mount becomes available part-way through all of the
Tomcats being started. So the ones that had started already trigger an
undeploy, but the ones that had not started yet have the mount available
and do net trigger an undeploy.

N

--
Nick Williams, Senior Software Developer
PureSafety - Protecting Your People, Preserving Your Profits™

Toll Free: 888.202.3016 x177  |  Direct: 615.277.3177  |  Fax:
615.367.3887
730 Cool Springs Blvd. Suite 400 | Franklin, TN 37067 | www.puresafety.com


Learn How We Can Empower You. View Our Demos.

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org]
Sent: Tuesday, March 22, 2011 12:18 PM
To: Tomcat Users List
Subject: Re: tomcat6 still deleting XML files from Catalina/localhost when
the system is booted

On 22/03/2011 17:04, Robinson, Eric wrote:
> 	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
> 	         debug="1" reloadable="false">
> 	</Context>

So are nfs mounts being used? If so, my guess is that the mount isn't
available when Tomcat starts which triggers the undeploy.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat6 still deleting XML files from Catalina/localhost when the system is booted

Posted by Mark Thomas <ma...@apache.org>.
On 22/03/2011 17:04, Robinson, Eric wrote:
> 	<Context docBase="/ha_ftp.nfs/site001/mobiledoc"
> 	         debug="1" reloadable="false">
> 	</Context>

So are nfs mounts being used? If so, my guess is that the mount isn't
available when Tomcat starts which triggers the undeploy.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org