Description of problem: tomcat as a service is not properly detected due to different command line detection needed Version-Release number of selected component (if applicable): 2.4.1, 3.0.0 How reproducible: always Steps to Reproduce: 1. Install the exe version of Tomcat 6 on Windows, and have it installed as a service (the installer allows that, or do it manually). 2. Start the service. 3. install an agent on windows 4. discovery -f Actual results: Tomcat is not found Expected results: The opposite..... to find tomcat Additional info: when starting as a service, task manager in windows will show the process as: Image name: tomcat6.exe User: SYSTEM Command line: "c:\path\Tomcat 6.0.33\bin\Tomcat6.exe" //RS/Tomcat6 (use menu: View/Select columns to make the cmd line visible) Looking at: modules/plugins/tomcat/src/main/java/org/boss/on/plugins/tomcat/ TomcatDiscoveryComponent.java 241 String catalinaHome = determineCatalinaHome(commandLine); 242 243 if (catalinaHome == null && isWindows(context)) { 244 log.debug("catalina.home not found. ... ... 250 catalinaHome = determineCatalinaHomeOnWindows(processInfo); 251 } determineCatalinaHome in line 241 returns null, looking at it: 321 private String determineCatalinaHome(String[] cmdLine) { 322 String result = null; 323 324 for (int i = 0; i < cmdLine.length; ++i) { 325 String line = cmdLine[i]; 326 if (line.startsWith(PROPERTY_CATALINA_HOME)) { 327 result = line.substring(PROPERTY_CATALINA_HOME.length()); 328 break; 329 } 330 } This test will always fail of course for a windows service - see command line format above. So we fall throught to line 250 determineCatalinaHomeOnWindows There the code relies on "apache-tomcat-" directory, so relying on it being a EWS tomcat only, hence fails again to discover out tomcat service. When determineCatalinaHomeOnWindows() fails to find anything, an additional test should be done with a simple JMX connection that reads out the JVM arguments. The only caveat, is that a fixed/documented port number should be used which would limit detection to a single tomcat instance. Cross referencing: https://bugzilla.redhat.com/show_bug.cgi?id=756456 as that BZ is also about Tomcat as a service.
Also tested on 2.4.2rc4, also failing as expected.
Per 3.1.2 triage with loleary, mfoley, ccrouch, asantos: Okay to move to JON 3.2.
In fact it works with EWS so just tell the customers to use EWS.
I verified with EWS2 Tomcat6,7 installed as Windows service + JON 3.1.2.GA + updated Tomcat plugin (brew build [1]) [1] https://brewweb.devel.redhat.com//buildinfo?buildID=269954 Cross referencing: https://bugzilla.redhat.com/show_bug.cgi?id=963264 Where i add steps how to properly install EWS Tomcat as windows service with JON Tomcat plugin and get it all works.
Moving this back to NEW as this doesn't appear to be fixed. It only works if the user creates hacks together a new script to get around this failure. There should be no "special steps" to install EWS as a service when using it with JBoss ON. Instead, the managed plug-in should handle this situation within its discovery code. Asking the user to hack the startup scripts and officially supported startup process doesn't seem like an acceptable solution. Yes, perhaps a workaround, but doesn't warrant this bug to be VERIFIED.
Fixed by https://github.com/rhq-project/rhq/pull/8
VERIFIED on MS Windows Server 2008 (32bit) + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OracleJDK 1.6 + EWS 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