2013-02-12 123 views
0

我在关注此tutorial从应用引擎发送电子邮件。从Appengine发送邮件

Properties props = new Properties(); 
    Session session = Session.getDefaultInstance(props, null); 
    String msgBody = "..."; 
    try { 
     Message msg = new MimeMessage(session); 
     msg.setFrom(new InternetAddress("[email protected]")); 
     msg.addRecipient(Message.RecipientType.TO, 
       new InternetAddress("[email protected]")); 
     msg.setSubject("Your Example.com account has been activated"); 
     msg.setText(msgBody); 
     Transport.send(msg); 

    } catch (AddressException e) { 
     // ... 
    } catch (MessagingException e) { 
     // ... 
    } 

但是我得到这个错误

javax.servlet.ServletContext log: Exception while dispatching incoming RPC call 
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.Boolean net.adeptus.client.util.UtilService.sendMailActivation(net.adeptus.client.DTO.PlayerDTO)' threw an unexpected exception: java.lang.NoClassDefFoundError: com/sun/mail/util/TraceOutputStream 
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385) 
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588) 
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) 
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) 
at 

我检查了,我不是使用Oracle罐子和邮件发送者的存在。

有什么想法?

+0

错误说,你在GWT一定的误差为你发送邮件的代码是绝对的罚款。你错过了一些罐子。 – 2013-02-12 19:48:49

+0

你知道sdk里面需要哪个jar吗?如果我在eclipse中检查每个包含点到一个类。 – DecaXD 2013-02-12 20:35:26

+0

我好蠢!我忘了删除imap.jar。现在很好。问题是我有更多的瓶子。在教程上感谢 – DecaXD 2013-02-12 21:39:23

回答

-1

此错误表示此类定义在编译时发现,但在运行时找不到。

尝试将JavaMail API文件添加到LIB文件夹中。

(我个人使用的版本1.4.1。(http://download.java.net/maven/1/javax.mail/jars/))

希望这有助于

+1

写道,所有的库都包含在SDK中。如果我添加该库,问题没有解决。 – DecaXD 2013-02-12 17:31:09

+0

不需要oracle的罐子。 – 2013-02-12 19:36:32

+0

对不起,谢谢你的反馈 – 2013-02-18 19:45:40