Bug 738826 - [tomcat] Start/Stop/Restart operation should support RPM System V init script with different service names
[tomcat] Start/Stop/Restart operation should support RPM System V init script...
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: JON Plugin (Show other bugs)
2.0.0
All Linux
low Severity medium
: ER04
: 2.1.0
Assigned To: Jean-frederic Clere
Libor Fuka
: FutureFeature, Reopened
Depends On:
Blocks: 1111666
  Show dependency treegraph
 
Reported: 2011-09-15 18:03 EDT by Larry O'Leary
Modified: 2015-04-17 17:37 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, when configuring JBoss Enterprise Server's Tomcat server which utilizes System V Init service scripts, the service name could not be changed. This was because JBoss Enterprise Server's JBoss Operations Network (JON) did not allow service name changes. This is now fixed in JBoss Enterprise Web Server 2.1 and the JBoss Operations Network interface now includes a <guilabel>Service Name</guilabel> field for users to manually specify the desired name for a service.
Story Points: ---
Clone Of:
Environment:
JON 2.4.1 EWS Plugin Pack for JBoss ON 2.4.1 SUSE Linux Enterpirse 10 Multiple Tomcat 5 and 6 instances using System V init scripts
Last Closed: 2014-08-21 17:40:12 EDT
Type: Enhancement
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
screen showing the new added field for the service name. (193.24 KB, image/png)
2014-06-16 05:46 EDT, Jean-frederic Clere
no flags Details

  None (edit)
Description Larry O'Leary 2011-09-15 18:03:34 EDT
Description of problem:
When configuring a Tomcat server which will utilize System V Init service scripts, the service name may need to be different then the default to have multiple Tomcat installations/configurations on the same host machine.

Currently, the Tomcat plug-in fails to realize this and assumes that the service name will always be tomcat5 or tomcat6 depending on the version. These service names are hard-coded in the plug-in itself and are not configurable by the user.

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

How reproducible:
Always

Steps to Reproduce:
1. Install Tomcat5 using RPM
2. Configure two Tomcat 5 instances on the same box both registered with chkconfig (one as tomcat5 (default) and the other as tomcat5-02)
3. Start both tomcat instances
4. Inventory the tomcat instances into RHQ
5. Modify both resource inventory connection to specify 'RPM System V Init' method for start/shutdown operations
6. Shutdown the first tomcat instance (tomcat5)
7. Shutdown the second tomcat instance (tomcat5-02)

  
Actual results:
Second instance will fail to shutdown. If debug logging is enabled for the agent, the log will contain message similar to:

DEBUG [ResourceContainer.invoker.nonDaemon-3] (jboss.on.plugins.tomcat.TomcatServerOperationsDelegate)- About to execute the following process: [ProcessExecution: executable=[service], args=[[tomcat5, stop]], env-vars=[{...}], working-dir=[null], wait=[1000], capture-output=[true], kill-on-timeout=[false], executable-is-command=[false]]
DEBUG [ResourceContainer.invoker.nonDaemon-3] (jboss.on.plugins.tomcat.TomcatServerOperationsDelegate)- Exit code from process execution: 1
DEBUG [ResourceContainer.invoker.nonDaemon-3] (jboss.on.plugins.tomcat.TomcatServerOperationsDelegate)- Output from process execution: 
-----------------------
service: no such service tomcat5

-----------------------

DEBUG [OperationManager.invoker-1] (rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler)- Call to [org.jboss.on.plugins.tomcat.TomcatServerComponent.invokeOperation()] with args [[shutdown, Configuration[id=0]]] failed.
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Script returned error or non-zero exit code while shutting down the Tomcat instance. Exit code [1]
	at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
	at java.util.concurrent.FutureTask.get(Unknown Source)
	at org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler.invokeInNewThreadWithLock(ResourceContainer.java:446)
	at org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler.invoke(ResourceContainer.java:434)
	at $Proxy62.invokeOperation(Unknown Source)
	at org.rhq.core.pc.operation.OperationInvocation.run(OperationInvocation.java:217)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source) 



Expected results:
Second tomcat instances should have shutdown same as the first with no exception/stack output in agent log.

Additional info:

This is a result of org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate using the constants TomcatDiscoveryComponent.EWS_TOMCAT_6 and TomcatDiscoveryComponent.EWS_TOMCAT_5 for the service name passed to the service script instead of using a configurable option provided by the resource's plug-in configuration.
Comment 3 Mandar Joshi 2013-06-14 03:00:57 EDT
Doc Text added.

@Jean-Frederic Clere,  can you please review the Doc Text content?
Comment 4 Mandar Joshi 2013-06-14 04:40:50 EDT
updated the Doc Text.
Comment 5 Mandar Joshi 2013-06-14 05:17:27 EDT
Removing the NeedInfo flag.
Comment 7 Jean-frederic Clere 2013-06-27 00:46:21 EDT
known issue
Comment 10 Jean-frederic Clere 2014-03-08 13:51:55 EST
There is NO way to detect a different services names, just document using service tomcatnn stop and service tomcatnn start and choosing "shutdown script". WE WON'T FIX MORE.
Comment 11 Larry O'Leary 2014-03-10 10:16:42 EDT
Re-opening. As per comment 10, we are missing the option to specify a service name. Such configuration is not available to the user meaning that they can not manually use 'service tomcatnn'. This is because the service name is hard-coded.

As per this bug, this configuration must be exposed to the user to support multiple instances on the same machine. Without this, you can not manage Tomcat if running multiple instances.

The fix is very simple as described in previous comments. Instead of hard-coding user configuration, expose the user configuration to the user so the user is able to specify the correct value.
Comment 12 Jean-frederic Clere 2014-03-10 11:06:22 EDT
As there is no way to find the nn value the user just a have to use script.
Comment 16 Jean-frederic Clere 2014-06-16 05:46:15 EDT
Created attachment 909072 [details]
screen showing the new added field for the service name.
Comment 17 Jean-frederic Clere 2014-06-16 05:50:29 EDT
https://github.com/rhq-project/rhq/pull/54
Comment 18 Thomas Segismont 2014-06-17 03:59:45 EDT
Merged in master

commit be6c299ef5703fbbda2146a11e3249dddd32c836
Author: Jean-Frederic Clere <jfclere@redhat.com>
Date:   Mon Jun 16 11:46:35 2014 +0200
Comment 20 Libor Fuka 2014-07-17 11:07:48 EDT
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6
Comment 21 Libor Fuka 2014-07-17 11:22:41 EDT
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat7
Comment 22 Libor Fuka 2014-07-18 06:11:09 EDT
VERIFIED on RHEL7 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6/7
Comment 23 Larry O'Leary 2014-08-21 17:40:12 EDT
This fix, change, or update was tested and released in Web Server Plugin Pack Update-01 for JBoss ON 3.2 -- https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=32543

Note You need to log in before you can comment on or make changes to this bug.