gmosx.ninja

Problems with deploying your app to GAE/J

I had a very annoying problem lately. The deployment of my app to GAE was failing randomly with mysterious errors like this:

com.google.apphosting.utils.config.AbstractConfigXmlReader
getTopLevelNode
SEVERE: Received IOException parsing the input stream for /home/.../war/WEB-INF/web.xml
java.net.ConnectException: Connection timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
 ...
SEVERE: Received exception processing /home/.../war/WEB-INF/web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Received
IOException parsing the input stream for /home/.../war/WEB-INF/web.xml
        at
com.google.apphosting.utils.config.AbstractConfigXmlReader.getTopLevelNode( AbstractConfigXmlReader.java:
210)

After an extended googling session I unearthed a solution in this helpful discussion thread. Just replace the doctype declaration in your web.xml file

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

with the following updated version:

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

That's all, one click deployment is working reliably again!