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.
Doc Text added. @Jean-Frederic Clere, can you please review the Doc Text content?
updated the Doc Text.
Removing the NeedInfo flag.
known issue
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.
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.
As there is no way to find the nn value the user just a have to use script.
Created attachment 909072 [details] screen showing the new added field for the service name.
https://github.com/rhq-project/rhq/pull/54
Merged in master commit be6c299ef5703fbbda2146a11e3249dddd32c836 Author: Jean-Frederic Clere <jfclere> Date: Mon Jun 16 11:46:35 2014 +0200
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat7
VERIFIED on RHEL7 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6/7
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