It's not a secret anymore!
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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
Bartender

Joined: Sep 08, 2007
Posts: 2926
    
  15

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: 19216

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
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Connection Refused exception upon reading/parsing a shortcut file present in network drive
 
Similar Threads
how to resolve java.net.ConnectException: Connection refused: connect
Problem with FTPClient
Help in reading from a file:// url
SSH Port forwarding-FTP Access
Access to website using Java Code