When writing the project, the servlet has been unable to work normally. After consulting the data for many times, we found the following possibilities.
First, automatic editing is not turned on
In the top project option, check build automatically from the drop-down list
Second: the version of the top header in web.xml is too low
The author uses @ webservlet (urlpatterns =/xxservlet) mode, which does not need to configure servlet file in web.xml, but only version 3.0 or above supports this mode. Therefore, in web.xml, there must be version = 3.1.
You can directly copy the following code to use.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>Project Name</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Third: Tomcat configuration problems
Remove Tomcat from the server and install Tomcat again according to the process.
1. Delete Tomcat
2. Select preference in the top window option. In the pop-up box, select server — runtime environment — and select the original Tomcat — remove
3. Then click Add to configure the Tomcat you downloaded.
I hope eclipse will work properly.
Read More:
- [Solved] javax.servlet.ServletException: Servlet[springmvc] Servlet.init()
- How to Solve Tomcat Error: Could not resolve view with name ‘xxx/xxxxxxx‘ in servlet with
- [Solved] IDEA2020 Error: Cannot resolve symbol ‘Servlet‘
- [Solved] Tomcat runs JavaWeb servlet Error 404
- IDEA Import Servlet Package Error [How to Solve]
- [Solved] Error creating bean with name ‘org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0‘:
- [Solved] Failed to bind properties under ‘spring.servlet.multipart.file-size-threshold‘ to
- [Solved] MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.Runtime
- Maven project running servlet jump JSP error: HTTP status 500 – unable to compile class for JSP
- [Solved] JAVA Project Import jstl Error: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
- [Solved] fastjson Error: write javaBean error, fastjson version 1.2.76, class io.undertow.servlet.xx
- [Solved] socket failed: EPERM (Operation not permitted)
- Hive operation TMP file viewing content error [How to Solve]
- Springboot WARNING: An illegal reflective access operation has occurred
- Error in make when installing redis6.0 in centos7
- [Solved] Spring Kafka Send Error in specifies partition: Topic radar not present in metadata after 60000
- [Solved] Kafka in Windows error:java. nio. file. Filesystemexception: this file is in use by another program and cannot be accessed by the process
- Resin Failed to Startup Error: ERROR: transport error 202: bind failed: Address already in use: JVM_Bind Listenin (Two Resins in One PC)
- [Solved] Web server failed to start. Port 8080 was already in use.
- Error creating bean with name ‘servletEndpointRegistrar‘ defined in class path resource