开发者

Exception while using JavaMail with Google AppEngine: How to fix this?

开发者 https://www.devze.com 2023-01-08 12:14 出处:网络
I am trying to write a Java program using J开发者_如何学CavaMail 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 t

I am trying to write a Java program using J开发者_如何学CavaMail 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)

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?


It is likely you are still somehow accidentally including a .jar file that shouldn't be included.

Right click on your project folder and check:

  • Properties -> java build path
  • Properties -> Java EE Module dependencies

And also make sure you the jar is not in /war/WEB-INF/lib/, jars that should not be uploaded to google should be stored in a separate location of your project, i recommend /lib/.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消