Access Denied problem in Windows 7

View: New views
3 Messages — Rating Filter:   Alert me  

Access Denied problem in Windows 7

by Lars Schnoor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi
I am using the wrapper version 3.2.3 on Windows 7.
I installed it using the batch files without problems. I can start and stop it without problems using Services. I need however to restart it from a Java application, I tried Runtime.exec("net stop servicename") from my application, but it does not work. When I try "net stop servicename" from a Command Prompt I get the following error message:
System error 5 has occurred.

Access is denied

I read the post about getfacl, but getfacl does not seem to be part of Windows 7. I assume that the problem also exists on Windows Vista, I haven't had problems on my Windows XP. If there are other options to restart the service than calling Runtime.exec("net stop servicename") I would be happy to hear about them.

Lars


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Wrapper-user mailing list
Wrapper-user@...
https://lists.sourceforge.net/lists/listinfo/wrapper-user

Re: Access Denied problem in Windows 7

by Leif Mortenson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lars,
Is this something that was working on XP?

Normally when the Wrapper is installed as a service, it is running as
the System user.  I need to very whether or not that use is able to
start and stop other services.  The ability to do so is fairly
restricted.   I would expect that you may need to configure the
Wrapper to run as a specific account before these functions would be
available.
http://wrapper.tanukisoftware.org/doc/english/prop-ntservice-account.html

I would also suggest using the Wrapper's methods for controlling other
services.  They require that you set up a simple policy file for
security reasons, but they are pretty easy to use.
http://wrapper.tanukisoftware.org/doc/english/security-model.html

WrapperManager.sendServiceControlCode("myservice",
WrapperManager.SERVICE_CONTROL_CODE_START);
WrapperManager.sendServiceControlCode("myservice",
WrapperManager.SERVICE_CONTROL_CODE_STOP);

See the javadocs for more information:
http://wrapper.tanukisoftware.org/doc/english/javadocs.html

I will play around with this on our Windows 7 test box as well.

Also, which service are you attempting to restart?   If it the current
Java service, this can be done by calling:
WrapperManager.restart();

Cheers,
Leif


On Thu, Jul 16, 2009 at 10:15 PM, Lars Schnoor<Lars.Schnoor@...> wrote:

> Hi
> I am using the wrapper version 3.2.3 on Windows 7.
> I installed it using the batch files without problems. I can start and stop
> it without problems using Services. I need however to restart it from a Java
> application, I tried Runtime.exec("net stop servicename") from my
> application, but it does not work. When I try "net stop servicename" from a
> Command Prompt I get the following error message:
> System error 5 has occurred.
>
> Access is denied
>
> I read the post about getfacl, but getfacl does not seem to be part of
> Windows 7. I assume that the problem also exists on Windows Vista, I haven't
> had problems on my Windows XP. If there are other options to restart the
> service than calling Runtime.exec("net stop servicename") I would be happy
> to hear about them.
>
> Lars

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Wrapper-user mailing list
Wrapper-user@...
https://lists.sourceforge.net/lists/listinfo/wrapper-user

Re: Access Denied problem in Windows 7

by Lars Schnoor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Leif
Yes, it all works fine on Windows XP.
I can start and stop my service from Services without any problem on the Windows 7 machine. If I try to do anything to the service from  the command prompt nothing works. I can't install, uninstall, start or stop my service. If I however run the install and uninstall batch files with "Run as administrator" it works. What I need is the ability to execute a Runtime.exec() to "Run as administrator", but I guess that is not something that is supported in Java.

Your first suggestion is not a possibility for me, I can't expect a certain user account to be present.

Your second suggestion is also something I really would like to avoid. My application uses quite a few system resources and a security manager could make life very painful.

I am trying to restart my service from another java application. I had to split my application into a service and a GUI-part because Windows Vista and Windows 7 can't have services with GUI components. I have a system tray program that should allow the user to restart the service.

Lars

Leif Mortenson wrote:
Lars,
Is this something that was working on XP?

Normally when the Wrapper is installed as a service, it is running as
the System user.  I need to very whether or not that use is able to
start and stop other services.  The ability to do so is fairly
restricted.   I would expect that you may need to configure the
Wrapper to run as a specific account before these functions would be
available.
http://wrapper.tanukisoftware.org/doc/english/prop-ntservice-account.html

I would also suggest using the Wrapper's methods for controlling other
services.  They require that you set up a simple policy file for
security reasons, but they are pretty easy to use.
http://wrapper.tanukisoftware.org/doc/english/security-model.html

WrapperManager.sendServiceControlCode("myservice",
WrapperManager.SERVICE_CONTROL_CODE_START);
WrapperManager.sendServiceControlCode("myservice",
WrapperManager.SERVICE_CONTROL_CODE_STOP);

See the javadocs for more information:
http://wrapper.tanukisoftware.org/doc/english/javadocs.html

I will play around with this on our Windows 7 test box as well.

Also, which service are you attempting to restart?   If it the current
Java service, this can be done by calling:
WrapperManager.restart();

Cheers,
Leif


On Thu, Jul 16, 2009 at 10:15 PM, Lars SchnoorLars.Schnoor@... wrote:
  
Hi
I am using the wrapper version 3.2.3 on Windows 7.
I installed it using the batch files without problems. I can start and stop
it without problems using Services. I need however to restart it from a Java
application, I tried Runtime.exec("net stop servicename") from my
application, but it does not work. When I try "net stop servicename" from a
Command Prompt I get the following error message:
System error 5 has occurred.

Access is denied

I read the post about getfacl, but getfacl does not seem to be part of
Windows 7. I assume that the problem also exists on Windows Vista, I haven't
had problems on my Windows XP. If there are other options to restart the
service than calling Runtime.exec("net stop servicename") I would be happy
to hear about them.

Lars
    

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Wrapper-user mailing list
Wrapper-user@...
https://lists.sourceforge.net/lists/listinfo/wrapper-user
  

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Wrapper-user mailing list
Wrapper-user@...
https://lists.sourceforge.net/lists/listinfo/wrapper-user