[SOLVED] Integrating Tomcat to WampServer
Posted by: roggaioso (---.ibge.gov.br)
Date: February 19, 2016 07:29PM

I installed a server with Wampserver 2.0 which, through the mod_jk connector, I managed to integrate with Tomcat (installed as a windows service).
To facilitate, I made some changes to the wampmanager.ini and it was possible to start all services using the WampServer menu. See below:

[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

However, I am upgrading my server, and try to repeat this idea in the Wampserver 2.5, it didn't work. Did the changes cited in both the wampmanager.ini
and the wampmanager.tpl (which have the same sections to set up), but when using the menu to, for example, start Wampserver, the Tomcat service is not started.

If I start the Tomcat service manually, the integration works, my only problem is to make the start and the termination of all services in a single click, using the WampServer menu.

Can anyone suggest anything?



Edited 1 time(s). Last edit at 02/27/2016 10:28AM by Otomatic.

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: Otomatic (Moderator)
Date: February 19, 2016 07:59PM

Hi,

Don't modify Wampmanager.ini, It is rebuild each time Wampserver is started.
Modify only Wampmanager.tpl.
But,I think you have to modify Wampmanager.conf, config.inc.php and refresh.php that the heart of the rebuild of wampmanager.ini

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: Otomatic (Moderator)
Date: February 20, 2016 11:19AM

Hi,

I have been testing with Wampserver 3.0.3 and Tomcat service simulating by the real rpclocator service that is useless with Windows 7 (It exists just for compatibility reasons).
The modifications I made in files Wampserver 3.0.3
- wamp/wampmanager.conf
[service]
ServiceApache = "wampapache"
ServiceMysql = "wampmysqld"
ServiceTomcat = "rpclocator"
- wamp/wampmanager.tpl
[Services]
Name: ${c_apacheService}
Name: ${c_mysqlService}
Name: ${c_tomcatService}
;WAMPSTARTUPACTIONSTART
Action: run; FileName: "${c_phpCli}"; Parameters: "refresh.php";WorkingDir: "${c_installDir}/scripts"; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
Action: service; Service: ${c_apacheService}; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: ${c_mysqlService}; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors
;WAMPSTOPALLSTART
Action: service; Service: ${c_apacheService}; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: ${c_mysqlService}; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
;WAMPSTOPALLEND
;WAMPRESTARTALLSTART
Action: service; Service: ${c_apacheService}; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: ${c_mysqlService}; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: ${c_apacheService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
Action: service; Service: ${c_mysqlService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors
;WAMPRESTARTALLEND
;WAMPMYEXITSTART
Action: service; Service: ${c_apacheService}; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: ${c_mysqlService}; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
Action: exit
;WAMPMYEXITEND
- wamp/scripts/config.inc.php
$c_apacheService = $wampConf['ServiceApache'];
$c_mysqlService = $wampConf['ServiceMysql'];
$c_tomcatService = $wampConf['ServiceTomcat'];

The simulated Tomcat service (rpclocator) starts when Wampserver starts and stops when exit Wampserver.

I think that the only thing you have to do is to write the name of Tomcat service in place of rpclocator
ServiceTomcat = "rpclocator"
in wampmanager.conf.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons



Edited 1 time(s). Last edit at 02/20/2016 11:53AM by Otomatic.

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: roggaioso (---.ibge.gov.br)
Date: February 25, 2016 09:46PM

Thanks for the feedback.

I did as suggested, but it didn't work. The Tomcat service starts manually, but does not start when triggered by Wampserver.

Any suggestions?

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: Otomatic (Moderator)
Date: February 26, 2016 09:42AM

Hi,

You can try to start and stop the Tomcat service by the system rather whether by Wampmanager.
Replace all over the example given above:
Action: service; Service: ${c_tomcatService}; ServiceAction: start; Flags: ignoreerrors
by
Action: run; FileName: "net"; Parameters: "start ${c_tomcatService}"; ShowCmd: hidden; Flags: waituntilterminated
and
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
by
Action: run; FileName: "net"; Parameters: "stop ${c_tomcatService}"; ShowCmd: hidden; Flags: waituntilterminated

I would stop here. All this has very little to do with Wampserver.
I've already done a lot - with scale tests - to show that additional services could be started in addition to those of Wampserver.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: roggaioso (---.ibge.gov.br)
Date: February 26, 2016 04:01PM

You're absolutely right. I found that the problem is that the Tomcat service gives access denied when it is started through a prompt or batfile. If I open a prompt with "Run as administrator", the Tomcat service starts successfully.

You've helped me a lot, could you give me one last tip? Following your reasoning, how do I change the wampmanager.tpl so that the service can be run as an administrator?

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: Otomatic (Moderator)
Date: February 26, 2016 04:51PM

Hi,

It is not possible to run a service as an administrator with wampmanager.tpl. There is no option for that.
These are the services themselves must have this possibility.

Maybe Setacl can be used for the Tomcat service, as we can do for services wampapache and wampmysqld so they can start in a regular account : [forum.wampserver.com]

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: roggaioso (---.ibge.gov.br)
Date: February 26, 2016 06:37PM

Sorry, but I don't know this ' Setacl '. I know this has nothing to do with Wampserver, but can you tell me more about it, or cite where it is made with the wampapache/wampmysql, so I can use as an example?

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: Otomatic (Moderator)
Date: February 26, 2016 06:51PM

Hi,

What is it for me to put a link if you do not see that there is one? winking smiley

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Integrating Tomcat to WampServer
Posted by: roggaioso (---.ibge.gov.br)
Date: February 26, 2016 07:30PM

Sorry, didn't see it. Pretend you didn't see the last post.... tongue sticking out smiley

Options: ReplyQuote
[SOLVED] Re: Integrating Tomcat to WampServer
Posted by: roggaioso (---.ibge.gov.br)
Date: February 26, 2016 07:47PM

Bingo! You are the man!

Apache + MySQL + Tomcat starting together!

Thank you very much!

Options: ReplyQuote
Re: [SOLVED] Re: Integrating Tomcat to WampServer
Posted by: Otomatic (Moderator)
Date: February 26, 2016 08:20PM

Hi,

I'm happy!

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.