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>
6
  • 1
    The first is just a warning. Spring doesn't support tomcat 10 use tomcat 9. Commented Feb 4, 2022 at 8:01
  • 2
    Please don't upload text as image. Edit your question to contain all the information in text form - consider to use the editor's formatting options. Also see How to Ask. Commented Feb 4, 2022 at 8:35
  • @OlafKock I removed the images and modified the question. Commented Feb 4, 2022 at 11:03
  • @M.Deinum I switched to version 9 and modified my question. warning is gone, but java.lang.IllegalArgumentException still there Commented Feb 4, 2022 at 11:29
  • 1
    https://stackoverflow.com/questions/20821513/severe-parse-error-in-application-web-xml.Check if this helps Commented Feb 4, 2022 at 11:29

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.