Linux下tomcat无法启动/启动后无法用过127.0.0.1:8080访问解决方案

Posted rogear

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux下tomcat无法启动/启动后无法用过127.0.0.1:8080访问解决方案相关的知识,希望对你有一定的参考价值。

启动tomcat情况如下:

[email protected]:/usr/local/tomcat/apache-tomcat-8.5.20/bin# ./catalina.sh
Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.5.20
Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.5.20
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.5.20/temp
Using JRE_HOME: /usr/local/java/jdk1.8.0_144
Using CLASSPATH: /usr/local/tomcat/apache-tomcat-8.5.20/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-8.5.20/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

在一个网站上看到说这个是因为环境变量的问题,tomcat使用的环境变量是自己的或者是继承自当前用户的,所以在Linux里面即使你设置了java_home也不一定会用这个,所以要么你都继承root的环境变量,都统一起来确保你的系统里面的环境变量都是使用的同一个,要么就单独指定要使用的jdk。tomcat启动的时候需要盗用setclasspath.sh。只要在setclasspath.sh声明环境变量就可以知道你这个tomcat使用哪个jdk,打开tomcat的bin目录下面的setclasspath.sh,添加上,路径自己修改,添加在开头就行

export JAVA_HOME=/usr/local/java/jdk1.8.0_144
export JRE_HOME=/usr/local/java/jdk1.8.0_144/jre

然后重启tomcat就可以使用了























以上是关于Linux下tomcat无法启动/启动后无法用过127.0.0.1:8080访问解决方案的主要内容,如果未能解决你的问题,请参考以下文章

Linux下Tomcat启动正常,但浏览器无法访问

linux下tomcat无法启动报错

linux下tomcat启动正常,但是外部浏览器无法访问

linux下部署程序,tomcat启动正常,但网页无法访问

tomcat启动后 404 页面无法访问

虚拟机上的Tomcat无法访问