2013-07-27 46 views
7

我寫了一個使用gmail發送郵件的程序,它的工作罰款,如果我分開執行,但當我整合谷歌appengine它給我下面的錯誤,

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) 

我相信,沒有整合錯誤或錯誤。我已經添加了javax.mail jar。

回答

2

您需要設置測試環境正常,像這樣:

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

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

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

GAE需要這些依賴關係:

<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> 
+0

謝謝,需要關於如何更新與pom.xml中的一些進一步的闡述雖然appengine測試依賴關係。 – theMarceloR

相關問題