Bug 1069880 - Discovery of Tomcat fails when started using daemon.sh or jsvc
Summary: Discovery of Tomcat fails when started using daemon.sh or jsvc
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: JON Plugin
Version: 2.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER04
: ---
Assignee: Jean-frederic Clere
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On:
Blocks: 1069899 1111666
TreeView+ depends on / blocked
 
Reported: 2014-02-25 20:39 UTC by Larry O'Leary
Modified: 2018-12-04 17:38 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, when starting Tomcat as a service using the provided <filename>daemon.sh</filename> script, the JBoss Enterprise Web Server management plugin was unexpectedly unable to discover Tomcat. This problem also occurred when the user created their own jsvc launcher to launch the Tomcat process. This is now fixed in JBoss Enterprise Web Server 2.1 and Tomcat is discovered as expected when started.
Clone Of:
Environment:
Last Closed: 2014-08-21 21:40:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1035348 0 unspecified CLOSED Tomcat servers not discovered on Windows when installed as a service 2021-02-22 00:41:40 UTC
Red Hat Knowledge Base (Solution) 731983 0 None None None Never

Internal Links: 1035348

Description Larry O'Leary 2014-02-25 20:39:14 UTC
Description of problem:
After starting Tomcat as a service using the provided daemon.sh script, the EWS management plug-in is unable to discover it. This problem also occurs when creating your own jsvc launcher to launch the Tomcat process.

Version-Release number of selected component (if applicable):
EWS 2.0.1 management plug-in for JBoss ON 3.2

How reproducible:
Always

Steps to Reproduce:
1.  Install EWS 2.0.1.
2.  Create necessary setenv.sh to contain Tomcat environment configuration:

        cat >"${CATALINA_HOME}/bin/setenv.sh" <<EOF
JAVA_OPTS="\${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=9876"
JAVA_OPTS="\${JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="\${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
JAVA_HOME="/etc/alternatives/java_sdk"
EOF

3.  Create symbolic link of daemon.sh in /etc/init.d:

        sudo ln -s "${CATALINA_HOME}/bin/daemon.sh" /etc/init.d/tomcat7

4.  Launch Tomcat as a service:

        sudo service tomcat7 start
        
5.  Install and configure a JBoss ON 3.2 agent running as root.
6.  Wait for server discovery to occur.

Actual results:
Tomcat server is never discovered:

    DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.AutoDiscoveryExecutor)- Executing process scans for server type ResourceType[id=0, name=Tomcat Server, plugin=Tomcat, category=Server]...
    DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Executing discovery for [Tomcat Server] Resources...
    DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (jboss.on.plugins.tomcat.TomcatDiscoveryComponent)- Discovering Tomcat servers...
    DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Discovery for [Tomcat Server] resources completed in [2] ms

Expected results:
Tomcat server should have been discovered and appear in the discovery queue for import into JBoss ON inventory.

Additional info:
This is due to the process query that is used by the management plug-in. The PIQL is "process|basename|match=^java.*,arg|org.apache.catalina.startup.Bootstrap|match=.*" which explicitly looks for a process name that starts with java. However, when Tomcat is started as a service, its process name begins with jsvc.exec:

    root     28231     1  0 09:11 ?        00:00:00 jsvc.exec -java-home /etc/alternatives/java_sdk -user tomcat -pidfile /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.pid -wait 10 -outfile /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.out -errfile &1 -classpath /opt/jboss/jboss-ews/tomcat7/bin/bootstrap.jar:/opt/jboss/jboss-ews/tomcat7/bin/commons-daemon.jar:/opt/jboss/jboss-ews/tomcat7/bin/tomcat-juli.jar -Djava.util.logging.config.file=/opt/jboss/jboss-ews/tomcat7/conf/logging.properties -Dcom.sun.management.jmxremote.port=9876 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs= -Dcatalina.base=/opt/jboss/jboss-ews/tomcat7 -Dcatalina.home=/opt/jboss/jboss-ews/tomcat7 -Djava.io.tmpdir=/opt/jboss/jboss-ews/tomcat7/temp org.apache.catalina.startup.Bootstrap
    tomcat   28232 28231  0 09:11 ?        00:00:04 jsvc.exec -java-home /etc/alternatives/java_sdk -user tomcat -pidfile /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.pid -wait 10 -outfile /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.out -errfile &1 -classpath /opt/jboss/jboss-ews/tomcat7/bin/bootstrap.jar:/opt/jboss/jboss-ews/tomcat7/bin/commons-daemon.jar:/opt/jboss/jboss-ews/tomcat7/bin/tomcat-juli.jar -Djava.util.logging.config.file=/opt/jboss/jboss-ews/tomcat7/conf/logging.properties -Dcom.sun.management.jmxremote.port=9876 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs= -Dcatalina.base=/opt/jboss/jboss-ews/tomcat7 -Dcatalina.home=/opt/jboss/jboss-ews/tomcat7 -Djava.io.tmpdir=/opt/jboss/jboss-ews/tomcat7/temp org.apache.catalina.startup.Bootstrap


However, even when using the updated PIQL query of "process|basename|match=^(jsvc.exec|java.).*,arg|org.apache.catalina.startup.Bootstrap|match=.*", discovery still fails but this time due to:

    DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (jboss.on.plugins.tomcat.TomcatDiscoveryComponent)- Discovered potential Tomcat process: ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^(jsvc.exec|java.).*,arg|org.apache.catalina.startup.Bootstrap|match=.*], name=[Tomcat]], info=[process: pid=[28232], name=[jsvc.exec], ppid=[28231]]
    DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (jboss.on.plugins.tomcat.TomcatDiscoveryComponent)- Ignoring Tomcat instance (agent may not be owner) with following command line: [jsvc.exec, -java-home, /etc/alternatives/java_sdk, -user, tomcat, -pidfile, /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.pid, -wait, 10, -outfile, /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.out, -errfile, &1, -classpath, /opt/jboss/jboss-ews/tomcat7/bin/bootstrap.jar:/opt/jboss/jboss-ews/tomcat7/bin/commons-daemon.jar:/opt/jboss/jboss-ews/tomcat7/bin/tomcat-juli.jar, -Djava.util.logging.config.file=/opt/jboss/jboss-ews/tomcat7/conf/logging.properties, -Dcom.sun.management.jmxremote.port=9876, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager, -Djava.endorsed.dirs=, -Dcatalina.base=/opt/jboss/jboss-ews/tomcat7, -Dcatalina.home=/opt/jboss/jboss-ews/tomcat7, -Djava.io.tmpdir=/opt/jboss/jboss-ews/tomcat7/temp, org.apache.catalina.startup.Bootstrap]
    DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (jboss.on.plugins.tomcat.TomcatDiscoveryComponent)- Discovered potential Tomcat process: ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^(jsvc.exec|java.).*,arg|org.apache.catalina.startup.Bootstrap|match=.*], name=[Tomcat]], info=[process: pid=[28231], name=[jsvc.exec], ppid=[1]]
    DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (jboss.on.plugins.tomcat.TomcatDiscoveryComponent)- Ignoring Tomcat instance (agent may not be owner) with following command line: [jsvc.exec, -java-home, /etc/alternatives/java_sdk, -user, tomcat, -pidfile, /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.pid, -wait, 10, -outfile, /opt/jboss/jboss-ews/tomcat7/logs/catalina-daemon.out, -errfile, &1, -classpath, /opt/jboss/jboss-ews/tomcat7/bin/bootstrap.jar:/opt/jboss/jboss-ews/tomcat7/bin/commons-daemon.jar:/opt/jboss/jboss-ews/tomcat7/bin/tomcat-juli.jar, -Djava.util.logging.config.file=/opt/jboss/jboss-ews/tomcat7/conf/logging.properties, -Dcom.sun.management.jmxremote.port=9876, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager, -Djava.endorsed.dirs=, -Dcatalina.base=/opt/jboss/jboss-ews/tomcat7, -Dcatalina.home=/opt/jboss/jboss-ews/tomcat7, -Djava.io.tmpdir=/opt/jboss/jboss-ews/tomcat7/temp, org.apache.catalina.startup.Bootstrap]

Comment 1 Jean-frederic Clere 2014-03-09 09:12:07 UTC
I have added the rhq-plugin.xml to https://github.com/rhq-project/rhq/pull/8
and it is working for me.

Comment 3 Libor Fuka 2014-07-21 06:57:20 UTC
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OracleJDK 1.6 + EWS 2.1.0-ER4 Tomcat6/7

Comment 4 Larry O'Leary 2014-08-21 21:40:04 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.