views:

37

answers:

1

I've been working my way through a Google App Engine tutorial.

I entered the code shown in section 6 and then tried to test the functionality as instructed.

However, regardless of what email address I put in the form's To: field, I get an error that looks like this:

Message send failure
HTTP ERROR 404
Problem accessing /_ah/mail/[email protected]. Reason:
    NOT_FOUND
Powered by Jetty://

Event though the test was apparently failing, I deployed the application to appspot.com

Here, I could not even access /_ah/mail/, so I sent an e-mail from Outlook. The application didn't receive it and the following bounced back:

Delivery to the following recipient failed permanently:

     [email protected]

----- Original message -----

Received: by 10.204.82.130 with SMTP id b2mr13438bkl.0.1285692691837;
        Tue, 28 Sep 2010 09:51:31 -0700 (PDT)
Return-Path: <[email protected]>
Received: from mail-bw0-f46.google.com (mail-bw0-f46.google.com
[209.85.214.46])
        by gmr-mx.google.com with ESMTP id z25si3874412bku.
5.2010.09.28.09.51.30;
        Tue, 28 Sep 2010 09:51:30 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 209.85.214.46 as permitted sender) client-ip=209.85.214.46;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com:
domain of [email protected] designates 209.85.214.46 as permitted
sender) [email protected]; dkim=pass (test mode) [email protected]
Received: by bwz11 with SMTP id 11so5254251bwz.5
        for <[email protected]>;
Tue, 28 Sep 2010 09:51:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:reply-
to:from:to:subject:date
         :organization:message-id:mime-version:content-type
         :content-transfer-encoding:x-mailer:thread-index:x-mimeole;
        bh=5hMmQ/fy4AdMWGj7dA7tHInFNumFfhg24xHggsIZKR4=;
        b=OitMOXiZONheUMpkDU8mVUdWhk2AhUAuBbnSnyqDs1WWOPx0Ao75bWHBZZ/
lhRtOO+
         yMvLhDvrN+/cTDnxuQI6ICBb1KZh9eeExMrgdaQGV+/
pnaBK3PAEotfL8QgX81V1AKFE
         j58cbhxWUH0JSTVckXucribInLNCNJnIqvyD0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=reply-to:from:to:subject:date:organization:message-id:mime-
version
         :content-type:content-transfer-encoding:x-mailer:thread-index
         :x-mimeole;

b=Adh4j5+8xWF7MKIT6YTBE8PXH2iQG4yi2hulXgQ0QL5ZB1qmTNJiu5U2MlwWzJF7zQ
         DR1uBnwVNu0WtZxzHbneVsZY
+aSH8sPrmgPFTZSHTGcCU0+SXW9UjyZndVJdFhPP2Nfc
         GBeolrTikuhBtU+1F9T23io6wJqEwLg7X6HnU=
Received: by 10.204.58.75 with SMTP id f11mr192120bkh.
138.1285692690387;
        Tue, 28 Sep 2010 09:51:30 -0700 (PDT)
Return-Path: <[email protected]>
Received: from blackbox (catv-86-101-152-197.catv.broadband.hu
[86.101.152.197])
        by mx.google.com with ESMTPS id 11sm5779682bkj.
23.2010.09.28.09.51.27
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 28 Sep 2010 09:51:29 -0700 (PDT)
Reply-To: <[email protected]>
From: "Brian Kessler" <[email protected]>
To: <[email protected]>
Subject: Go south
Date: Tue, 28 Sep 2010 18:52:12 +0200
Organization: Flux Szerviz BT.
Message-ID: <A878B05D923A4EDEBC8015D3B5448D2F@blackbox>
MIME-Version: 1.0
Content-Type: text/plain;
    charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
thread-index: ActfLX7QaTtIrEoETYWtToubxBHBOw==
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994

Way down south to mexico

--
Brian Kessler
[email protected]
+36 30 637 1824

Following a suggestion below, I modified the tutorial's

<servlet-mapping>
    <servlet-name>Email</servlet-name>
    <url-pattern>/_ah/mail/*</url-pattern>
</servlet-mapping>

to read:

<servlet-mapping>
    <servlet-name>Email</servlet-name>
    <url-pattern>/_ah/mail/.+</url-pattern>
</servlet-mapping>

which drastically changed the error when I tried to submit an email on the local server to:

Message send failure
HTTP ERROR 500
Problem accessing /_ah/mail/[email protected]. Reason:
    de/vogella/gae/java/todo/dao/Dao
Caused by:
java.lang.NoClassDefFoundError: de/vogella/gae/java/todo/dao/Dao
    at de.vogella.gae.java.todo.EmailServlet.doPost(EmailServlet.java:43)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.ClassNotFoundException: de.vogella.gae.java.todo.dao.Dao
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:151)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 28 more
Caused by:
java.lang.ClassNotFoundException: de.vogella.gae.java.todo.dao.Dao
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:151)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at de.vogella.gae.java.todo.EmailServlet.doPost(EmailServlet.java:43)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Powered by Jetty://

However, as per the tutorial, de.vogella.gae.java.todo.dao.Dao exists as an enum instead of a class. I tried to change this to a class, but eclipse immediately started to complain

Syntax Error on token "INSTANCE".  VariableDeclarator expected after this token.

Is the original tutorial doing so much wrong? And how can I fix it?

+1  A: 

Your web.xml needs an entry that matches /_ah/mail/.+, with a mapping to a servlet that handles those addresses.

Wooble
I tried to change "/_ah/mail/*" (in the tutorial) to "/_ah/mail/.+". While this didn't fix it, it drastically changed the error on the local website (as appended above).
Brian Kessler