2012-10-12 49 views
1

我剛開始深入研究ICEsoft。我有一個ICEmobile項目,我嘗試實現向用戶發送通知。我使用Tomcat 7,ICEmobile 1.1,ICEfaces 3,而我的IDE是Eclipse Juno 4.2。 下面是渲染消息一些代碼片段:無法在ICEmobile項目中發送電子郵件

/** from NotificationBean class (ApplicationScoped) **/ 
    // render group is the current session id. 
    public String renderGroup = "renderGroup"; 

    public NotificationBean() { 
     PushRenderer.addCurrentSession(renderGroup); 
    } 

    /** from NotificationController class (ViewScoped) **/ 
    NotificationBean notifBean = (NotificationBean)FacesUtils.getManagedBean("notificationBean"); 
    public void sendPriorityPushMessage(ActionEvent event) { 
     final PushMessage myMessage = new PushMessage(notifBean.getSubject(), notifBean.getMessage()); 
     final PortableRenderer portable = PushRenderer.getPortableRenderer(); 
     ... 
     portable.render(notifBean.renderGroup, myMessage); 
     ... 

    } 

我以這樣的方式配置的SMTP設置在web.xml中我:

smtp.host:smtp.gmail.com

smtp.from:[email protected]

smtp.port:465

smtp.user:[email protected]

smtp.password ...

smtp.security:SSL

smtp.verify服務器證書 - 假

我測試這一切在Android模擬器,在ICEmobile集裝箱(4.1 ,16 + Google API)。在那裏我取消了C2DM通知屬性,並在「電子郵件通知」中輸入了我的電子郵件地址。

與該代碼我無法發送電子郵件。我得到這樣一個錯誤:

WARNING: Failed to send email message. 
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; 
    nested exception is: 
    java.net.SocketException: Connection reset 
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934) 
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638) 
    at javax.mail.Service.connect(Service.java:295) 
    at org.icepush.EmailNotificationProvider$SendMessage.run(EmailNotificationProvider.java:138) 
Caused by: java.net.SocketException: Connection reset 
    at java.net.SocketInputStream.read(Unknown Source) 
    at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source) 
    at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source) 
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) 
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) 
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
    at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:507) 
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238) 
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900) 

我想念什麼?我試圖配置我的Tomcat,但不知道如何正確地做 - 也許提示是在那?

由於提前, 伊琳娜

回答

0

我通過更新我的mail.jar解決這個問題。我的太老了。