Bug 786082 - tomcat as a service is not properly detected
Summary: tomcat as a service is not properly detected
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: JON Plugin
Version: 2.0.0
Hardware: All
OS: Windows
unspecified
high
Target Milestone: ER04
: ---
Assignee: Jean-frederic Clere
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On:
Blocks: 1111666
TreeView+ depends on / blocked
 
Reported: 2012-01-31 11:43 UTC by Tom Fonteyne
Modified: 2018-12-04 14:32 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously in JBoss Enterprise Web Server, the JON Tomcat plugin was not able to discover Tomcat installed as a Microsoft Windows service. In JBoss Enterprise Web Server 2.1, the JON Tomcat plugin is now fixed so that Tomcat is discovered as expected.
Clone Of:
Environment:
Last Closed: 2014-08-21 21:40:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 69636 0 None None None Never

Description Tom Fonteyne 2012-01-31 11:43:00 UTC
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.

Comment 1 Tom Fonteyne 2012-01-31 12:02:40 UTC
Also tested on 2.4.2rc4, also failing as expected.

Comment 3 mark yarborough 2012-11-06 20:05:26 UTC
Per 3.1.2 triage with loleary, mfoley, ccrouch, asantos: Okay to move to JON 3.2.

Comment 5 Jean-frederic Clere 2013-05-08 09:15:55 UTC
In fact it works with EWS so just tell the customers to use EWS.

Comment 6 Libor Fuka 2013-05-15 14:50:59 UTC
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.

Comment 7 Larry O'Leary 2013-06-20 17:52:33 UTC
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.

Comment 9 Jean-frederic Clere 2014-03-07 13:52:32 UTC
Fixed by https://github.com/rhq-project/rhq/pull/8

Comment 11 Libor Fuka 2014-07-18 14:19:50 UTC
VERIFIED on MS Windows Server 2008 (32bit) + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OracleJDK 1.6 + EWS ER4 Tomcat6/7

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