Why can't my tomcat start?

Why can't my tomcat start?

Phenomenon:

Tomcat is installed and ready to deploy the Web project. I start Tomcat and find that there is no response.

Although it shows Tomcat started. However, this started is not the same as success. When we open the browser to access port 8080, we find that our tomcat is not started.

Most tutorials on the Internet teach us to check port usage or configure the JDK environment. But in fact, we should analyze the reasons so that we can effectively deduce the results (my initial mistake was that there was an erroneous war package, which caused Tomcat to fail to start. This could not be discovered if we followed the online tutorials)

All of tomcat's logs are stored in the tomcat logs directory. The logs when tomcat is started are stored in catalina.***.log. *** represents the date. We can find the catalina.***.log of the current date and locate the problem through the log information.

Port usage:

At this time, we can first find out the thread occupying the port:

lsof -nP -i:8080 

Then kill the thread:

kill -9 pid

Spelling error in file:

From the error message, we can see that the cause of this problem is a spelling error in the second line of the file. We open the file and find that there is a space in the first line of the file. Just delete the space in the first line.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
 
<description> Servlet Example. </description>
<display-name> MyServlet Example </display-name>
<request-character-encoding>UTF-8</request-character-encoding>
 
<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>
</servlet>
 
<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/myservlet</url-pattern>
</servlet-mapping>
 
</web-app>

This is the end of this article about why my tomcat cannot be started. For more relevant content about tomcat cannot be started, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Double-click to start the startup.bat in tomcat and the reason and solution
  • Tomcat startup error: solution to java.util.zip.ZipException
  • Solution to the problem that startup.bat flashes when tomcat starts [Professional test and effective]
  • Tomcat starts normally, but all pages you visit report 404 exceptions. Summary and analysis of 404 exceptions
  • Solution to the problem that Tomcat service cannot be started
  • Solution to the problem that SecureRandom is very slow when Tomcat starts
  • How to handle Tomcat startup error (port 8080 is occupied)

<<:  Summary of JavaScript's setTimeout() usage

>>:  How to use negative margin technology to achieve average layout in CSS

Recommend

CSS scroll-snap scroll event stop and element position detection implementation

1. Scroll Snap is a must-have skill for front-end...

MySQL master-slave replication delay causes and solutions

Table of contents A brief overview of the replica...

Is it easy to encapsulate a pop-up component using Vue3?

Table of contents Summary put first: 🌲🌲 Preface: ...

Problems and solutions of using jsx syntax in React-vscode

Problem Description After installing the plugin E...

Rounding operation of datetime field in MySQL

Table of contents Preface 1. Background 2. Simula...

Some issues we should pay attention to when designing a web page

Web design, according to personal preferences and ...

How to add a pop-up bottom action button for element-ui's Select and Cascader

As shown in the figure below, it is a common desi...

mysql creates root users and ordinary users and modify and delete functions

Method 1: Use the SET PASSWORD command mysql -u r...

What should I do if I can't view the source file of a web page?

Q: Whether using Outlook or IE, when you right-cl...

jQuery plugin to implement minesweeper game (2)

This article shares the second article of using j...

How to build svn server in linux

1: Install SVN yum install -y subversion 2. Creat...

Solution to Navicat Premier remote connection to MySQL error 10038

Remote connection to MySQL fails, there may be th...

How to analyze SQL execution plan in MySQL through EXPLAIN

Preface In MySQL, we can use the EXPLAIN command ...

HTML page header code is completely clear

All the following codes are between <head>.....