• Post Reply Bookmark Topic Watch Topic
  • New Topic

java mail Connection Reset Errors  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any idea why we are getting this connection reset error? we are trying to use pop3(in a test program as given below) to read messages from the inbox
program:



DEBUG POP3: mail.pop3s.starttls.enable: false DEBUG POP3: mail.pop3s.starttls.required: false DEBUG POP3: mail.pop3s.apop.enable: false DEBUG POP3: mail.pop3s.disablecapa: false DEBUG POP3: connecting to host "outlook.office365.com", port 995, isSSL true
javax.mail.MessagingException: Connect failed;
  nested exception is:
        java.net.SocketException: Connection reset
        at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:213)
        at javax.mail.Service.connect(Service.java:366)
        at javax.mail.Service.connect(Service.java:246)
        at Monitoring_Remedy_Mailboxes.check(Monitoring_Remedy_Mailboxes.java:41
)
        at Monitoring_Remedy_Mailboxes.main(Monitoring_Remedy_Mailboxes.java:152
)
Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:189)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
        at sun.security.ssl.InputRecord.read(InputRecord.java:503)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.
java:1343)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371
)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355
)
        at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java
:598)
        at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:372)
        at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
        at com.sun.mail.pop3.Protocol.<init>(Protocol.java:112)
        at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:265)
        at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:207)
 
Sheriff
Posts: 21313
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

I'm not sure that the error lies in your code, but is instead a network issue. Can you telnet to the port, or connect otherwise?


By the way, I've added code tags this time. Can you please add them yourself next time? It makes your code more readable.
 
Ashwanth Padmanabhan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i am able to telnet with no issues and able to connect to the smtp server.
this issue is intermittent...but i dont see any packets that is dropping at the network level too.
 
Rob Spoor
Sheriff
Posts: 21313
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still suggest having a closer look at the infrastructure. If the problem is intermittent, it also means that sometimes it works, which is an indication the problem lies outside of your code.
 
Ashwanth Padmanabhan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i get this error when i turn on the debug log during ssl handshake....any idea?

main, WRITE: TLSv1 Handshake, length = 179
[Raw write]: length = 184
0000: 16 03 01 00 B3 01 00 00   AF 03 01 59 8D CF 38 AB  ...........Y..8.
0010: C1 FA 74 0E FF F3 DB B6   42 C1 17 93 55 7B 11 EF  ..t.....B...U...
0020: DF A2 9D EA 07 9B 40 3C   78 55 56 00 00 2A C0 09  ......@<xUV..*..
0030: C0 13 00 2F C0 04 C0 0E   00 33 00 32 C0 07 C0 11  .../.....3.2....
0040: 00 05 C0 02 C0 0C C0 08   C0 12 00 0A C0 03 C0 0D  ................
0050: 00 16 00 13 00 04 00 FF   01 00 00 5C 00 0A 00 34  ...........\...4
0060: 00 32 00 17 00 01 00 03   00 13 00 15 00 06 00 07  .2..............
0070: 00 09 00 0A 00 18 00 0B   00 0C 00 19 00 0D 00 0E  ................
0080: 00 0F 00 10 00 11 00 02   00 12 00 04 00 05 00 14  ................
0090: 00 08 00 16 00 0B 00 02   01 00 00 00 00 1A 00 18  ................
00A0: 00 00 15 6F 75 74 6C 6F   6F 6B 2E 6F 66 66 69 63  ...outlook.offic
00B0: 65 33 36 35 2E 63 6F 6D                            e365.com
main, handling exception: java.net.SocketException: Connection reset
main, SEND TLSv1.2 ALERT:  fatal, description = unexpected_message
main, WRITE: TLSv1.2 Alert, length = 2
main, Exception sending alert: java.net.SocketException: Connection reset by peer: socket write error
main, called closeSocket()
 
Rob Spoor
Sheriff
Posts: 21313
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ashwanth Padmanabhan wrote:Connection reset by peer


That (usually) indicates the other side has closed the connection. That's hardly ever your fault.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!