• Post Reply Bookmark Topic Watch Topic
  • New Topic

Possible Causes of Exception

 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have written a class that uses JavaMail 1.2 API for checking the INBOX on the net and download the messages present in the INBOX. The below given exception is thrown when the program is executed.

I assume that a direct Internet connection is required for connecting to INBOX and the same is provided on the computer where the program is executed. So can anyone help me by telling me what could be the possible causes for this exception to be thrown? This is very very urgent and any kind of help is welcomed
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the documentation for java.net.UnknownHostException,

public class UnknownHostException
extends IOException
Thrown to indicate that the IP address of a host could not be determined.

You are correct that you need an internet connection, but you also need your Domain Name Service configured properly. You can check that with utilities like ping and nslookup.
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response, the machine where the application was executing was restarted and the program executed successfully.
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Writing here after a long time, hope my query gets solved soon as it is urgently required. Till now I assumed that the machine where my program would be executing would get a direct connection to Internet. But if the mahine where the program is to be executed get Internet access through a proxy server, then what additional code should be written to make the program access the Internet via the proxy.
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey the following exception is getting thrown at a particular branch where my application is executed. Can anyone tell me the possible causes for such an exception being thrown? Also what possible measures can be taken to avoid such exceptions from being thrown?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!