使用JavaMail与Google AppEngine异常:如何解决这个问题? [英] Exception while using JavaMail with Google AppEngine: How to fix this?

查看:103
本文介绍了使用JavaMail与Google AppEngine异常:如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JavaMail编写一个Java程序,以便在两个用户之间发送电子邮件。我没有将mail.jar和activation.jar文件添加到我的appengine项目中,因为我读到某处会导致异常被抛出,因为该功能已经可以在appengine .jar文件中使用。但是我的程序正在抛出以下异常: -

I am trying to write a Java program using JavaMail to send an email between 2 users. I have NOT added mail.jar and activation.jar files to my appengine project as I read somewhere that this would cause exceptions to be thrown since the functionality is already available with the appengine .jar files. But my program is throwing the following exception:-

Exception in thread "main" com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'mail' or call 'Send()' was not found.
- Hide quoted text -
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:95)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:48)
at com.google.appengine.api.mail.MailServiceImpl.doSend(MailServiceImpl.java:95)
at com.google.appengine.api.mail.MailServiceImpl.send(MailServiceImpl.java:32)
at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:247)
at javax.mail.Transport.send(Transport.java:95)
at javax.mail.Transport.send(Transport.java:48)
at weatherForecast.SendEmail.main(SendEmail.java:40)

我阅读了以下文章: http://forums.smartclient.com/showthread.php?t=8589 ,我需要从我的项目中删除appengine .jar文件,使事情工作。但是,我的Web应用程序还涉及到.jsp文件,其中包含一些数据,这些数据是部署在Google appengine上时的Google App的欢迎页面,一旦我删除.jars,该项目就无法正常工作。它确实帮助我摆脱了异常。任何人都可以建议一种方式来编写一个电子邮件程序,并使其在google appengine项目上工作?

I read in the following post: http://forums.smartclient.com/showthread.php?t=8589 that I need to remove appengine .jar files from my project to make things work. But my web application also involves rendering a .jsp file populated with some data which is the welcoming page of my Google App when deployed on google appengine and the project fails to work once I remove the .jars. It does help me in getting rid of the exception though. Can anyone please suggest a way to write an email program and make it work on a google appengine project?

推荐答案

如果您使用Flexible这是因为Google在flex环境中不支持邮件服务。在GAE中使用内置邮件服务的Java Mail似乎被设计为仅在标准Java框架中工作,这个迁移提示。在灵活的情况下,引入三个第三方的邮件API来代替。您可以使用GMail API作为另一个选项。

If you use Flexible, this is because Google does not support Mail service in the flex environment. Java Mail with the built-in Mail service in GAE are seemed to be designed to work only in the standard Java framework on this Migration tips.. In flexible, three third party's mail API are introduced to be used instead. You may use GMail API for another option.

这篇关于使用JavaMail与Google AppEngine异常:如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆