Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 963264

Summary: RFE - JON Tomcat plugin + Tomcat as Windows service
Product: [JBoss] JBoss Enterprise Web Server 2 Reporter: Libor Fuka <lfuka>
Component: JON PluginAssignee: Jean-frederic Clere <jclere>
Status: CLOSED EOL QA Contact: Libor Fuka <lfuka>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0.1CC: hbrock, jclere, mfoley, myarboro
Target Milestone: ER04Keywords: FutureFeature
Target Release: 2.1.0   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When JBoss Enterprise Web Server's Tomcat is installed as a windows service, it should start and stop as a service using the <command>net start tomcat6</command> and <command>net stop tomcat6</command> commands. However, JBoss Operations Network uses the <filename>startup.bat</filename> and <filename>shutdown.bat</filename> files, which start Tomcat in a Windows console instead of as a service. This issue is fixed in JBoss Enterprise Web Server 2.1. Tomcat installed as a Windows service can now be started and stopped as expected using the JBoss Operation Network user interface.
Story Points: ---
Clone Of:
: 1128600 (view as bug list) Environment:
Last Closed: 2019-06-13 12:09:54 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1128600    

Description Libor Fuka 2013-05-15 14:11:19 UTC
Description of problem:
EWS Tomcat installed as windows service is started by JON Tomcat by startup.bat in window not like windows service.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Install Tomcat as Windows service
2. Discovery it, import it to JON server
3. Schedule operation stop -> it stops Tomcat windows service
4. Wait
5. Schedule operation start -> it starts Tomcat in window not like windows service
  
Actual results:


Expected results:


Additional info:
The problem is that Tomcat plugin fills start/shutdown script field in JON with startup/shutdown.bat scripts.

Comment 1 Libor Fuka 2013-05-15 14:27:00 UTC
It should be simply workarounded by creating scripts in CATALINA_HOME\bin directory and update startup/shutdown script filed in JON UI Tomcat configuration tab.
For example create netstart.bat with net start Tomcat6 and netstop.bat with command net stop Tomcat6.

It should go to Known issues.

Comment 2 Libor Fuka 2013-05-15 14:28:46 UTC
The correct names of JON UI Tomcat configuration tab fields are:
Start Script
Shutdown Script

Comment 3 Libor Fuka 2013-05-15 15:13:23 UTC
For properly installation and configuration of Tomcat Win service + JON Tomcat plugin you need follow these steps:
Note: You need to install Tomcat and JON agent under same Windows user (for example hudson)
1. Install Tomcat as Windows service (jboss-ews-2.0\share\apache-tomcat-6.0.35\bin\service.bat install)
2. Create jmxremote.access (controlRole readwrite) and jmxremote.password (controlRole pwd) for example in jboss-ews-2.0\share\apache-tomcat-6.0.35\conf
3. Set owner of these two files to hudson
4. Enable JMX for Tomcat windows service: jboss-ews-2.0\sbin\tomcat6.exe //US//Tomcat6 ++JvmOptions="-Dcom.sun.management.jmxremote.port=8100;-Dcom.sun.management.jmxremote.access.file="c:\qa\lfuka\workspace\jboss-ews-2.0\share\tomcat6\conf\jmxremote.access";-Dcom.sun.management.jmxremote.password.file="c:\qa\lfuka\workspace\jboss-ews-2.0\share\tomcat6\conf\jmxremote.password";-Dcom.sun.management.jmxremote.ssl=false;-Dcom.sun.management.jmxremote.authenticate=true"
5. Create netstart.bat (net start Tomcat6) and netstop.bat (net stop Tomcat6) in bin directory
6. Start Tomcat win service: net start Tomcat6 or by netstart.bat - see the tomcat logs in logs directory. Tomcat win service should started.
7. Install and configure JON agent and type discovery in agent prompt
   - It should discover Tomcat windows service
8. go to JON UI - Inventory - Discovery Queue and import Tomcat and RHQ agent
9. Go to platforms and find your agent name and click on it
10. You are on your agent page and you see Tomcat Servers
11. Click on your Tomcat server and configure it (Inventory tab - Connection settings)
12. Fill Principal and Credentials (controlRole and pwd set in jmxremote files)
13. Update Start and Shutdown Script with your created bat files netstart.bat and netstop.bat
14. Click save
15. Update connection settings of Tomcat Server JVM - set Principal and Credentials
16. It should be all and you can manage your Tomcat Windows service from JON :)

Comment 4 Libor Fuka 2013-05-15 15:21:08 UTC
forgot: 
5.5 Set Log On for Tomcat Windows service to hudson
   - Go to Tomcat win service properties - Log On tab - and set user to hudson (it will run service under user hudson)

Comment 5 Mandar Joshi 2013-05-16 12:50:35 UTC
Doc Text added.

@Jean-Frederic Clere,  can you please review the Doc Text content?

Comment 7 Jean-frederic Clere 2013-05-30 07:11:43 UTC
Cause:

When JBoss Enterprise Web Server Tomcat installed as windows service it should be started and stopped as a service (like net start tomcat6 and net stop tomcat6) but JON uses the startup.bat (and shutdown.bat) which starts Tomcat in a windows console.

Consequence: Tomcat is started in a windows console instead as a service.


Fix: This is known issue and as a workaround , create two scripts in CATALINA_HOME\bin directory and update startup/shutdown script fields in JBoss Operations Network interface Tomcat configuration tab.

Comment 9 Jean-frederic Clere 2014-07-02 11:44:52 UTC
Fixing 786082 should have fix this one...

Comment 10 Libor Fuka 2014-07-18 14:34:04 UTC
VERIFIED on MS Windows Server 2008 (32bit) + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OracleJDK 1.6 + EWS ER4 Tomcat6/7

Comment 11 Libor Fuka 2014-07-18 14:45:08 UTC
Correct settings for JON managing tomcat installed as windows service:
Note: You need to install Tomcat and JON agent under same Windows user (for example hudson)
1. Install Tomcat as Windows service (jboss-ews-2.1\share\tomcat6\bin\service.bat install)

2. Create jmxremote.access (controlRole readwrite) and jmxremote.password (controlRole pwd) for example in C:\jmx directory

3. Set owner of these two files to SYSTEM and restrict access of jmxremote.password file only to user SYSTEM and set his rights only to read 

4. Enable JMX for Tomcat windows service: jboss-ews-2.1\sbin\tomcat6.exe //US//Tomcat6 ++JvmOptions="-Dcom.sun.management.jmxremote.port=8100;-Dcom.sun.management.jmxremote.access.file="C:\jmx\jmxremote.access";-Dcom.sun.management.jmxremote.password.file="C:\jmx\jmxremote.password";-Dcom.sun.management.jmxremote.ssl=false;-Dcom.sun.management.jmxremote.authenticate=true"

6. Start Tomcat win service by Windows services application  - see the tomcat logs in logs directory. Tomcat win service should started.

7. Install and configure JON agent and type discovery in agent prompt
   - It should discover Tomcat windows service

8. go to JON UI - Inventory - Discovery Queue and import Tomcat and RHQ agent

9. Go to platforms and find your agent name and click on it

10. You are on your agent page and you see Tomcat Servers

11. Click on your Tomcat server and configure it (Inventory tab - Connection settings)

12. Fill Principal and Credentials (controlRole and pwd set in jmxremote files)

13. Set Control Method to RPM System V init script (you can not set Start and Shutdown Script fields - leave it unset)

14. Click save

15. Update connection settings of Tomcat Server JVM - set Principal and Credentials

16. It should be all and you can manage your Tomcat Windows service from JON :)

Comment 12 Libor Fuka 2014-07-18 14:46:31 UTC
Mandar, please document steps from comm#11

Comment 13 Mandar Joshi 2014-08-11 12:48:26 UTC
Removing need info.
Cloned the bug for doc. New bug is 1128600.