我刚刚开始深入研究ICEsoft。我有一个ICEmobile项目,我尝试在其中实现向用户发送通知。我使用Tomcat 7,ICEmobile 1.1,ICEfaces 3,我的IDE是Eclipse Juno 4.2。 以下是一些用于呈现消息的代码片段:
/** 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);
...
}
我已经在我的web.xml中配置了SMTP设置:
smtp.host:smtp.gmail.com
smtp.from:myaccount@gmail.com
smtp.port:465
smtp.user:myaccount@gmail.com
smtp.password ...
smtp.security:SSL
smtp.verify-server-certificate - false
我正在ICEmobile Container(4.1,16 + Google API)上的Android模拟器上测试所有这些。在那里,我取消选中了C2DM Notify属性,并在“电子邮件通知”中输入了我的电子邮件地址。
使用该代码我无法发送电子邮件。我收到这样的错误:
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 :(得分:0)
我通过更新mail.jar解决了这个问题。我太老了。