Wednesday, November 10, 2010

Received IOException parsing the input stream for … web.xml

If you use Eclipse with the Google plugin to do development for App Engine, you might one day encounter the following error when you try to deploy your app:

  Received IOException parsing the input stream for …path/to/your/web.xml

This only happend when I updated my plugin recently, which is now:

  Google Plugin for Eclipse 3.5   1.4.0.v201010280047

The problem was the DTD in the header of the web.xml file, which was out of date. If you create a brand new Google Web Application Project, you can steal the proper header from that project.

Here’s what my web.xml header used to look like, causing deployment failure:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  ...
</web-app>

 

And here’s what the new header looks like:

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  ...
</web-app>