Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 383342

Summary: Stack trace on server when i save "email" user settings
Product: [ECD] Orion Reporter: Simon Kaegi <simon_kaegi>
Component: ServerAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ken_walker, malgorzata.tomczyk
Version: 0.5   
Target Milestone: 2.0 RC1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Simon Kaegi CLA 2012-06-22 14:41:27 EDT
Using a downloaded Orion server when I go to the user page to set my email address and git stuff it succeeds but on the server I see the following stack trace:

!STACK 0
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
  nested exception is:
        java.net.ConnectException: Connection refused: connect
        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
        at javax.mail.Service.connect(Service.java:288)
        at javax.mail.Service.connect(Service.java:169)
        at org.eclipse.orion.server.useradmin.UserEmailUtil.sendEmail(UserEmailUtil.java:117)
        at org.eclipse.orion.server.useradmin.UserEmailUtil.sendEmailConfirmation(UserEmailUtil.java:129)
        at org.eclipse.orion.server.useradmin.servlets.UserHandlerV1.handleUserPut(UserHandlerV1.java:239)
        at org.eclipse.orion.server.useradmin.servlets.UserHandlerV1.handleRequest(UserHandlerV1.java:77)
        at org.eclipse.orion.server.useradmin.servlets.UserHandlerV1.handleRequest(UserHandlerV1.java:1)
        at org.eclipse.orion.server.useradmin.servlets.ServletUserHandler.handleRequest(ServletUserHandler.java:49)
        at org.eclipse.orion.server.useradmin.servlets.ServletUserHandler.handleRequest(ServletUserHandler.java:1)
        at org.eclipse.orion.server.useradmin.servlets.UserServlet.doGet(UserServlet.java:63)
        at org.eclipse.orion.server.useradmin.servlets.UserServlet.doPut(UserServlet.java:76)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:758)
Comment 1 John Arthorne CLA 2012-06-22 14:50:15 EDT
We need to allow the administrator to configure the location of the SMTP server.
Comment 2 Malgorzata Janczarska CLA 2012-06-25 07:45:18 EDT
(In reply to comment #1)
> We need to allow the administrator to configure the location of the SMTP
> server.

We allow, see this:
http://wiki.eclipse.org/Orion/Server_admin_guide#Email_configuration
Comment 3 Ken Walker CLA 2012-06-25 07:52:29 EDT
Is this new behavior? If we take an old server with the mail capability does it do this as well.  Perhaps a check to see if the server is not set before trying to validate the email address.
Comment 4 John Arthorne CLA 2012-06-25 09:00:50 EDT
I suggest we catch the MessagingException, and wrap it with a more helpful message for an Orion server administrator. Something like, "An error occurred while contacting the mail server. See the server administration guide for details on configuring the mail server used by Orion"
Comment 5 Malgorzata Janczarska CLA 2012-06-25 09:28:33 EDT
(In reply to comment #3)
> Is this new behavior?
No this has always been this way, it happens when user adds an email address. The email is useful only when it was verified, so we are trying to send a confirmation email always when user changes it in preferences.
I opened bug 383437 to hide the email field if we can't send the confirmation email.

(In reply to comment #4)
I'll change the error handling to something mode user-readable, especially when email settings are not configured. The correct error is already send to user, but it's not reported, see bug 383159.
Comment 6 Malgorzata Janczarska CLA 2013-02-04 07:12:02 EST
I changed the error handling. Now when there is a problem with sending emails, this is the message that is logged:
> !ENTRY org.eclipse.orion.server.servlets 4 0 2013-02-04 13:05:10.316
> !MESSAGE Error while sending email: Could not connect to SMTP host: localhost, port: 25. See http://wiki.eclipse.org/Orion/Server_admin_guide#Email_configuration for email configuration guide.
No more stack trace on console.