Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception in thread "main" com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'mail' or call 'Send()' was not found

I have written a program to send mail using gmail, its working fine if I execute it separately but When I integrating with google appengine its giving me the below error,

Exception in thread "main" com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'mail' or call 'Send()' was not found.
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:104)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:56)
at com.google.appengine.api.mail.MailServiceImpl.doSend(MailServiceImpl.java:98)
at com.google.appengine.api.mail.MailServiceImpl.send(MailServiceImpl.java:34)
at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:231)
at javax.mail.Transport.send(Transport.java:95)
at javax.mail.Transport.send(Transport.java:48)
at in.javadomain.PostMail.postMailMethod(PostMail.java:49)
at in.javadomain.PostMail.main(PostMail.java:20)

I am sure that no integration error or mistakes. I have added javax.mail jar also already.

like image 584
Naveen Avatar asked Jul 27 '13 07:07

Naveen


1 Answers

You need to setup the test environment properly, like this:

private final LocalServiceTestHelper helper =
    new LocalServiceTestHelper(new LocalMailServiceTestConfig());

@Before
public void setUp() {
    helper.setUp();
}

@After
public void tearDown() {
    helper.tearDown();
}

GAE requires these dependencies:

<properties>
  <gae.version>1.9.17</gae.version>
</properties>
...
<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-api-labs</artifactId>
  <version>${gae.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-api-stubs</artifactId>
  <version>${gae.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-testing</artifactId>
  <version>${gae.version}</version>
  <scope>test</scope>
</dependency>
like image 50
Moritz Petersen Avatar answered Oct 19 '22 13:10

Moritz Petersen