0

我正在尝试在 Fedora 16 中启动 Tomcat。由于某种原因,catalina.sh 脚本没有采用任何参数,因此脚本总是最终打印使用条款:

[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

我尝试使用 catalina.sh 和 startup.sh 但都导致相同的效果。我检查了所有 .sh 文件都具有 x 权限:

[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]$ 

那么这里有什么问题呢?是否有可能由于某种奇怪的原因,脚本没有接受我的论点?

4

1 回答 1

0

这可能很愚蠢,原因是我在脚本中使用了类似 Windows 的变量定义:

set JAVA_OPTS=...

代替

export JAVA_OPTS=...

不幸的是,没有迹象表明脚本失败的原因。因此,如果您遇到这种情况,请仔细检查您的启动脚本是否存在语法错误。

于 2013-12-11T13:27:08.383 回答