paul
paul

Reputation: 303

grails application no longer allows me to send email on localhost

I am working with a grails project and, when testing on my localhost, I use to be able to test my email functionality and send emails. Only thing I can think of is my computer made a few updates, including java, the other day. I'd love to hear some feedback on possible solutions. Right now I'm in the process of reinstalling java. Will keep this thread updated if I find any results.

Error
Error 500: Internal Server Error
URI /PerformanceEvaluations/performanceReview/673/evaluation/save
Class java.net.SocketException
Message Network is unreachable: connect

trace

Line | Method
->>   69 | socketConnect        in java.net.DualStackPlainSocketImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    339 | doConnect            in java.net.AbstractPlainSocketImpl
|    200 | connectToAddress . . in     ''
|    182 | connect              in     ''
|    157 | connect . . . . . .  in java.net.PlainSocketImpl
|    391 | connect              in java.net.SocksSocketImpl
|    579 | connect . . . . . .  in java.net.Socket
|    528 | connect              in     ''
|    284 | createSocket . . . . in com.sun.mail.util.SocketFetcher
|    227 | getSocket            in     ''
|   1672 | openServer . . . . . in com.sun.mail.smtp.SMTPTransport
|    525 | protocolConnect      in     ''
|    291 | connect . . . . . .  in javax.mail.Service
|    104 | sendMessage          in MailMessageBuilder.groovy
|     41 | sendMail . . . . . . in MailService.groovy
|    175 | doCall               in     GrailsMelodyGrailsPlugin$_closure5_closure18_closure19
|     46 | doCall . . . . . . . in EvaluationCreateService.groovy
|     42 | sendSupervisorsEmail in     ''
|     30 | create . . . . . . . in     ''
|    175 | doCall               in     GrailsMelodyGrailsPlugin$_closure5_closure18_closure19
|    116 | save . . . . . . . . in EvaluationController.groovy
|    195 | doFilter             in PageFragmentCachingFilter.java
|     63 | doFilter . . . . . . in AbstractFilter.java
|    117 | invoke               in net.bull.javamelody.JspWrapper
|    231 | invoke . . . . . . . in     net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler
|    197 | doFilter             in net.bull.javamelody.MonitoringFilter
|    171 | doFilter . . . . . . in     ''
|   1110 | runWorker            in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                  in java.lang.Thread

Upvotes: 1

Views: 516

Answers (1)

ataylor
ataylor

Reputation: 66059

Try turning on more logging to understand why it's not connecting. Setting the system properties mail.debug=true and javax.net.debug=all might provide additional information.

One common problem that you could be seeing is Java's aggressive use of IPv6. Grails could be attempting to connect with an IPv6 socket when the mail server is listening on IPv4. You can test this by running grails with the system property java.net.preferIPv4Stack=true. For example:

grails -Dmail.debug=true -Djavax.net.debug=all -Djava.net.preferIPv4Stack=true run-app

Upvotes: 3

Related Questions