Solved

Tomcat Startup

Posted on 2004-08-17
8
518 Views
Last Modified: 2012-05-05
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
Comment
Question by:Gula
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 9

Expert Comment

by:ronan_40060
ID: 11824003
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 11827191
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
 
LVL 1

Author Comment

by:Gula
ID: 11851975
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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
LVL 1

Expert Comment

by:magicMush
ID: 11890521
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
 
LVL 7

Accepted Solution

by:
CajunBill earned 130 total points
ID: 11918020
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
 
LVL 1

Assisted Solution

by:magicMush
magicMush earned 120 total points
ID: 11920868


--------------------------------------------
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
 
LVL 1

Expert Comment

by:magicMush
ID: 11920875
And dont forget to change the paths to fit your locations
0
 
LVL 1

Author Comment

by:Gula
ID: 11921060
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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
What You Need to Know when Searching for a Webhost Provider
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question