Bug 1035348

Summary: Tomcat servers not discovered on Windows when installed as a service
Product: [Other] RHQ Project Reporter: Thomas Segismont <tsegismo>
Component: PluginsAssignee: Jean-frederic Clere <jclere>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.9CC: hrupp, jclere, tsegismo
Target Milestone: ---   
Target Release: RHQ 4.11   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-21 10:13:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Only EWS services were supported none

Description Thomas Segismont 2013-11-27 15:34:25 UTC
Description of problem:
Tomcat servers not discovered on Windows when installed as a service

Version-Release number of selected component (if applicable):
4.9

How reproducible:
Always

Steps to Reproduce:
1. Install Tomcat7 with the Windows installer
2. Start a detailed discovery operation on the platform resource

Actual results:

The Tomcat server is not discovered and a NPE is printed in the agent log:

2013-11-27 13:28:02,480 ERROR [ResourceDiscoveryComponent.invoker.daemon-2] (jboss.on.plugins.tomcat.TomcatDiscoveryComponent)- Error creating discovered resource for process: ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^(T|t)omcat(5|6|7)\.exe], name=[WindowsEWSTomcat]], info=[process: pid=[3480], name=[C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7.exe], ppid=[500]]
java.lang.NullPointerException
	at org.jboss.on.plugins.tomcat.TomcatDiscoveryComponent.determineCatalinaHomeOnWindows(TomcatDiscoveryComponent.java:386)
	at org.jboss.on.plugins.tomcat.TomcatDiscoveryComponent.parseTomcatProcess(TomcatDiscoveryComponent.java:251)
	at org.jboss.on.plugins.tomcat.TomcatDiscoveryComponent.discoverResources(TomcatDiscoveryComponent.java:126)
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:306)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


Expected results:
Tomcat server is discovered and no NPE in the agent log

Additional info:
On Windows, TomcatDiscoveryComponent only supports EWS servers installed as services.

Comment 1 Thomas Segismont 2013-11-27 15:35:28 UTC
I have a fix for this one and will attach the patch

Comment 2 Thomas Segismont 2013-11-27 15:50:14 UTC
Created attachment 829784 [details]
Only EWS services were supported

Comment 3 Jean-frederic Clere 2013-11-28 14:51:14 UTC
Comment on attachment 829784 [details]
Only EWS services were supported

In fact the patch fixes both 971615 and 1035348

Comment 4 Thomas Segismont 2013-11-28 15:08:28 UTC
Sorry, I don't get it. Why do you say it also fixes BZ971615?

Comment 5 Jean-frederic Clere 2013-11-28 16:00:01 UTC
because it doesn't apply on master now :-(

Comment 6 Jean-frederic Clere 2013-11-28 16:07:59 UTC
but no problem I have arranged it... Trying to test now...

Comment 7 Jean-frederic Clere 2013-11-28 16:27:49 UTC
+++
2013-11-28 17:09:07,980 DEBUG [RHQ Agent Prompt Input Thread] (org.rhq.core.system.ProcessInfo)- Unexpected error occurred while looking up info for [<unknown>] process with pid [1172] - call to getProcArgs failed. Did the process die? Cause: org.hyperic.sigar.SigarException: Incorrect function.^M
+++

Does the sigar dll supports windows7-64-SP1?

Comment 8 Thomas Segismont 2013-11-28 16:30:00 UTC
(In reply to Jean-frederic Clere from comment #7)
> +++
> 2013-11-28 17:09:07,980 DEBUG [RHQ Agent Prompt Input Thread]
> (org.rhq.core.system.ProcessInfo)- Unexpected error occurred while looking
> up info for [<unknown>] process with pid [1172] - call to getProcArgs
> failed. Did the process die? Cause: org.hyperic.sigar.SigarException:
> Incorrect function.^M
> +++
> 
> Does the sigar dll supports windows7-64-SP1?

It should. Jay is on Win7. It may happen if the user running the agent does not have appropriate permission (that's why this is logged at debug level)

Comment 9 Thomas Segismont 2014-05-07 14:14:59 UTC
Should be fixed by:

commit 76756fb6f531f24c518f246130e2eafe397f9428
Author: Jean-Frederic Clere <jfclere>
Date:   Sun Mar 9 10:07:09 2014 +0100

Comment 10 Heiko W. Rupp 2014-07-21 10:13:27 UTC
Bulk closing of RHQ 4.11 issues, now that RHQ 4.12 is out.

If you find an issue with those, please open a new BZ, linking to the old one.