I have a jruby app that reads a file. The app is deployed on windows xp
and runs as a service.
I am able to read the file when the path is:
c:\my_file\my_file.txt
but when I try and read from the network drive:
z:\my_file\my_file.txt
I get the message: No such file or directory
The only different in the path is the drive letter.
The app runs as a windows service. I changed the service to as the
Administrator rather than the default SYSTEM, but that didn’t change
things.
I’m using jRuby 1.5.3 and to open the file I’m using:
IO.new(IO.sysopen(file_path), ‘r’)
Any thoughts?
Are you sure that the user running the service has this drive mapped?
My
guess would be that the user running the service does not have the drive
mapped. Personally, I would really try to avoid mapped drives and just
use
file paths with the server name. Both have their pluses and minuses,
but I
think it’s easier to debug issues with a fully qualified path.
Joe
We weren’t able to get this to work no matter what we tried. Since our
app runs as a service that service ( even when run as admin ) doesn’t
get the mapped drive.
We abandoned the idea of doing this on windows. We instead mounted the
drive on
a linux machine and run the app from there instead. Since in linux we
were able to
add the required drive permissions everything works fine now.
I know switching to linux isn’t exactly a solution for everyone I still
wanted to post
what we did to solve it just in case.
We had an issue where we couldn’t move a file from one system to a
windows shared folder (either mapped or otherwise).
I submitted a patch for this issue:
http://jira.codehaus.org/browse/JRUBY-4903
It might be related to what you are seeing. And if so hopefully will
be fixed in 1.6
Jay