Servlet cannot be resolved in web.xml

For some reason, the idea illuminates the dispatcher servlet, and when I run tomcat you get 404 error. I use spring mvc and Maven, here is a photo of web.xml web.xml Appreciate every answer =) WebApp / web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app> 
+5
source share
6 answers

The problem found, used tomcat7-maven-plugin with the compiled version of maven-compiler-plugin 1.8, after changing it to 1.7, the problem disappeared. However, are there any similar solutions for tomcat7-maven-plugin ? Because I did not find tomcat8-maven-plugin on the Internet

Thank you all for participating.

+1
source

I had the same problem. It turned out that I used the old settings.xml file for the Maven user settings file. If anyone is having this problem, try using the Maven Template Users file.

+1
source

You also need to add a servlet mapping, and then add spring-webmvc-version.jar to the classpath

 <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> 
0
source

Open the settings below:
Project Settings → Borders → Web → Deployment Descriptors

check the path here and make sure it is accessible. If not, click green + to add the path to the web module.

0
source
  • Add spring mvc.jar file (if you use spring and mvc) to class libraries
  • Verify that the [name] -sevlet.xml file is installed correctly. use the name inside the name "sevlet-name" "servlet name" in web.xml.
0
source

I am adding a path for the web module. Using Intellij, click on the project structure, and then select Facets. Deployment descriptors should probably be empty (this is not good), so add a path.

-1
source

All Articles