Bug 738826 - [tomcat] Start/Stop/Restart operation should support RPM System V init script with different service names
Summary: [tomcat] Start/Stop/Restart operation should support RPM System V init script...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: JON Plugin
Version: 2.0.0
Hardware: All
OS: Linux
low
medium
Target Milestone: ER04
: 2.1.0
Assignee: Jean-frederic Clere
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On:
Blocks: 1111666
TreeView+ depends on / blocked
 
Reported: 2011-09-15 22:03 UTC by Larry O'Leary
Modified: 2018-11-14 10:33 UTC (History)
10 users (show)

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.
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 21:40:12 UTC
Type: Enhancement
Embargoed:


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

Description Larry O'Leary 2011-09-15 22:03:34 UTC
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 07:00:57 UTC
Doc Text added.

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

Comment 4 Mandar Joshi 2013-06-14 08:40:50 UTC
updated the Doc Text.

Comment 5 Mandar Joshi 2013-06-14 09:17:27 UTC
Removing the NeedInfo flag.

Comment 7 Jean-frederic Clere 2013-06-27 04:46:21 UTC
known issue

Comment 10 Jean-frederic Clere 2014-03-08 18:51:55 UTC
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 14:16:42 UTC
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 15:06:22 UTC
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 09:46:15 UTC
Created attachment 909072 [details]
screen showing the new added field for the service name.

Comment 17 Jean-frederic Clere 2014-06-16 09:50:29 UTC
https://github.com/rhq-project/rhq/pull/54

Comment 18 Thomas Segismont 2014-06-17 07:59:45 UTC
Merged in master

commit be6c299ef5703fbbda2146a11e3249dddd32c836
Author: Jean-Frederic Clere <jfclere>
Date:   Mon Jun 16 11:46:35 2014 +0200

Comment 20 Libor Fuka 2014-07-17 15:07:48 UTC
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 15:22:41 UTC
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 10:11:09 UTC
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 21:40:12 UTC
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.