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.
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 7Jean-frederic Clere
2013-06-27 04:46:21 UTC
known issue
Comment 10Jean-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.
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 12Jean-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 16Jean-frederic Clere
2014-06-16 09:46:15 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.