Solved

Tomcat Startup

Posted on 2004-08-17
8
514 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
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
 
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
Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

 
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

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
X-Frame-Options - click-jacking 7 56
Script 12 133
Asp.net plan security, reliable, stable 2 110
Change local server setting in php 6 81
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…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now