wood burning stoves 2.0*
The moose likes Java in General and the fly likes Connection Refused exception upon reading/parsing a shortcut file present in network drive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Connection Refused exception upon reading/parsing a shortcut file present in network drive" Watch "Connection Refused exception upon reading/parsing a shortcut file present in network drive" New topic
Author

Connection Refused exception upon reading/parsing a shortcut file present in network drive

Piyush Mattoo
Ranch Hand

Joined: Mar 12, 2007
Posts: 30

Here mart.xml is a shortcut present in C:\Param\Bin on a windows box. I get the following IOException:

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.NetworkClient.openServer(NetworkClient.java:118)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
at JDOMElementTextContent.parseXml(JDOMElementTextContent.java:36)
at JDOMElementTextContent.main(JDOMElementTextContent.java:47)

I tried to open Stream from URL using file: protocol but URLConnection.getInputStream throws the same connection refused exception.

Any recommendations would be appreciated?


SCWCD-1.4, SCJP-1.4, CSM.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

The Path provided in the File constructor is not correct. You can either specify an absolute path or specify a relative path.

Update: I assumed that the program and the file which it tries to access are on the same machine.


Wrong interpretation, didn't notice the Network Drive in the Subject Please dont consider this.


Mohamed Sanaulla | My Blog
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Do you have access to that share and file? Does the user running the JVM have access (in case that isn't you)?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connection Refused exception upon reading/parsing a shortcut file present in network drive
 
Similar Threads
Problem with FTPClient
how to resolve java.net.ConnectException: Connection refused: connect
SSH Port forwarding-FTP Access
Help in reading from a file:// url
Access to website using Java Code