Known Limitations and Workarounds, Web Server Support
Why can't my servlet/JSP running on Windows access files on a network drive?
You need to ensure that the user account under which your code is running has read/write access to the network drive (or share). With ServletExec AS (which runs out-of-process with the webserver) this is fairly simple because with SE AS, the JVM (and thus SE's java code, and thus your java Servlets and JSPs) run inside a process that is separate from the webserver's process. With SE AS, here is how you'd do it:
Install ServletExec AS as a Windows Service.
Specify that the ServletExec AS service run under a User account that you know has access to the network drive.
Start ServletExec running under that user and your servlet should be able to access the drive using the following syntax:
\\machine name\drive's share name\path to file
Note: If you use JDK 1.2 instead of JDK 1.1 then you'll receive better error messages when problems occur while trying to access the network drive.
Note: You'll need to escape the '\' character in your Servlet code like this:
File networkFile = new File("\\\\Machine\\shared\\networkFile");
With versions of ServletExec that run in-process with the web server (a plug-in version such as: SE ISAPI, or SE NSAPI) the entire JVM and thus SE and thus your servlets and JSPs are all running inside the webserver's process. In the case of IIS (SE ISAPI) this presents some complexities since IIS runs as different users at different times (see section 2.7 of the SE Installation Guide entitled "User Accounts for Microsoft IIS"). This means that your Servlets and JSPs will be running as different users at different times. Whether or not your Servlet or JSP will be able to read/write the network drive/share, will depend upon who has read/write permissions to your network drive/share and which user your servlet/JSP is running as at that moment. So in the case of SE ISAPI, use the information given in section 2.7 to decide which users/principles should be given read/write access to your network drive so that your servlets/JSPs running inside SE ISAPI will be able to read/write to your network drive.