[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 523
  • Last Modified:

Tomcat Startup

We have itools installed and we run Apache and Tomcat. Recently we upgraded all servers, and after upgrade the Tomcat wouldn't start.
After the install we get a file with no name in the root directory, the file's content is very similar to web.xml file's content, but I cannot be sure since the file has no name. When trying to start the tomcat, it complains that JAVA_HOME is not set,
I tried
setenv JAVA_HOME /usr
Server still doesn't start, but I also realized that JAVA_HOME gets unset once the terminal is shut down.

We tried contacting customer support, all they told us is to wait few minutes for tomcat to start - which, of course is no help.
0
Gula
Asked:
Gula
2 Solutions
 
ronan_40060Commented:
0
 
rama_krishna580Commented:
Hi,

you may look into this document which clearly explains how to do the setup and test run of Tomcat server...

http://www.moreservlets.com/Using-Tomcat-4.html#Configure-Tomcat

i hope it may help you..

R.K
0
 
GulaAuthor Commented:
I did everything following the instructions, still JAVA_HOME is not remaining set.
I'm working on Mac OS10
if I try to
export JAVA_HOME
it gives me 'export command not found' error.
0
Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

 
magicMushCommented:
setenv JAVA_HOME /usr/JAVADIRECTORY   >>Are you pointing the java directory ??
at above it seem like you are pointing to /usr directory not java. the java directory might be under /usr but you still need to show which directory it is
and to keep the settings you OS needs to load the JAVA_HOME each time the OS reboots so you will need to add
the code to startup file. in linux bash.rc ??

it doesnt like export since you are not using bash shell or any other that supports export command.
hope thimight help

0
 
CajunBillCommented:
You need to set JAVA_HOME in one of the Tomcat startup scripts.

Typically you start up Tomcat from a script (startup.sh).
It calls otjher scripts.
One of them sets the value of JAVA_HOME.
These scripts are in the 'bin' subdirectory of Tomcat.
Search these scripts to find where JAVA_HOME is defined, and set it properly for your system.

Then restart Tomcat
(it might be a good idea to reboot the whole machine first, just to have a clean environment).

What is happening is that Tomcat starts in a new process, that does not have the JAVA_HOME variable set, even if you set it by hand before starting Tomcat.

Regards, CajunBill
0
 
magicMushCommented:


--------------------------------------------
just copy and paste the code in to a .sh file and it will take care of the rest
(Code From Cpanel changed for csh
---------------------------------------------
#!/bin/sh

##Initialize it for the first Time

export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export XML=$JAVA_HOME/lib
export JAVAMYSQL=$JAVA_HOME/lib
export SSL=$JAVA_HOME/lib
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip:$XML/jaxp.jar:$XML/crimson.jar:$XML/xalan.jar:$SSL/jcert.jar:$SSL/jnet.jar:$SSL/jsse.jar:$JAVAMYSQL/mm.mysql-2.0.4-bin.jar
export PATH="$PATH:/usr/local/bin:/usr/X11R6/bin"
export JAKARTA_HOME=/usr/local/jakarta
export TOMCAT_HOME=$JAKARTA_HOME/build/tomcat

#Check if you are running Bash Shell

if [ "`grep TOMCAT /etc/bashrc`" = "" ]; then

cat <<EOM >> /etc/bashrc
export JAVA_HOME=/usr/local/jdk
export PATH=\$JAVA_HOME/bin:\$PATH
export XML=\$JAVA_HOME/lib
export SSL=\$JAVA_HOME/lib
export JAVAMYSQL=\$JAVA_HOME/lib
export CLASSPATH=.:\$JAVA_HOME/lib/classes.zip:\$XML/jaxp.jar:\$XML/crimson.jar:\$XML/xalan.jar:\$SSL/jcert.jar:\$SSL/jnet.jar:\$SSL/jsse.jar:\$JAVAMYSQL/mm.mysql-2.0.4-bin.jar
export PATH="\$PATH:/usr/local/bin:/usr/X11R6/bin"
export JAKARTA_HOME=/usr/local/jakarta
export TOMCAT_HOME=\$JAKARTA_HOME/build/tomcat
EOM

fi
#check if you are running BSD type machines or machines with no bash shell

if [ "`grep starttomcat /etc/rc.d/rc.local`" = "" ]; then
      
#add the startup file to the rc.local so it can execute it everytime system startsup

echo "/usr/sbin/starttomcat" >> /etc/rc.d/rc.local
fi
#create the startup file

cat <<EOM > /usr/sbin/starttomcat
#!/bin/sh
export JAVA_HOME=/usr/local/jdk
export PATH=\$JAVA_HOME/bin:\$PATH
export XML=\$JAVA_HOME/lib
export SSL=\$JAVA_HOME/lib
export JAVAMYSQL=\$JAVA_HOME/lib
export CLASSPATH=.:\$JAVA_HOME/lib/classes.zip:\$XML/jaxp.jar:\$XML/crimson.jar:\$XML/xalan.jar:\$SSL/jcert.jar:\$SSL/jnet.jar:\$SSL/jsse.jar:\$JAVAMYSQL/mm.mysql-2.0.4-bin.jar
export PATH="\$PATH:/usr/local/bin:/usr/X11R6/bin"
export JAKARTA_HOME=/usr/local/jakarta
export TOMCAT_HOME=\$JAKARTA_HOME/build/tomcat
(cd $JAKARTA_HOME/build/tomcat; ./bin/startup.sh)
EOM

chmod 700 /usr/sbin/starttomcat

#create the stop file

cat <<EOM > /usr/sbin/stoptomcat
#!/bin/sh
export JAVA_HOME=/usr/local/jdk
export PATH=\$JAVA_HOME/bin:\$PATH
export XML=\$JAVA_HOME/lib
export SSL=\$JAVA_HOME/lib
export JAVAMYSQL=\$JAVA_HOME/lib
export CLASSPATH=.:\$JAVA_HOME/lib/classes.zip:\$XML/jaxp.jar:\$XML/crimson.jar:\$XML/xalan.jar:\$SSL/jcert.jar:\$SSL/jnet.jar:\$SSL/jsse.jar:\$JAVAMYSQL/mm.mysql-2.0.4-bin.jar
export PATH="\$PATH:/usr/local/bin:/usr/X11R6/bin"
export JAKARTA_HOME=/usr/local/jakarta
export TOMCAT_HOME=\$JAKARTA_HOME/build/tomcat
(cd $JAKARTA_HOME/build/tomcat; ./bin/shutdown.sh)
kill -9 \`ps ww |grep tomcat|grep java|grep -v grep |awk '{ print \$1 }'\`
EOM

chmod 700 /usr/sbin/stoptomcat

echo "Install Complete.  You must add following lines to httpd.conf under the last AddModule line"
echo "
Include \"/usr/local/jakarta/build/tomcat/conf/mod_jk.conf\"
and
index.jsp to the DirIndex
"

---------------------------------------------------------------Do not include these lines
Taken from Cpanel's unsupported  Jsp Installer Script
hope this will solve your problem
0
 
magicMushCommented:
And dont forget to change the paths to fit your locations
0
 
GulaAuthor Commented:
I actually already fixed the problem,
I needed to add code to the script files, like CajunBill and magicMush sugested, I wish you guys replied earlier, you would save me days of struggle.

I did have to set JAVA_HOME to /usr, the problem wasnt' the path, it was that JAVA_HOME would just disappear once the terminal is shut down, so I didn't know what to do to make it reamin.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now