0

I have a glassfish service running as a non system user. Glassfish needs to access a shared drive. How do I mount the shared drive for the glassfish service. Also, I would like this to remount at restarting the server.

I've found some things online, but everything is a few years old and/or geared towards system services, so I'm hoping there's newer information out there:

This is what I started with, it's perfect, but it's geared toward system services. The drive isn't viewable to non system users: https://support.code42.com/CrashPlan/4/Backup/Backing_Up_A_Windows_Network_Drive

This is the question that has the most answers, but most of them are for system users, though the OP seems to not be using the System User. His chosen solution involves wrapping the service, but there's the implication that it needs to be run manually at each start up. Map a network drive to be used by a service

This person has the same issue including non system users, but everyone says it's impossible(or an extremely bad idea) except for the last comment which doesn't really give instructions: Cannot access files on drive mapped network share from a Windows service

Community
  • 1
  • 1
nilacqua
  • 137
  • 2
  • 15
  • That last link would suggest that this is not possible. A workaround would be not to run GlassFish as a Windows service. – Mike Dec 07 '16 at 20:28
  • Not running it as a service seems a bit risky. What if someone without thinking logs that user out. Services, despite their limitations, seem safer. – nilacqua Dec 08 '16 at 21:29

1 Answers1

0

I'd rather not answer my own question, but no one else did and one of the links I gave did provide the correct solution:

Map a network drive to be used by a service

The accepted solution in the above question, did solve my problem. The key is to change the glassfish service xml to execute a wrapper batch file. In that wrapper batch file, map the drive. Then have the wrapper batch file call what the service xml normally points to. That solved my problem while retaining the service.

Community
  • 1
  • 1
nilacqua
  • 137
  • 2
  • 15