When a Web project is packaged as a war package to deploy Tomcat, startup. bat is run to crash the deployment failure solution, tomcatstartup. bat

Source: Internet
Author: User

When a Web project is packaged as a war package to deploy Tomcat, startup. bat is run to crash the deployment failure solution, tomcatstartup. bat

That is to say, in the previous article, after the web Project is packaged into a war package and deployed to the Tomcat server, a new problem occurs after the mysql problem is solved, which is a trigger, so I will share the solution process with you, hope to help our friends ~

Copy the war package to the webapps directory of Tomcat, and find startup in the bin directory of Tomcat. bat batch file, double-click the execution directly, and the result will flash back after running for a few seconds. There is a bad hunch that the web project can be accessed in a browser and the result cannot be accessed even localhost: 8080, the web project has not been released successfully ~

If no log is available, you can't see why the release fails. If you want to, you can modify startup a little. add PAUSE to the bat batch file. In this way, the window will be closed only when any key is pressed at the end of the operation (debugging is successful and PAUSE is removed ).

If there is an error message, it will be displayed at this time. You can follow the error prompt.

At this time, some environment variables are displayed. Is there any error caused by environment variables not being configured? Check and find that JRE_HOME environment variables are not configured. After the configuration, it is found that it is still flashing back.

I don't know what causes the environment variables. I can only find duniang again.

After checking the information, I think it is very helpful to learn about the startup. bat principle in Tomcat. If you extract some of the clips and share them, it may be okay to solve this problem. You can skip this step ~

Startup. bat Parsing

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

Verify whether catalina. bat exists. If not, it ends.

Determine whether startup. bat has a parameter. If yes, assign the value to the CMD_LINE_ARGS variable.
Run catalina. bat through call and input parameters.

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

Benefits:

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

Okay. According to the parsing of the startup. bat file, we found that the current problem has nothing to do with the environment variable. A little lost in an instant. Experience tells me that you can view logs. Error Log amount found in the log.

For solution to the problem, see MySQL Access denied for user 'root' @ 'localhost' (using password: YES) when the Web project is packaged into a war package and deployed to tomcat.

Summary of other Tomcat problems:

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

Tomcat startup. bat, which calls catalina. bat, While catalina. bat calls setclasspath. bat, as long as it is in setclasspath. the environment variables (two red lines) can be declared at the beginning of bat, because later versions will not automatically register the environment variables JAVA_HOME and JRE_HOME after installation.

In this way, JAVA_HOME and JRE_HOME are automatically registered every time you run startup. bat.

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

It may be that the value of CATALINA_HOME has been written to death somewhere. For example, my green tomcat has a setenv added to the binfile. to open the bat file, you can see that the path of CATALINA_HOME has been written to death. This should be the setting file added after the file is deleted for some reason, tomcat can run normally.

In this case, you can check the configuration in catalina. bat. For example, the dead content may be configured in this file.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.