Solved

Tomcat Startup

Posted on 2004-08-17
8
515 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Website Test Question 6 113
Asp.net plan security, reliable, stable 2 118
LAMP problem identifier tool ? 9 116
DNS @ Naked Domain Record 5 83
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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