How do I map a windows network file share so that a java app server can run as a windows service and have access to that mapped network drive?

1,276 views
Skip to first unread message

brent...@gmail.com

unread,
Oct 5, 2007, 4:14:45 PM10/5/07
to The Java Posse
Does anyone know if it's possible to map a network drive in Windows,
but allow a windows service to use that mapped network drive?

I've tried the following and it doesn't work:

1. Start Windows service as a user that has permissions to that
network file share and map the network drive. Making sure to check
the box that says reconnect at logon. This doesn't work because the
service is essentially logging in as another user and it doesn't
perform any login functions like mapping network drives so the service
never sees the mapped drive.

2. Use UNC path notation (ie. \\\\hostname\\ShareName) everywhere
instead of the drive letter notation. This does work for everything
except for the JAXB 2.0 classes that we're using. For some reason
when you pass a File object that is pointing to (\\\\hostname\
\ShareName) then the JAXB unmarshall call throws an Exception that
says FileNotFoundException for \ShareName. So there must be a bug in
either the JDK 5 that we're using or in the JAXB 2.0 stuff.


If I had the money then I'd just setup a SAN so that all of servers
connected to that like they were local drives, but we don't. Is there
any kind of SAN emulation software or any way to do this on Windows?
I wish I could just use Linux... :)

Thanks in advance for any help!

Brent

Duncan Wild

unread,
Oct 5, 2007, 10:05:58 PM10/5/07
to The Java Posse
I had a quick look on the java.sun forums and came up with this

http://forum.java.sun.com/thread.jspa?forumID=513&threadID=578688

You can also specify which user the service logs in as so that it can
see the drive...

I've also experienced in the past where if you don't physically log
onto the server and click on the network drive after its been rebooted
then for some reason the java program doesn't see the mapped drive.
This was on an old box running NT server and using jre1.3... so things
may have changed.

On Oct 6, 4:14 am, "brent.r...@gmail.com" <brent.r...@gmail.com>
wrote:

brent...@gmail.com

unread,
Oct 7, 2007, 7:37:14 PM10/7/07
to The Java Posse
Well, I tried running the Windows service as a user who has that drive
mapped, but Java doesn't see the drive still.

I think the only solution that will work for this is to have your Java
app mount the mapped drive on startup. I can't believe Windows can't
do this.... What a lame OS?

--Brent

Duncan Wild

unread,
Oct 8, 2007, 12:15:48 AM10/8/07
to The Java Posse
Windows - noun. 1. Global virus. 2. 32 bit extension and a graphical
shell for a 16 bit patch to an 8 bit operating system originally coded
for a 4 bit microprocessor, written by a 2 bit company that can't
stand
1 bit of competition. - Harry Martin

On Oct 8, 7:37 am, "brent.r...@gmail.com" <brent.r...@gmail.com>
wrote:

Robin Twombly

unread,
Oct 8, 2007, 7:00:06 AM10/8/07
to The Java Posse
You may find the following a solution we use this api to connect to a
server
drive to do what you are describing.

http://jcifs.samba.org/


Reply all
Reply to author
Forward
0 new messages