【问题标题】:Starting/stopping Tomcat using buttons of Wampserver使用 Wampserver 的按钮启动/停止 Tomcat
【发布时间】:2016-02-19 18:20:00
【问题描述】:

我用 Wampserver 2.0 安装了一个服务器,通过mod_jk connector,我设法与 Tomcat 6 集成(作为 Windows 服务安装)。为方便起见,我对 wampmanager.ini 进行了一些更改,并且可以使用 WampServer 菜单启动所有服务。见下文:

[Services]
Name: wampapache
Name: wampmysqld
Name: Tomcat6

[StartupAction]
;WAMPSTARTUPACTIONSTART
Action: run; FileName: "D:/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "refresh.php";WorkingDir: "D:/wamp/scripts"; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: startresume; Flags: ignoreerrors
;WAMPSTARTUPACTIONEND

[StartAll]
;WAMPSTARTALLSTART
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: startresume; Flags: ignoreerrors
;WAMPSTARTALLEND

[StopAll]
;WAMPSTOPALLSTART
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: stop; Flags: ignoreerrors
;WAMPSTOPALLEND

[RestartAll]
;WAMPRESTARTALLSTART
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: Tomcat6; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
Action: service; Service: Tomcat6; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
;WAMPRESTARTALLEND

[myexit]
;WAMPMYEXITSTART
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: stop; Flags: ignoreerrors
Action:  exit
;WAMPMYEXITEND

但是,我正在升级我的服务器,并尝试在 Wampserver 3.0.0 中重复这个想法,但没有成功。 wampmanager.ini 中引用的更改是否 和 wampmanager.tpl(需要设置相同的部分),但是当使用菜单启动 Wampserver 时,Tomcat 服务不会启动。

如果我手动启动 Tomcat 服务,集成工作,我唯一的问题是使用 WampServer 菜单单击启动和终止所有服务。

任何人都可以提出任何建议吗?

【问题讨论】:

    标签: tomcat wamp wampserver tomcat8


    【解决方案1】:

    在Wampserver的论坛(read here)交换信息后,设法解决了问题,我在这里分享我的问题的解决方案。

    与 2.0 版本不同,wampmanager.tpl 中没有对 3.0.0 版本进行更改。变化描述如下:

    $WAMP_HOME$\wampmanager.conf

    在 [service] 标记中为 Tomcat 服务创建了一行(在我的例子中,Tomcat 8.0.30 作为服务安装,称为“tomcat8”)。

    [service]
    ServiceTomcat = "tomcat8"
    

    $WAMP_HOME$\scripts\config.inc.php

    为 Tomcat 服务创建变量

    $c_tomcatService = $wampConf['ServiceTomcat']; 
    

    $WAMP_HOME$\wampmanager.tpl

    更改了上面原帖中提到的标签,添加了参考Tomcat服务的行

    ...
    [Services]
    Name: ${c_tomcatService}
    
    ...
    [StartupAction]
    Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors
    
    ...
    [StartAll]
    Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors
    
    ...
    [StopAll]
    Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
    
    ...
    [RestartAll]
    Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
    Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
    
    ...
    [myexit]
    Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
    

    在第一次测试中,没有工作。我发现 Tomcat 服务是由 Windows 服务管理器启动的,但是当通过提示或通过批处理文件手动调用时(访问被拒绝错误),即使是服务器上的管理员也无法正常工作。

    Wampserver 的论坛建议我使用 SetACL (https://helgeklein.com)。使用下面的命令,我可以更改权限:

    setacl -on "tomcat8" -ot srv -ace "n:my_login;p:start_stop,read" -actn ace
    

    通过此配置,并使用 SetACL,我设法启动和停止 Tomcat 服务以及 Wampserver 的服务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多