David kerber wrote:
On 4/10/2013 2:47 PM, Bilal S wrote:
On Sun, Mar 24, 2013 at 10:20 AM, Patrick Flaherty
<pflah...@rampageinc.com>wrote:
On Mar 23, 2013, at 10:00 PM, David Kerber wrote:
On 3/23/2013 8:13 PM, Harris, Jeffrey E. wrote:
-----Original Message-----
From: André Warnier [mailto:a...@ice-sa.com]
Sent: Saturday, March 23, 2013 8:10 PM
To: Tomcat Users List
Subject: Re: runtime.exec "cmd.exe /C net use"
Harris, Jeffrey E. wrote:
-----Original Message-----
From: Patrick Flaherty
[mailto:pflahrty@rampageinc.**com<pflah...@rampageinc.com>
]
Sent: Saturday, March 23, 2013 5:22 PM
To: Tomcat Users List
Subject: runtime.exec "cmd.exe /C net use"
Hi,
I'm trying to run the following command ( runtime.exec "cmd.exe /C
net use" ) from my tomcat app and it's returning :
net use
New connections will be remembered.
There are no entries in the list.
This only happen when I run as a Windows service. If I run the
tomcat
batch file to start tomcat then "net use" returns all my mapped
network drives. The service login is an account that has access to
the network shares as my app uses those shares, but the service
login
should not preclude the command from executing properly. If I
substitute "dir" for "net use"
that works and I get a directory listing. The combo of "net use"
command using cmd.exe and running as a service seems to be the
conflict.
Any input much appreciated.
Thanks
Pat
I would add that it is kind of doubtful that this has anything
directly
to do with Tomcat, or even Java. Maybe that question would belong
more
to some Windows forum.
------------------------------**------------------------------**
---------
I absolutely agree. I would expect to see the same behavior with
Apache
HTTPD, IIS, or
any other service that accesses mapped drives. It is a question of
how
service accounts behave
in the windows architecture, rather than something specific with
Tomcat.
Jeffrey Harris
It will depend on what user your TC service is running under. If
it's
running as the LocalSystem user, it will not have access to any
network
drives, or many other network resources. It can hit some, such as
databases.
If you want your TC to be able to see networked drives, you need to run
it under the logged-on user's ID. Keep in mind, though, that if the
user
logs off, the drives will be disconnected. Your best bet in that
case it
to not connect by drive letter, but rather by the UNC name (what you
used
to map it when you were logged on). That will work if the user TC is
running has has the appropriate permissions to the network resource.
D
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
Pat,
I believe the Windows workstation service is required to map drives.
Background services in general run under a different context, thus, they
cannot map drives.
That being said you should be able to achieve this by allowing your
Tomcat
service to "interact with desktop" then actually mapping your drives in
scripted fashion using a series of
net use F: \\target\one /PERSISTENT:YES
net use G: \\target\two /PERSISTENT:YES
Now when you do a list using "net use" it should list drives for your
service.
HTH
-Bilal
The last version of windows server that allowed "interact with desktop"
to work was Server 2003. 2008 and 2008R2 don't allow it any more. And
if you log off, your drives will still be disconnected.
+1
If you really need to access Windows network resources from within a webapp running in
Tomcat, you should probably have a look at the JCIFS suite, @ jcifs.samba.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org