Causes and solutions for the crash of startup.bat in CMD to start Tomcat

After double-clicking startup.bat in the installation-free tomcat, the startup window flashes by, and the tomcat service does not start. Let me share the reasons and solutions with you below.

The reason is: when starting tomcat, environment variables and configuration information need to be read. Without these information, environment variables cannot be registered, resulting in tomcat crashing.

Solution:

1. Find startup.bat in the bin folder of the decompressed tomcat, right-click -> Edit. Add the following two lines to the header of the file:

SET JAVA_HOME=D:\Java\jdk1.8.0_92 (java jdk directory)
SET TOMCAT_HOME=D:\apache-tomcat-7.0.68 (decompressed tomcat file directory)

 

2. The same. Find shutdown.bat in the bin folder of the unzipped tomcat, right-click -> Edit. Add the following two lines to the header of the file:

SET JAVA_HOME=D:\Java\jdk1.8.0_92 (java jdk directory)
SET TOMCAT_HOME=D:\apache-tomcat-7.0.68 (decompressed tomcat file directory)

3. Copy the web files you want to publish/deploy to the webapps directory of tomcat.

4. Double-click startup.bat to start tomcat and start successfully.

5. Double-click shutdown.bat to stop tomcat. Or you can stop tomcat directly by ctrl+c in the started tomcat window.

 

The following problems were encountered when managing tomcat:
1. The user name and password were required at the beginning. I didn't know what the user name and password were, but the input was incorrect.
Solution:
 Add the user conf folder in tomcat-users.xml according to the format, which
 is commented out by default. This is mainly to consider the security of the server. If it is a local test, remove the following comment, and then restart the server. , then enter
 <role rolename="tomcat"/>
 <role rolename="role1"/>
 <user username="tomcat" password="tomcat" roles="tomcat"/>
 <user username="both" password=" tomcat" roles="tomcat,role1"/>
 <user username="role1" password="tomcat" roles="role1"/>
users and passwords are clear at a glance.

 

2. After entering the manager interface, 403 Access Denied is displayed.
Solution:
 See this paragraph in the conf/tomcat-users.xml file:
 NOTE: By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user - the username and password are arbitrary.
 That is to say, in order to consider security, tomcat still does not have manager-gui management rights by default. If you want to use manager, you need to add it yourself Administrative rights (roles).
 

 You need to add such a permission (role)
 <role rolename=" manager-gui "/>

 Then add it to the required username and go to
 <user username="tomcat" password="tomcat" roles="tomcat ,manager-gui "/>
and that's OK.

 

 Reprint: http://www.jb51.net/article/53879.htm

           https://www.cnblogs.com/mingforyou/archive/2013/03/31/2991543.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326530665&siteId=291194637