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

How to monitor Tomcat using LambdaProbe

Introduction: Lambda Probe (formerly known as Tom...

Essential Handbook for Web Design 216 Web Safe Colors

The color presentation on a web page will be affec...

Two ways to make IE6 display PNG-24 format images normally

Method 1: Please add the following code after <...

MySQL database query performance optimization strategy

Optimize queries Use the Explain statement to ana...

Example of ellipsis when CSS multi-line text overflows

Ellipses appear when multi-line text overflows Th...

The latest mysql-5.7.21 installation and configuration method

1. Unzip the downloaded MySQL compressed package ...

Programs to query port usage and clear port usage in Windows operating system

In Windows operating system, the program to query...

Vite introduces the implementation of virtual files

Table of contents background Importing virtual fi...

MySQL uses inet_aton and inet_ntoa to process IP address data

This article will introduce how to save IP addres...

JavaScript+html to implement front-end page sliding verification (2)

This article example shares the specific code of ...

Install and deploy java8 and mysql under centos7

Generally, learning Java and deploying projects a...

JavaScript to implement random roll call web page

JavaScript writes a random roll call webpage for ...

Detailed steps for installing, configuring and uninstalling QT5 in Ubuntu 14.04

1. I downloaded QT5.13 version before, but after ...