What I was asking is whether you can connect to Yahoo from the machine where you're running that code. Does that mean the answer to that is "yes"? Is it the same machine on which you're running the browser? Are there any further exception in the Tomcat logs?
I am going to guess that you have some sort of security software running on that system. Many kinds of "malware" try to connect to urls for various nefarious reasons so security software may only allow outgoing connections to be made by known programs.
and now Connection refused error is not coming, but now HTTP 403 ( Forbidden : The server understood the request, but is refusing to fulfill it. Typically due to file access permissions on the server. )
Can you please tell me that why it is not allowing me and giving HTTP 403 error.