tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49806] New: java.net.ConnectException when attempting to open URL via Java code
Date Mon, 23 Aug 2010 12:27:24 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49806

           Summary: java.net.ConnectException when attempting to open URL
                    via Java code
           Product: Tomcat 5
           Version: 5.5.30
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: major
          Priority: P2
         Component: Connector:HTTP
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: sebastien.prunier@gmail.com


The following piece of code generates a "java.net.ConnectException: Connection
refused: connect" error : 

URL url = new URL("http://localhost:8080/myapp/mypage.jsp");
url.openStream();

It crashes with Tomcat 5.5.30 but it works with Tomcat 5.5.28.

The Tomcat server is started and the HTTP link works in my web browser.

The full error stack is : 
Exception in thread "main" java.net.ConnectException: Connection refused:
connect
    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.Socket.connect(Socket.java:524)
    at java.net.Socket.connect(Socket.java:474)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
    at sun.net.www.http.HttpClient.New(HttpClient.java:304)
    at sun.net.www.http.HttpClient.New(HttpClient.java:321)
    at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:839)
    at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:791)
    at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:716)
    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:960)
    at java.net.URL.openStream(URL.java:1007)
    at Main.main(Main.java:11)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message