Kaustubh Dwivedi
Kaustubh Dwivedi

Reputation: 436

java.lang.IllegalArgumentException error on Tomcat server -SpringMVC

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>

Upvotes: 3

Views: 1036

Answers (1)

Xtense
Xtense

Reputation: 646

<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>

Upvotes: 1

Related Questions