tomcatfedora16

Starting Apache Tomcat in Fedora 16 (Verne)


I am trying to start Tomcat in Fedora 16. For some reason, the catalina.sh script is not taking any arguments as a result of which the script always ends up printing the usage clause:

[demo@localhost bin]$ ./catalina.sh run
Using CATALINA_BASE:   /home/demo/tomcat-asm
Using CATALINA_HOME:   /home/demo/tomcat-asm
Using CATALINA_TMPDIR: /home/demo/tomcat-asm/temp
Using JRE_HOME:        /opt/java/jdk1.7.0_45/bin/java
Using CLASSPATH:       /home/demo/tomcat-asm/bin/bootstrap.jar:/home/demo/tomcat-asm/bin/tomcat-juli.jar
Usage: catalina.sh ( commands ... )
commands:
  debug             Start Catalina in a debugger
  debug -security   Debug Catalina with a security manager
  jpda start        Start Catalina under JPDA debugger
  run               Start Catalina in the current window
  run -security     Start in the current window with security manager
  start             Start Catalina in a separate window
  start -security   Start in a separate window with security manager
  stop              Stop Catalina, waiting up to 5 seconds for the process to end
  stop n            Stop Catalina, waiting up to n seconds for the process to end
  stop -force       Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
  stop n -force     Stop Catalina, wait up to n seconds and then use kill -KILL if still running
  configtest        Run a basic syntax check on server.xml - check exit code for result
  version           What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is defined

I tried using catalina.sh and startup.sh but both lead to the same effect. I checked that all the .sh files have x permissions:

[demo@localhost bin]$ ls -lah
total 740K
drwxrwxr-x.  2 demo demo 4.0K Dec 11 07:23 .
drwxrwxr-x. 11 demo demo 4.0K Dec 11 07:08 ..
-rw-rw-r--.  1 demo demo  28K Jul  2 02:59 bootstrap.jar
-rw-rw-r--.  1 demo demo  14K Sep 11 07:25 catalina.bat
-rw-rw-r--.  1 demo demo  14K Sep  5 13:35 catalina.bat~
-rwxrwxr-x.  1 demo demo  20K Dec 11 07:11 catalina.sh
-rw-rw-r--.  1 demo demo  20K Dec 11 07:11 catalina.sh~
-rw-rw-r--.  1 demo demo 2.2K Jul  2 02:59 catalina-tasks.xml
-rw-rw-r--.  1 demo demo  24K Jul  2 02:59 commons-daemon.jar
-rw-rw-r--.  1 demo demo 201K Jul  2 02:59 commons-daemon-native.tar.gz
-rw-rw-r--.  1 demo demo 2.1K Jul  2 02:59 configtest.bat
-rwxrwxr-x.  1 demo demo 2.0K Jul  2 02:59 configtest.sh
-rw-rw-r--.  1 demo demo 1.4K Jul  2 02:59 cpappend.bat
-rwxrwxr-x.  1 demo demo 7.4K Jul  2 02:59 daemon.sh
-rw-rw-r--.  1 demo demo 2.2K Jul  2 02:59 digest.bat
-rwxrwxr-x.  1 demo demo 2.0K Jul  2 02:59 digest.sh
-rw-rw-r--.  1 demo demo 3.2K Jul  2 02:59 setclasspath.bat
-rwxrwxr-x.  1 demo demo 3.5K Jul  2 02:59 setclasspath.sh
-rw-rw-r--.  1 demo demo 2.1K Jul  2 02:59 shutdown.bat
-rwxrwxr-x.  1 demo demo 2.0K Jul  2 02:59 shutdown.sh
-rw-rw-r--.  1 demo demo 2.1K Jul  2 02:59 startup.bat
-rwxrwxr-x.  1 demo demo 2.0K Jul  2 02:59 startup.sh
-rw-rw-r--.  1 demo demo  38K Jul  2 02:59 tomcat-juli.jar
-rw-rw-r--.  1 demo demo 282K Jul  2 02:59 tomcat-native.tar.gz
-rw-rw-r--.  1 demo demo 4.1K Jul  2 02:59 tool-wrapper.bat
-rwxrwxr-x.  1 demo demo 5.0K Jul  2 02:59 tool-wrapper.sh
-rw-rw-r--.  1 demo demo 2.1K Jul  2 02:59 version.bat
-rwxrwxr-x.  1 demo demo 2.0K Jul  2 02:59 version.sh
[demo@localhost bin]$ 

So what can be the problem here? Is it possible that for some odd reason, the script is not taking in my arguments?


Solution

  • Stupid as this might be, the reason was that I was using Windows-like variable definitions in the script:

    set JAVA_OPTS=...
    

    instead of

    export JAVA_OPTS=...
    

    It's unfortunate that there are no indications why the script fails. So if this ever happens to you, double-check your start scripts for syntax errors.