Tomcat无法启动排查

现象描述

在tomcat目录下执行 ./startup.sh 始终得到如下的错误

 ceny@master:~/tools/apache-tomcat-8.5.9$ bin/catalina.sh stop -force
Using CATALINA_BASE:   /home/ceny/tools/apache-tomcat-8.5.9
Using CATALINA_HOME:   /home/ceny/tools/apache-tomcat-8.5.9
Using CATALINA_TMPDIR: /home/ceny/tools/apache-tomcat-8.5.9/temp
Using JRE_HOME:        /home/ceny/jdk1.7.0_79/jre
Using CLASSPATH:       /home/ceny/tools/apache-tomcat-8.5.9/bin/bootstrap.jar:/home/ceny/tools/apache-tomcat-8.5.9/bin/tomcat-juli.jar
Using CATALINA_PID:    /home/ceny/tools/apache-tomcat-8.5.9/conf/catalina.pid
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文件,结构如下:


catalina.sh

通过分析可以看到应该是参数1失效,导致进入了else判断,通过echo打印参数1发现是JRE_HOME=/xxx/xxx/xx
通过继续跟踪发现在 setclasspath.sh文件中使用了 set JAVA_HOME=/xxx,环境是linux环境,不能使用set命令,set会覆盖第一个入参,应该使用export才可以,set是windows环境使用


e6aa30aae26974d72371f7bf88258e0.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容