tomcat starts "successfully", but the browser is not accessible

Today I tried to build a java environment on linux, and encountered a problem in tomcat. After decompressing and configuring the environment variables successfully, use startup.sh in the bin directory to start tomcat. From the printed log, it starts normally.

But when the webpage accesses port 8080, the expected screen does not appear

So I went to check the catalina.out log in the logs directory, which showed:

/usr/local/tomcat/apache-tomcat-9.0.26/bin/catalina.sh: line 467: %{JAVA_HOME}/jre/bin/java: No such file or directory

When I saw this log, I naturally thought whether the environment variables were mismatched, so I checked the environment variables and confirmed that the file %{JAVA_HOME}/jre/bin/java exists.

I found a lot of information on the Internet, the problem is in the environment variable, but it does not solve my current problem.

Later, I saw a netizen who said that after using the ./startup.sh command to start tomcat, the browser cannot access it, but using sudo ./startup.sh can successfully start and the browser can access it. Isn't this exactly the same as my current situation? I quickly tried it, and then I found an error.

I went to Baidu again to find the solution to this problem, only to know that it is not only necessary to set environment variables in the profile, but also to configure the path of JAVA_HOME or JRE_HOME in setclasspath.sh under the bin directory

After the setup is complete, use ./startup.sh to start tomcat, and use the ps -ef|grep tomcat command to check whether tomcat has started successfully (it is strongly recommended to execute this command after startup, I didn't check it before... I always thought that tomcat started successfully )

This indicates that the startup was successful

This delegate did not start successfully

After the startup is successful, use a browser to access port 8080 to see if the following page appears

If it doesn't appear, please check if the linux firewall is turned off

Close the page

Guess you like

Origin blog.csdn.net/m0_54850467/article/details/123701533