Tomcat won't start automatically

Discuss installation of Scalix software

Moderators: ScalixSupport, admin

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Tomcat won't start automatically

Postby DColeman » Thu May 26, 2005 6:03 pm

New install on Scalix eval on SuSE Linux Ent. Server 9. If I restart the server, Tomcat doesn't automatically start. It also won't manually start using ./startup.sh, I have to use startup-using-launcher.sh. Any idea why?

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Fri May 27, 2005 8:06 pm

Hi. What happens when you run ./startup.sh? Do you get an error? What' are the permissions on startup.sh? How catalina.sh?

Thanks,
Rachel

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Sat May 28, 2005 1:05 pm

DC,

The Scalix 9.2.1 install does not currently integrate Tomcat into your OS startup; you will have to create the script for that manually in /etc/init.d. We do provide a sample script called tomcat in the admin_resource_kit subdirectory of the tar file. However, the sample was originally done for RedHat and Fedora, so to use it on SuSE, you will need to modify it a bit.

The next release of Scalix will automatically setup the startup mechanism for tomcat, so it gets restarted.

If you don't want to mess around with the scripts, you will have to manually start tomcat after each reboot by cd-ing into $CATALINA_HOME/bin and executing the ./startup.sh script from there.

Cheers,
Florian.
Florian von Kurnatowski, Die Harder!

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Postby DColeman » Tue May 31, 2005 12:00 pm

Thanks for the replies.

If I run ./startup.sh I get the following output:
mgmail:/opt/jakarta-tomcat-5.0.28/bin # ./startup.sh
Using CATALINA_BASE: /opt/jakarta-tomcat-5.0.28
Using CATALINA_HOME: /opt/jakarta-tomcat-5.0.28
Using CATALINA_TMPDIR: /opt/jakarta-tomcat-5.0.28/temp
Using JAVA_HOME: /usr/lib/java

And here's what ps -ef |grep tomcat shows:
mgmail:/opt/jakarta-tomcat-5.0.28/bin # ps -ef |grep tomcat
root 4350 4217 0 08:30 pts/1 00:00:00 grep tomcat

Manually using ./startup-using-launcher.sh does cause Tomcat to start.

I copied the sample script called tomcat from the admin_resource_kit subdirectory to /etc/init.d and modified the CATALINA_HOME= value and did the rest of the instructions in the tomcat file and, although it seemed to work, when I restarted the server, Tomcat still did not start automatically. What else do I need to modify in the tomcat script? SuSE Linux does not have /etc/rc.d/init.d, but rather /etc/init.d with subdirectories below that named rc0.d, rc1.d, rc2.d, rc3.d and on.

Thanks!

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Tue May 31, 2005 6:09 pm

Hi. It's interesting that you're not seeing any errors when you run ./startup.sh. I would like to confirm a few things. First, try running:

./catalina.sh run

from the /opt/jakarta-tomcat-5.0.28/bin subdirectory and post the output. Second, since startup-using-launcher.sh is working, did you create a setenv.sh file or did you hardcode JAVA_HOME in that file? Actually, to make things easier, could you post your startup-using-launcher.sh, your setenv.sh (if it exists) and your setclasspath.sh file?

Thanks,
Rachel

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Postby DColeman » Wed Jun 01, 2005 4:03 pm

Thanks Rachel, here is the info you requested:

>>First, try running ./catalina.sh run from the /opt/jakarta-tomcat-5.0.28/bin subdirectory and post the output.

mgmail:/opt/jakarta-tomcat-5.0.28/bin # ./catalina.sh run
Using CATALINA_BASE: /opt/jakarta-tomcat-5.0.28
Using CATALINA_HOME: /opt/jakarta-tomcat-5.0.28
Using CATALINA_TMPDIR: /opt/jakarta-tomcat-5.0.28/temp
Using JAVA_HOME: /usr/lib/java
The JVM option is invalid: -server
Could not create the Java virtual machine.

Usage: java [-options] class [args...]
(to execute a class)
or java [-jar] [-options] jarfile [args...]
(to execute a jar file)

where options include:
-cp -classpath <directories and zip/jar files separated by :>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options
-assert print help on assert options

>> Second, since startup-using-launcher.sh is working, did you create a setenv.sh file or did you hardcode JAVA_HOME in that file?

Neither.

>> could you post your startup-using-launcher.sh

mgmail:/opt/jakarta-tomcat-5.0.28/bin # more startup-using-launcher.sh
#!/bin/sh

# -----------------------------------------------------------------------------
#
# Script for starting Catalina using the Launcher
#
# -----------------------------------------------------------------------------

# Resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done

# Get standard environment variables
PRGDIR=`dirname "$PRG"`
if [ -r "$PRGDIR"/setenv.sh ]; then
. "$PRGDIR"/setenv.sh
fi

# Execute the Launcher using the "catalina" target
exec "$JAVA_HOME"/bin/java -classpath "$PRGDIR" LauncherBootstrap -launchfile ca
talina.xml -verbose catalina "$@" start


>> your setenv.sh (if it exists)
setenv.sh does not exist.


>> and your setclasspath.sh file

mgmail:/opt/jakarta-tomcat-5.0.28/bin # more setclasspath.sh
# Added by Scalix Wizard version 9.2.1.115 (do not remove any of this section)
JAVA_HOME=/usr/lib/java
JAVA_OPTS="-server -Xms1024m -Xmx1024m"
# End of added Scalix Wizard entries
# -----------------------------------------------------------------------------
# Set CLASSPATH and Java options
#
# $Id: setclasspath.sh,v 1.7.2.1 2004/08/21 15:49:50 yoavs Exp $
# -----------------------------------------------------------------------------

# Make sure prerequisite environment variables are set
if [ -z "$JAVA_HOME" ]; then
echo "The JAVA_HOME environment variable is not defined"
echo "This environment variable is needed to run this program"
exit 1
fi
if $os400; then
if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
fi
else
if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HO
ME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
fi
fi
if [ -z "$BASEDIR" ]; then
echo "The BASEDIR environment variable is not defined"
echo "This environment variable is needed to run this program"
exit 1
fi
if [ ! -x "$BASEDIR"/bin/setclasspath.sh ]; then
echo "The BASEDIR environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
exit 1
fi

# Set the default -Djava.endorsed.dirs argument
JAVA_ENDORSED_DIRS="$BASEDIR"/common/endorsed

# Set standard CLASSPATH
CLASSPATH="$JAVA_HOME"/lib/tools.jar

# OSX hack to CLASSPATH
JIKESPATH=
if [ `uname -s` = "Darwin" ]; then
OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Class
es"
if [ -d "$OSXHACK" ]; then
for i in "$OSXHACK"/*.jar; do
JIKESPATH="$JIKESPATH":"$i"
done
fi
fi

# Set standard commands for invoking Java.
_RUNJAVA="$JAVA_HOME"/bin/java
if [ $os400 = false ]; then
_RUNJDB="$JAVA_HOME"/bin/jdb
fi
_RUNJAVAC="$JAVA_HOME"/bin/javac

dgu
Posts: 24
Joined: Wed Dec 08, 2004 8:27 am

Postby dgu » Wed Jun 01, 2005 4:51 pm

Hi,

we had the same problem after we updated to scalix 9.2. After a change from IBM-Java to Sun-Java tomcat runs fine :).

Cheers,
dgu

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Re: Java

Postby DColeman » Wed Jun 01, 2005 5:00 pm

I did download and install Sun Java J2SE SDK (1.4.2.08) per the Scalix installation instructions. I'm not sure how to tell which Java is actually be used though.

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Wed Jun 01, 2005 11:30 pm

Okay, now we're getting somewhere. Could you type:

ls -l /usr/lib/java/bin

and post the output? Then type:

/usr/lib/java/bin/java -version

and post that output? When you installed the 1.4.2.08 j2se, where did you install it? I believe the default is

/usr/java/j2sdk1.4.2_08

so your JAVA_HOME should be:

JAVA_HOME=/usr/java/j2sdk1.4.2_08

Thanks,
Rachel

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Postby DColeman » Thu Jun 02, 2005 11:43 am

>> Could you type ls -l /usr/lib/java/bin and post the output?
mgmail:~ # ls -l /usr/lib/java/bin
total 513
drwxr-xr-x 2 root root 696 May 26 11:58 .
drwxr-xr-x 6 root root 168 May 26 11:58 ..
-rwxr-xr-x 1 root root 835 Jul 1 2004 HtmlConverter
-rwxr-xr-x 1 root root 34711 Jul 1 2004 appletviewer
-rwxr-xr-x 1 root root 34711 Jul 1 2004 extcheck
-rwxr-xr-x 1 root root 34743 Jul 1 2004 idlj
-rwxr-xr-x 1 root root 34711 Jul 1 2004 jar
-rwxr-xr-x 1 root root 34711 Jul 1 2004 jarsigner
lrwxrwxrwx 1 root root 15 May 26 11:58 java -> ../jre/bin/java
-rwxr-xr-x 1 root root 2277 Jul 1 2004 java-rmi.cgi
-rwxr-xr-x 1 root root 34743 Jul 1 2004 javac
-rwxr-xr-x 1 root root 34711 Jul 1 2004 javadoc
-rwxr-xr-x 1 root root 34711 Jul 1 2004 javah
-rwxr-xr-x 1 root root 34711 Jul 1 2004 javap
lrwxrwxrwx 1 root root 16 May 26 11:58 javaw -> ../jre/bin/javaw
-rwxr-xr-x 1 root root 34743 Jul 1 2004 jdb
-rwxr-xr-x 1 root root 34743 Jul 1 2004 jformat
lrwxrwxrwx 1 root root 18 May 26 11:58 keytool -> ../jre/bin/keytool
-rwxr-xr-x 1 root root 34711 Jul 1 2004 native2ascii
lrwxrwxrwx 1 root root 21 May 26 11:58 policytool -> ../jre/bin/policytool
-rwxr-xr-x 1 root root 34711 Jul 1 2004 rmic
lrwxrwxrwx 1 root root 15 May 26 11:58 rmid -> ../jre/bin/rmid
lrwxrwxrwx 1 root root 22 May 26 11:58 rmiregistry -> ../jre/bin/rmiregistry
-rwxr-xr-x 1 root root 34711 Jul 1 2004 serialver
lrwxrwxrwx 1 root root 20 May 26 11:58 tnameserv -> ../jre/bin/tnameserv
lrwxrwxrwx 1 root root 17 May 26 11:58 utetcf -> ../jre/bin/utetcf


>> Then type: /usr/lib/java/bin/java -version and post that output?
mgmail:~ # /usr/lib/java/bin/java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM build cxia321420-20040626 (JIT enabled: jitc))

>> When you installed the 1.4.2.08 j2se, where did you install it? I believe the default is /usr/java/j2sdk1.4.2_08
I did not specify a location, so it must have gone to the default. I do have a /usr/java/j2sdk1.4.2_08 subdirectory.

>> so your JAVA_HOME should be: JAVA_HOME=/usr/java/j2sdk1.4.2_08
Which file or files do I need to set this in?

Thanks!

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Thu Jun 02, 2005 11:59 am

Hi. The fille you'll want to update is your:

/opt/jakarta-tomcat-5.0.28/bin/setclasspath.sh

file. If you edit that file, you'll see:

JAVA_HOME=/usr/lib/java

currently in there. Change that to read:

JAVA_HOME=/usr/java/j2sdk1.4.2_08

then stop tomcat and restart it using ./startup.sh. It should work now.

Thanks,
Rachel

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Postby DColeman » Thu Jun 02, 2005 12:21 pm

Ok, that did the trick for using ./startup.sh. Next question is, how do I get Tomcat to startup automatically when the server is started? This is SuSE Linux Enterprise Server 9. Thanks!

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Thu Jun 02, 2005 12:29 pm

DColeman wrote:Ok, that did the trick for using ./startup.sh. Next question is, how do I get Tomcat to startup automatically when the server is started? This is SuSE Linux Enterprise Server 9. Thanks!


The easiest would probably to set it using YAST. Go into the runlevel properties and look for the Tomcat entry. Set it to run on run levels 3 and 5 and you are all set.

Cheers,

Sascha.

DColeman
Posts: 19
Joined: Thu May 26, 2005 3:44 pm

Postby DColeman » Thu Jun 02, 2005 12:50 pm

Thanks for the input!

YaST shows that Tomcat is currenty set to runlevels 3 and 5 (I seem to recall setting this from the command line during the install). However, YaST also shows that Tomcat isn't running, even though it actually is. I tried to "Start" Tomcat through YaST and it returned the following error:
"/etc/init.d/tomcat: line 36: /etc/init.d/functions: No such file or dir"

The error is correct, there is no file or subdirectory named functions under /etc/init.d

dgu
Posts: 24
Joined: Wed Dec 08, 2004 8:27 am

Postby dgu » Thu Jun 02, 2005 1:11 pm

Hi,

my suggestion:

-save the initscript from tomcat in /etc/init.d
-uninstall the IBM-Java with Yast
-install with Yast the 2 Sun-Java packages(jre, sdk) from the SLES 9 CDs, Yast create then a initscript for the tomcat automatically
- rctomcat start


Cheers
dgu


Return to “Installation”



Who is online

Users browsing this forum: No registered users and 1 guest