Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

When the Web project is packed into a war package to deploy Tomcat, run startup.bat directly flashback deployment failed quick solution

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

That is to say, in the previous part, the web project was deployed to the Tomcat server as a war package, and after solving the mysql problem, there were new problems, which was a real twists and turns, so I would like to share the solution process with you, hoping to help my friends ~

Copy the typed war package to the webapps directory of Tomcat, then find the startup.bat batch file in the bin directory of Tomcat, and double-click directly to execute it. As a result, it flashes directly after running for a few seconds. I immediately have a bad feeling that when I visit the web project in the browser, even localhost:8080 can not be accessed, and the web project is not released successfully. I look confused ~

There is no log to see why the release is not successful. After thinking about it, you can slightly modify the startup.bat batch file and add PAUSE, so that the window will be closed only if you press any key at the end of the run (debug successfully, remove PAUSE).

If there is an error message, it will be displayed at this time, and you can follow its error message.

At this point, it is found that some environment variables are displayed, whether the error caused by the environment variable is not configured, so I checked it and found that the JRE_HOME environment variable was not configured. After configuration, it is found or flashed.

It is not clear when the environmental variables or what causes, there is no way out, can only find du Niang.

After checking the data, I find it very helpful to share some of the relevant contents about the principle of startup.bat in Tomcat. It may have nothing to do with solving this problem, but it can be skipped.

Startup.bat parsing

Verify that the CATALINA_HOME environment variable is set, if not, then check the catalina.bat file in the CATALINA_HOME/bin directory to determine whether the CATALINA_HOME environment variable is valid. If catalina.bat is not found, goto end, end.

Verify that the catalina.bat exists, and ends if it cannot.

Determine whether the startup startup.bat has parameters, and if so, assign values to the CMD_LINE_ARGS variable.

Catalina.bat is executed through call, passing in parameters.

In fact, the main function of startup.bat is to help you find catalina.bat and execute it.

Benefits:

If you configure the environment variable for CATALINA_HOME, you can put startup.bat in any directory and start tomcat.

Well, according to the parsing of the startup.bat file, it is found that the current problem has nothing to do with the environment variables. A little lost in an instant. Experience tells me that you can check the log. An error log amount was found in the log.

For the solution to the problem, please refer to: the Web project is deployed as a war package to the tomcat Times MySQL Access denied for user 'root'@'localhost' (using password: YES) error solution.

Summary of other Tomcat issues:

Question 1: Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

Tomcat's startup.bat, which calls catalina.bat, while catalina.bat calls setclasspath.bat, just declare the environment variable at the beginning of the setclasspath.bat (two lines in red), because the environment variable JAVA_HOME,JRE_HOME is not automatically registered after the newer version is installed.

This automatically registers JAVA_HOME,JRE_HOME every time you run startup.bat.

Question 2: Cannot find "D:\ Program Files\ apache-tomcat-7.0.52\ bin\ setclasspath.bat"

The value of CATALINA_HOME may be written dead somewhere, like my green version of tomcat in the bin file under a more setenv.bat file, open to see is really written in this dead CATALINA_HOME path, this should be for some reason to be added after the settings file, delete this file, tomcat can run normally.

In this case, you can take a look at the configuration in catalina.bat, as shown in the figure below. The dead configuration may be in this file.

Summary

The above is the quick solution of running startup.bat direct flashback deployment failure when the Web project is packed into war package to deploy Tomcat. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report