• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

SMTP issue using javamail

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am having an issue using SMTP/javamail that has only sometimes occurs. I have been running the code that uses SMTP without issue for months until recently when i have been getting the following error message:

14.05.2012 11:35:49 [DefaultQuartzScheduler_Worker-10] ERROR Task execution failed.
com.util.email.api.EmailNotificationException: javax.mail.MessagingException: Could not connect to SMTP host: relay.testserver.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.util.email.api.BaseNotification.send(BaseNotification.java:394)
at com.util.email.api.BaseNotification.send(BaseNotification.java:370)
at com.util.email.EmailNotificationServiceImpl.send(EmailNotificationServiceImpl.java:72)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: relay.testserver.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
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 javax.mail.Service.connect(Service.java:118)
at javax.mail.Transport.send0(Transport.java:188)
at javax.mail.Transport.send(Transport.java:140)
at com.util.email.api.BaseNotification.send(BaseNotification.java:392)
... 8 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:367)
at java.net.Socket.connect(Socket.java:524)
at java.net.Socket.connect(Socket.java:474)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
... 15 more

Nothing has changed in the code that would have had any impact on the functionality of SMTP. When i use netstat the port appears to be open and listening and i am able to us telnet to ping the mail server.

I am running:
- javamail-1.4.3
- jdk1.5.0_22
- Linux Redhat 5.5

Here is some snippets of code that i have been using (successfully):

at com.util.email.EmailNotificationServiceImpl.send(EmailNotificationServiceImpl.java:72)

at com.util.email.api.BaseNotification.send(BaseNotification.java:394)
at com.util.email.api.BaseNotification.send(BaseNotification.java:370)

pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic