Having problems getting Email to work while following Google App Engine Tutorial for Java

技术标签: java.  Google-App-Engine  电子邮件

I've been working my way through a Google App Engine 教程。

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>

读书:

<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?我该如何解决它?

看答案

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


智能推荐

解决:Unable to correct problems,The following packages have unmet dep

$ sudo apt-get  install openssh-server  Reading package lists... Done Building dependency tree        Reading state information... Done Some packages could not be install...

Keras Tensorflow tutorial: Practical guide from getting started to developing complex deep neural ne

Keras is a high-level python API which can be used to quickly build and train neural networks using either Tensorflow or Theano as back-end. This tutorial assumes that you are slightly familiar with T...

如何开发你的第一个Java Google App Engine 程序

为Google app engine开发JAVA Hello Word After hearing the buzz about java support in Google App Engine I decided to write a hello, world application and run it on Google App Engine. 在听说GAP 支持java以后,我决定写一个...

Google App Engine引入了“实验性” Java 7运行时支持

在短暂的冬季休假后,Google App Engine团队已恢复其每月发布周期,并向云平台进行了1.7.5更新 。 从Java开发人员的角度来看,最大的功能是对Java 7运行时的“实验支持”的过早引入。 团队在10月选择了正式的运行时支持之前,曾在10月提供过详细的 Java 7 SDK功能来进行测试。 您可以通过三种方式配置Java 7支持:在 命令行中 ,配置 Ecl...

mail.EmailException: Sending the email to the following server failed : smtp.qq.com:465

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.qq.com:465     at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)  &n...

猜你喜欢

java For_While

###04.01_Java语言基础(控制跳转语句break语句) ###03.14_Java语言基础(循环结构概述和for语句的格式及其使用) * A:循环结构的分类       * for,while,do...while  * B:循环结构for语句的格式: *       ...

原型对象,原型链

函数都有prototype属性,它指向原型对象。 实例对象有__proto__属性,它指向对象原型 每一个原型对象都有constructor输赢,指向构造函数,每一个原型对象又具有__proto__属性,这个指向Object.prototype.在这里插入图片描述...

Node 调用 dubbo 服务的探索及实践

2.Dubbo简介 2.1 什么是dubbo Dubbo是一款高性能、轻量级的开源Java RPC框架,它提供了三大核心能力:面向接口的远程方法调用,智能容错和负载均衡,以及服务自动注册和发现。 2.2 流程图 Provider : 暴露服务的服务提供方。 Consumer : 调用远程服务的服务消费方。 Registry : 服务注册与发现的注册中心。 Monito...

mysql总结

mysql基础入门的总结     关于数据库:     数据库是软件开发人员要掌握的基本工具,软件的运行的过程就是操作数据的过程,数据库中的数据无非就是几个操作:增-删-查-改。         Mysql安装完成后,需要配置变量环境,找到配置路径path,然后把mysql安装目录bin文件导入就可以了。 然后运行cm...

adb及monkey常用命令

adb常用命令: 查看手机是否连接:adb devices   连接设备:adb connect 设备ip:端口号  若有连接多个设备需指明设备ip及端口号 安装APP:adb install [-r] 包名  -r表示覆盖安装,首次安装可省略 卸载APP:adb uninstall 包名 列出设备中所有应用包名:adb shell pm list packages ...

问答精选

Correctly formatting GCM notifications?

I'm currently trying out the google cloud messaging service with its sample application "Guestbook." https://developers.google.com/cloud/samples/mbs/ I'm attempting to send notifications tha...

Are there any performance benefits of using Asynchronous functions over Synchronous in Node Js?

Now I came across an article that distinguishes between an Asynchronous function and Synchronous functions. From my understanding of the different examples and explanations, synchronous functions are ...

Python: Costing calculator output

Good day all I'm busy creating a small costing calculator for the signage department. I'm not getting the calculator to output the amount. Brief Description: You enter the height and width and then wh...

Flask-SQLAlchemy - model has no attribute 'foreign_keys'

I have 3 models created with Flask-SQLalchemy: User, Role, UserRole role.py: user.py: user_role.py: If I try (in the console) to get all users via User.query.all() I get AttributeError: 'NoneType' obj...

Seeding many PRNGs, then having to seed them again, what is a good quality approach?

I have many particles that follow an stochastic process in parallel. For each particle, there is a PRNG associated to it. The simulation must go through many repetitions to get average results. For ea...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答