3

Currently I am learning Spring MVC, when I run the Application on Tomcat server Version 9 , a 404 error comes with following error stack trace (Platform : Windows 10)

SEVERE: Parse error in application web.xml file at [file:/C:/Users/kaust/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springmvc/WEB-INF/web.xml] org.xml.sax.SAXParseException; systemId: file:/C:/Users/kaust/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springmvc/WEB-INF/web.xml; lineNumber: 14; columnNumber: 20; Error at line [14] column [20]: [Error converting [null] to type [java.lang.String]]

The below warning opens up in a dialog box : org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'servlet-mapping' not found.

My web.xml file

<web-app>
<display-name>Hello Spring MVC</display-name>

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-mapping>dispatcher</servlet-mapping>
    <url-pattern>/</url-pattern>
</servlet-mapping> </web-app>
Kaustubh Dwivedi
  • 418
  • 4
  • 16
  • 1
    The first is just a warning. Spring doesn't support tomcat 10 use tomcat 9. – M. Deinum Feb 04 '22 at 08:01
  • 2
    Please [don't upload text as image](https://meta.stackoverflow.com/a/285557/13447). Edit your question to contain all the information in text form - consider to use the editor's formatting options. Also see [ask]. – Olaf Kock Feb 04 '22 at 08:35
  • @OlafKock I removed the images and modified the question. – Kaustubh Dwivedi Feb 04 '22 at 11:03
  • @M.Deinum I switched to version 9 and modified my question. warning is gone, but java.lang.IllegalArgumentException still there – Kaustubh Dwivedi Feb 04 '22 at 11:29
  • 1
    [https://stackoverflow.com/questions/20821513/severe-parse-error-in-application-web-xml](https://stackoverflow.com/questions/20821513/severe-parse-error-in-application-web-xml).Check if this helps – Xtense Feb 04 '22 at 11:29
  • @Xtense Thanks it worked I missed the Servlet name in servlet mapping – Kaustubh Dwivedi Feb 04 '22 at 11:39

1 Answers1

1

<servlet-mapping> should enclose <servlet-name>...</servlet-name> instead of <servlet-mapping> tag

Here is the correct code:

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
Xtense
  • 636
  • 4
  • 13