• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection reset by peer in JavaMail APIs  RSS feed

 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have written a Java application that sends mail using JavaMail APIs. At a particular office where my application is installed its throwing the following exception

We have tested the Internet connection in the office and it works perfectly fine. We have also accessed the very account where the messages are sent through the application via a browser and it works smoothly. So can anyone let me know of the possible causes for such an exception being thrown? This is very urgent so please let me know at the earliest.
 
Raj Chila
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ketan
I too had a similar exception when I was working with webservices. what I have seen is that when we try to re-open the URLs Connection when the server has still kept the connection alive.
I could work it out with specifically "killing" the connection and reset it when ever I need to connect to the server...
Hope this satisfies you or atleast gives you a lead into where exactly to look for errors...
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks for the prompt reply .... but the exception was thrown because of the firewall installed on the machine ... anyways I also trying to find help to help me connect to the Internet through a firewall ... can anyone help me in this case??
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
I'd talk to your network administrator. The chances are very good that he'll understand the problem - and what can be done about it - immediately. Otherwise, he would probably be able to help you take a network trace of the problem. Either way, he's probably the best person to talk to.
Good luck .. PSM
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am actually looking at how (programatically) to make a connection to Internet via a proxy server? I basically want the JavaMail API to be able to access the mail server via a proxy server. I have tried using setting up system properties and there providing with the proxy server address and port but that does not seem to work. So I needed some help, in terms of documentation or tutorials or program codes to help me do that.
 
Phanidhar Kandala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I need to send an email on submission of a form. I tested on my local box with a jsp containing form and a servlet handling that request and sending a mail using JavaMail API. I used the company's mail server and it worked fine.
But, when i placed the same code on the test server ( i mean deployed on the test) it is not coming up and throwing an exception as :

javax.mail.SendFailedException: Sending failed;
nested exception is: class javax.mail.MessagingException: Exception reading response;
nested exception is: java.net.SocketException: Connection reset at javax.mail.Transport.send0(Transport.java:218) at javax.mail.Transport.send(Transport.java:80) at com.ElectronicInvoicing.ElectronicInvoicingServlet.doPost(ElectronicInvoicingServlet.java:67)


The code at line 67 is Transport.send(msg);
where msg is the message object with some simple text.

Can anyone help me in this? I tried to change the host to test whether everything is ok with it or not ? then it gave an exception saying Unknown Host.
So, it is able to recognize the host.

Thankyou,
Phani.
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hava you read the posts in this thread? Especially the part about the firewall, and contacting the system administrator?
 
Phanidhar Kandala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Definitely i would contact the system administrator about the firewall on it. If there is a firewall, how should i proceed?
Do i need to use the authenticator?

Thanks,
Phani
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An authenticator is only used for providing a username and password. I don't think firewall issues can be solved using Java, since it's an external influence.
 
Phanidhar Kandala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Rob,

Can you suggest how to proceed i mean what we need to ask the administrator exactly to do?

Thanks,
Phani
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just tell him the problem: you can connect to the mail server but it disconnects you immediately.
 
Phanidhar Kandala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Rob,

I would contact him tomorrow and let him know that. The message i'm getting is

javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset


if i write the logs to the tomcat instead of the stack trace. It is happening like what you said, it is connecting and unable to send the response.

As they want to have the firewall on it, what kind of work around they can provide? Do you have any idea on that

Thanks for your prompt responses,
Phanidhar.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!