Severe: Parse error in application web.xml

Dru Freeman picture Dru Freeman · Dec 29, 2013 · Viewed 16.5k times · Source

I am trying to teach myself Java, Java EE, and Tomcat pretty much all at once.
(Experienced C/Obj-C dev)

I was following a tutorial at YouTube at: http://www.youtube.com/watch?v=bd50C6XUnFw

I am running:

  • Apache Tomcat/7.0.47
  • JVM 1.7.0_45-b18
  • Mac OS X 10.8.5 x86_64

The error I'm seeing is:

SEVERE: Parse error in application web.xml file at jndi:/localhost/FirstServlet/WEB-INF/web.xml
org.xml.sax.SAXParseException; systemId: jndi:/localhost/FirstServlet/WEB-INF/web.xml; lineNumber: 8; columnNumber: 19; Error at (8, 19) : Can't convert argument: null
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2687)
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2719)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1054)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

As shown in the video the web.xml (at path /Library/Tomcat/webapps/firstservlet/WEB-INF) is:

<web-app>
    <servlet>
        <servlet-name>My FirstServlet</servlet-name>
        <servlet-class>FirstServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <url-pattern>/myfirstservlet</url-pattern>
    </servlet-mapping>
</web-app>

The error indicates that the issue is a null it's hitting after the </servlet-mapping>

So my only assumption is that the tutorial on YouTube is missing something and I must be missing an argument. Suggestions strongly welcomed.

Answer

PM 77-1 picture PM 77-1 · Dec 29, 2013

I believe you're missing <servlet-name>...</servlet-name> in <servlet-mapping> section:

<servlet-mapping>
    <servlet-name>My FirstServlet</servlet-name>
    <url-pattern>/myfirstservlet</url-pattern>
</servlet-mapping>

Have a look at basic web.xml file