假设有一项服务我的 Tomcat使用服务主体名称运行不是我我想重新启动。我尝试了以下
C:\me\myTomcat>net stop myTomcat
The Apache Tomcat 8.0 tomcatSecure service is stopping.
The Apache Tomcat 8.0 tomcatSecure service was stopped successfully.
C:\me\myTomcat>net start myTomcat
System error 1069 has occurred.
The service did not start due to a logon failure.
在服务的 GUI 中,上下文菜单中除“开始”之外的所有内容都显示为灰色,因此我决定采用困难的方式来删除该进程:
C:\me\myTomcat>service.bat uninstall myTomcat
Removing the service 'myTomcat' ...
Using CATALINA_BASE: "C:\me\myTomcat"
The service 'myTomcat' has been removed
这显然会禁用服务,因为它被标记为删除。当我现在尝试重新启动服务时,错误仍然出现。
要完全删除该服务,我可以删除注册表中的相应项(并可能在此基础上重新启动),但这不是每次重新启动服务时我都想执行的过程。因此我的问题是:重新启动具有不同 SPN 的服务的干净方法是什么?
附言:我使用以下命令行启动了服务。这些相当于以本地用户身份启动服务我然后通过服务上下文菜单的“属性”条目中的“登录”选项卡更改用户。
G:\myTomcat>net start myTomcat
G:\myTomcat>sc.exe config "myTomcat" obj= "myDomain\notMe password="notMePwd"
相关文章:
答案1
请尝试
A. In Windows, navigate to Control Panel > Administrative Tools > Services.
B. Right-click on the wherever you have TOMCAT service; select Properties.
C. Switch to the Log On tab.
D. Enter the password for the listed account in both the 'Password' and 'Confirm password' boxes. It may be necessary to check if the password was recently changed. Click OK.
--- 用户需要具有 LOGON AS SERVICE 权限
如果您的用户组/用户尚未以这种方式设置:
1.Logon to the computer with administrative privileges.
2.Open the ‘Administrative Tools’ and open the ‘Local Security Policy’
3.Expand ‘Local Policy’ and click on ‘User Rights Assignment’
4.In the right pane, right-click ‘Log on as a service’ and select properties.
5.Click on the ‘Add User or Group…’ button to add the new user.
6.In the ‘Select Users or Groups’ dialogue, find the user you wish to enter and click ‘OK’
7.Click ‘OK’ in the ‘Log on as a service Properties’ to save changes.
Notes:
•Ensure that the user which you have added above is not listed in the ‘Deny log on as a service’ policy in the Local Security Policy.
要从 TOMCAT 的可执行文件创建 Windows 服务,可以使用 sc.exe:
sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
取自 :https://stackoverflow.com/questions/3582108/create-windows-service-from-executable
或者作为替代用途:使用 NSSM(非 Sucking 服务管理器)将 .BAT 或任何 .EXE 文件作为服务运行。
如果您正在使用 XAMPP 堆栈或类似的东西,它们在驱动器:\XAMPP\tomcat 中有一个 INSTALL_TOMCAT_AS_SERVICE.BAT 文件。