Java Mailing List Archive

http://www.junlu.com/

Home » users-digest.tomcat »

users Digest 24 Mar 2013 19:37:41 -0000 Issue 11312

users-digest-help

2013-03-24


Author LoginPost Reply

users Digest 24 Mar 2013 19:37:41 -0000 Issue 11312

Topics (messages 240683 through 240697)

runtime.exec "cmd.exe /C net use"
 240683 by: Patrick Flaherty
 240684 by: Harris, Jeffrey E.
 240685 by: André Warnier
 240686 by: Harris, Jeffrey E.
 240687 by: David Kerber
 240688 by: David Kerber
 240691 by: Patrick Flaherty
 240692 by: Harris, Jeffrey E.
 240694 by: Patrick Flaherty
 240695 by: Harris, Jeffrey E.
 240696 by: André Warnier
 240697 by: Patrick Flaherty

How to set environment variables for R to use in Tomcat on RedHat Linux (RHEL6)
 240689 by: Patrick Hong

Re: Tomcat 8 + Tomcat Maven Plugin 2.2 + Tomcat8 Maven Plugin?
 240690 by: Olivier Lamy
 240693 by: Nick Williams

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: users@(protected)
To unsubscribe, e-mail: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-digest-help@(protected)

----------------------------------------------------------------------


Attachment: users_240683.eml (zipped)
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


Attachment: users_240684.eml (zipped)


> -----Original Message-----
> From: Patrick Flaherty [mailto:pflahrty@(protected)]
> 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
>

There could be a few things here.

If I execute a net use command at the command prompt on my system, it responds:

"New connections will not be remembered.

There are no entries in the list."

(And I have no mapped drives.)

Even if the current logged in user is the same user as running the service, they are different sessions,
so normally the mappings would be different. If you log in as the service account and map some drives,
those mappings are not accessible to Tomcat through the service account.

It is possible that if you have mapped drives remembered in a roaming profile that is used by the service account,
those mappings would be available to the service account, but I do not believe that service accounts normally load
any profile information.

Are you sure that you are not using UNCs (i.e., \\servername\sharename) to access the network shares, or are
you mapping the shares within your Tomcat application? Do you map any drives prior to starting Tomcat from a batch file? Please share with us how you establish your mappings for Tomcat, both for the service start and the batch file start, if different.

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 attachments.


Attachment: users_240685.eml (zipped)
Harris, Jeffrey E. wrote:
>
>> -----Original Message-----
>> From: Patrick Flaherty [mailto:pflahrty@(protected)]
>> 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
>>
>
> There could be a few things here.
>
> If I execute a net use command at the command prompt on my system, it responds:
>
> "New connections will not be remembered.
>
> There are no entries in the list."
>
> (And I have no mapped drives.)
>
> Even if the current logged in user is the same user as running the service, they are different sessions,
> so normally the mappings would be different. If you log in as the service account and map some drives,
> those mappings are not accessible to Tomcat through the service account.
>
> It is possible that if you have mapped drives remembered in a roaming profile that is used by the service account,
> those mappings would be available to the service account, but I do not believe that service accounts normally load
> any profile information.
>
> Are you sure that you are not using UNCs (i.e., \\servername\sharename) to access the network shares, or are
> you mapping the shares within your Tomcat application? Do you map any drives prior to starting Tomcat from a batch file? Please share with us how you establish your mappings for Tomcat, both for the service start and the batch file start, if different.
>

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.





Attachment: users_240686.eml (zipped)


> -----Original Message-----
> From: André Warnier [mailto:aw@(protected)]
> 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@(protected)]
> >> 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

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 attachments.


Attachment: users_240687.eml (zipped)
On 3/23/2013 8:13 PM, Harris, Jeffrey E. wrote:
>
>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@(protected)]
>> 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@(protected)]
>>>> 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



Attachment: users_240688.eml (zipped)
On 3/23/2013 8:13 PM, Harris, Jeffrey E. wrote:
>
>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@(protected)]
>> 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@(protected)]
>>>> 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



Attachment: users_240691.eml (zipped)

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:aw@(protected)]
>>> 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@(protected)]
>>>>> 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








>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>



Attachment: users_240692.eml (zipped)


> -----Original Message-----
> From: Patrick Flaherty [mailto:pflahrty@(protected)]
> 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?

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 attachments.


Attachment: users_240694.eml (zipped)

On Mar 24, 2013, at 10:24 AM, Harris, Jeffrey E. wrote:

>
>
>> -----Original Message-----
>> From: Patrick Flaherty [mailto:pflahrty@(protected)]
>> 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
>
> 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
> attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>



Attachment: users_240695.eml (zipped)


> -----Original Message-----
> From: Patrick Flaherty [mailto:pflahrty@(protected)]
> 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 [mailto:pflahrty@(protected)]
> >> 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
> >

Pat,

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 remap
the drives when using the account to start a service (it will when you actually log in interactively with
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 attachments.


Attachment: users_240696.eml (zipped)
Harris, Jeffrey E. wrote:
>
>> -----Original Message-----
>> From: Patrick Flaherty [mailto:pflahrty@(protected)]
>> 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 [mailto:pflahrty@(protected)]
>>>> 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
>>>
>
> Pat,
>
> 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 remap
> the drives when using the account to start a service (it will when you actually log in interactively with
> 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.
>

I routinely use "net use \\hostname\share" from inside programs running as Windows
Services (not in Java, though, but it should not matter). "Drive letters" don't work.
The exact form I use is :
net use \\hostname\sharename <password> /USER:<userid>
And then later I can open/read/write/close files as "\\hostname\sharename\filepath".

It works, but I have noticed one "quirk" in my programs : after doing the "net use", the
very first access to the share doesn't work and returns an error. The second access and
all subsequent ones work though. I have no idea why this is, but I have just adapted my
programs to work around this issue (by doing a first dummy access and ignoring the
result), and never had any problem since. (**)

To be able to do this, the Service *cannot* run as the LocalSystem or LocalService user.
By design in Windows, these special users do not have access to any "Windows network"
functions or resources. Any "normal" user (*) will do, depending on the environment (such
as, if the current host is a member of a Windows Domain, and the Windows network resource
is defined in that domain, then the user will need to be a Domain user; if the resource is
a share on a Linux Samba host e.g., then any user will do, as long as it is known to Samba).
This all concerns only "Windows network" resources. Anything accessed via standard TCP/IP
protocols (HTTP, NFS, FTP, SSL..) works, even when running as one of these special users.

As a not very precise technical definition, "Windows network resources" are all the things
like "shares" (network directories), Windows network printers, anything that is accessed
via the SMB or CIFS protocol, anything that requires the usage of a "workgroup" or
"domain" name, etc.


(*) with one additional caveat : the user must be granted the "right to run services".

(**) Maybe this is a hint to the OP : what happens if you ignore the result of the first
command call, and try the same command a second time ?
And I agree : there a bit of hocus-pocus here, but then many things are, in a Windows
environment.


Attachment: users_240697.eml (zipped)

On Mar 24, 2013, at 2:56 PM, André Warnier wrote:

> Harris, Jeffrey E. wrote:
>>> -----Original Message-----
>>> From: Patrick Flaherty [mailto:pflahrty@(protected)]
>>> 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 [mailto:pflahrty@(protected)]
>>>>> 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
>>>>
>> Pat,
>> 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 remap
>> the drives when using the account to start a service (it will when
>> you actually log in interactively with
>> 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.
>
> I routinely use "net use \\hostname\share" from inside programs
> running as Windows Services (not in Java, though, but it should not
> matter). "Drive letters" don't work.
> The exact form I use is :
> net use \\hostname\sharename <password> /USER:<userid>
> And then later I can open/read/write/close files as "\\hostname
> \sharename\filepath".
>
> It works, but I have noticed one "quirk" in my programs : after
> doing the "net use", the very first access to the share doesn't work
> and returns an error. The second access and all subsequent ones work
> though. I have no idea why this is, but I have just adapted my
> programs to work around this issue (by doing a first dummy access
> and ignoring the result), and never had any problem since. (**)
>
> To be able to do this, the Service *cannot* run as the LocalSystem
> or LocalService user. By design in Windows, these special users do
> not have access to any "Windows network" functions or resources.  
> Any "normal" user (*) will do, depending on the environment (such
> as, if the current host is a member of a Windows Domain, and the
> Windows network resource is defined in that domain, then the user
> will need to be a Domain user; if the resource is a share on a Linux
> Samba host e.g., then any user will do, as long as it is known to
> Samba).
> This all concerns only "Windows network" resources. Anything
> accessed via standard TCP/IP protocols (HTTP, NFS, FTP, SSL..)
> works, even when running as one of these special users.
>
> As a not very precise technical definition, "Windows network
> resources" are all the things like "shares" (network directories),
> Windows network printers, anything that is accessed via the SMB or
> CIFS protocol, anything that requires the usage of a "workgroup" or
> "domain" name, etc.
>
>
> (*) with one additional caveat : the user must be granted the "right
> to run services".
>
> (**) Maybe this is a hint to the OP : what happens if you ignore the
> result of the first command call, and try the same command a second
> time ?
> And I agree : there a bit of hocus-pocus here, but then many things
> are, in a Windows environment.
>
You are not hearing me. The drives are mapped and set to reconnect at
logon. Therefore if I reboot my machine the network drive mapping are
in place after
logging in. I *do not* try and map a drive from within my app. My app
has full access to the network shares as soon as my app is up. No
problem with network
shares and my app ! My app needs to read and write to those network
share to function and has no problems.

The problem is after I'm up and running, I try to run "cmd.exe /C net
use" from within the app it does not return any mapped drives. it
returns:
net use
New connections will be remembered.

There are no entries in the list.

Again, the return above happen only when running as a service but
works fine when tomcat starts from startup.bat in a console. Works
fine means
it returns drive letter, unc equivalent etc ... basically what you
normally see when you have mapped network drives and run "net use"
from cmd.exe.

It make no sense I know but I'm at a loss.

Thanks again
Pat



> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>


Attachment: users_240689.eml (zipped)
I'm trying to set up R and Tomcat on RHEL6 (6.4)

I have installed R and can run it. I have installed Tomcat 7 and can host
files file. I have packaged an application as a WAR file and deployed it
using tomcat. The application runs fine in all aspects until it uses any R
component.

This is where it crashes out with the following error as seen in
catalina.out:

<code>
Cannot find JRI native library!
Please make sure that the JRI native library is in a directory listed in
java.library.path.

java.lang.UnsatisfiedLinkError:
/usr/local/lib64/R-2.15.3/library/rJava/jri/libj
ri.so: libR.so: cannot open shared object file: Too many levels of symbolic
links
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0 (ClassLoader.java:1750)
at java.lang.ClassLoader.loadLibrary (ClassLoader.java:1675)
at java.lang.Runtime.loadLibrary0 (Runtime.java:840)
at java.lang.System.loadLibrary (System.java:1047)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
</code>

I do have rJava installed under R: install.packages("rJava") It installed
fine and I have rJava inside the R's library folder.

I have defined the following in /etc/profile:

<code>
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
export R_HOME=/usr/local/lib64/R-2.15.3
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$R_HOME/bin
export PATH
export
LD_LIBRARY_PATH=$R_HOME/lib/libR.so,$JAVA_HOME/lib/amd64/server/libjvm.so
</code>

To my understanding, that should set JAVA_HOME, R_HOME, PATH, and
LD_LIBRARY_PATH globally for all users on the server. I know Tomcat runs
under root and I can confirm that root was able to see all the above paths
as set above via "echo $JAVA_HOME", "echo $R_HOME", "echo $LD_LIBRARY_PATH",
"echo $PATH"

So I'm not sure why it's complaining that it can't open those .so files.

Also, when it crashes out, it shuts down Tomcat.

Thanks!

Patrick




Attachment: users_240690.eml (zipped)
Hi,
Apologize for delayed response.
I have not tested that. I don't know if embedder trunk (i.e tomcat8)
is compatible.
Did you try using tomcat8 snapshot as described here:
http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html


2013/3/14 Nick Williams <nicholas@(protected)>:
> https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/maven/
>
> In snapshots there is only tomcat6-maven-plugin and tomcat7-maven-plugin. So, even though my Maven dependencies are on Tomcat 8.0-SNAPSHOT, any "executable war" I build with the plugin has Tomcat 7 classes in it, meaning the application won't run (NoClassDefFound, etc.).
>
> What needs to be done to get a tomcat8-maven-plugin snapshot started? Is this a whole new project that hasn't been started yet? Or does a new build configuration just need to be created?



--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy


Attachment: users_240693.eml (zipped)

On Mar 24, 2013, at 4:55 AM, Olivier Lamy wrote:

> Hi,
> Apologize for delayed response.
> I have not tested that. I don't know if embedder trunk (i.e tomcat8)
> is compatible.
> Did you try using tomcat8 snapshot as described here:
> http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html

I had not seen that. Thanks!

However, after some time I determined that I needed enough customization (Tomcat 8, Web Start class loader requirements, logging, etc.) that the maven plugin just wasn't going to cut it. I got it working nicely using the tomcat-embed-*, as per "Re: Executable Tomcat JAR/WAR executes fine standalone, class loading errors in JNLP" [1] and bug 54745.

Thanks,

Nick

[1] http://tomcat.markmail.org/thread/6qzrm3akiy4e3e5v

>
>
> 2013/3/14 Nick Williams <nicholas@(protected)>:
>> https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/maven/
>>
>> In snapshots there is only tomcat6-maven-plugin and tomcat7-maven-plugin. So, even though my Maven dependencies are on Tomcat 8.0-SNAPSHOT, any "executable war" I build with the plugin has Tomcat 7 classes in it, meaning the application won't run (NoClassDefFound, etc.).
>>
>> What needs to be done to get a tomcat8-maven-plugin snapshot started? Is this a whole new project that hasn't been started yet? Or does a new build configuration just need to be created?
>
>
>
> --
> Olivier Lamy
> Ecetera: http://ecetera.com.au
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>


©2008 junlu.com - Jax Systems, LLC, U.S.A.