Solved

Tomcat Startup

Posted on 2004-08-17
8
513 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
Comment Utility
0
 
LVL 23

Expert Comment

by:rama_krishna580
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Accepted Solution

by:
CajunBill earned 130 total points
Comment Utility
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
Comment Utility


--------------------------------------------
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
Comment Utility
And dont forget to change the paths to fit your locations
0
 
LVL 1

Author Comment

by:Gula
Comment Utility
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

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Join & Write a Comment

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

15 Experts available now in Live!

Get 1:1 Help Now