tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harris, Jeffrey E." <>
Subject RE: runtime.exec "cmd.exe /C net use"
Date Sun, 24 Mar 2013 17:27:49 GMT

> -----Original Message-----
> From: Patrick Flaherty []
> Sent: Sunday, March 24, 2013 12:18 PM
> To: Tomcat Users List
> Subject: Re: runtime.exec "cmd.exe /C net use"
> On Mar 24, 2013, at 10:24 AM, Harris, Jeffrey E. wrote:
> >
> >
> >> -----Original Message-----
> >> From: Patrick Flaherty []
> >> Sent: Sunday, March 24, 2013 10:20 AM
> >> To: Tomcat Users List
> >> Subject: Re: runtime.exec "cmd.exe /C net use"
> >>
> >>
> >> On Mar 23, 2013, at 10:00 PM, David Kerber wrote:
> >>
> >>> On 3/23/2013 8:13 PM, Harris, Jeffrey E. wrote:
> >>
> >> Hi,
> >>
> >> Thanks for all the input. I know about service logins being only
> able
> >> to use UNC paths (not drive letters) to access network shares. I
> know
> >> the service login & password have to have a matching account on the
> >> server with the shares in order for the tomcat app to use (access)
> >> those shares. We do all of this. Out tomcat app depends on network
> >> shares to function and it always has worked as long as the service
> >> login account matches an account on the server with the shares.
> >>
> >> What I'm trying to do in an html interface is make a pulldown menu
> >> list of my mapped drives as a location for our database backup. It's
> >> a preference setup to where an automated scheduled backup will write
> >> the backups. I'm using "net use" to produce what you would expect
> for
> >> output (all the mapped network drives) and parsing the output to
> >> produce the pulldown menu item containing the unc portion gleaned
> >> from the "net use" output. I need the unc portion as this is what a
> >> tomcat app needs. No matter what I do outside the app I cannot
> >> produce the effectively empty list that the app is producing. I'm
> >> logged into Windows as the same account as the service and I open a
> >> command prompt and see all my mapped drives via "net use". I have
> >> tried UAC on and off and it changes nothing. I added a simple "dir"
> >> to the app and I can get that output but not the "net use"
> >> output. I do know it has to do with the service as I said because
> >> when tomcat is started via the startup.bat it works great.
> >>
> >> Maybe it is a Windows question but thought someone may have had some
> >> similar experience.
> >>
> >> Thanks for eveyone's thoughts.
> >>
> >> -Pat
> >>
> >
> > You still have not answered how the mapping are being made in the
> > first place.  Is the service account dynamically setting the mapping
> > using net use, or through the Windows API?  Are you relying on static
> > mappings in the user account profile?
> Hi Jeffrey,
> The drive mapping are happening through the Windows Explorer interface.
> The file server is browsed and the shares on the file server are mapped
> by right-clicking the share, mapping it to a drive letter and I check
> the checkbox "Reconnect at logon". Then I start my app.
> (I'm not using any user profiles.)
> -Pat
> >
> > Jeffrey Harris
> >


I do not think that will work for a service account.  The drive mappings are stored in the
user profile,
and since I do not think service accounts access user profiles, the service account will not
the drives when using the account to start a service (it will when you actually log in interactively
the account).  You can try setting some custom environment variables in the user profile (not
the system profile)
and see if they are accessible by the service account using the set command as a test to see
if mapping
might be accessible.

What you probably need to do is actually set the drive mappings using the Windows API dynamically
when Tomcat starts,
or use UNCs.  I know you want to display the drive mappings, but you could fake the display
by doing a net use >myfilemappings.txt from the command line (when logged into the account),
and just calling the file to display the mappings.  Obviously, if the mappings change, you
would have to redo the file.

I think those are your only options.  You might want to do a Google search and see if there
is a way for
service accounts to use remembered mapped drives.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein
and may contain proprietary information. If you are not the intended recipient of this e-mail
or believe that you received this email in error, please take immediate action to notify the
sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments
from your computer; and do not disseminate, distribute, use, or copy this message and any

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message