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]
I have added the rhq-plugin.xml to https://github.com/rhq-project/rhq/pull/8 and it is working for me.
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
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