Bug 727959

Summary: FileNotFoundException in RHQ Agent's log
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: ContentAssignee: Stefan Negrea <snegrea>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: high    
Version: 4.2CC: hrupp, loleary, tfonteyn
Target Milestone: ---Keywords: Reopened
Target Release: RHQ 4.3.0   
Hardware: All   
OS: All   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 788736 (view as bug list) Environment:
Last Closed: 2013-08-31 06:49:02 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 734807, 758753, 782579, 788736    
Description Flags
RHQ Agent log none

Description Mike Foley 2011-08-03 15:18:18 EDT
Created attachment 516565 [details]
RHQ Agent log

Description of problem:  FileNotFoundException in RHQ Agent's log

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

How reproducible:

Steps to Reproduce:
1.  Review of Agent log file
Actual results:

Expected results:

Additional info:
2011-08-03 15:15:21,888 WARN  [ResourceContainer.invoker.nonDaemon-2] (rhq.plugins.jbossas5.script.ScriptComponent)- Failed to compute the SHA256 digest of the script: /home/mfoley/Downloads/rhq-agent/classpath.sh
java.io.FileNotFoundException: classpath.sh (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:137)
	at org.rhq.core.util.MessageDigestGenerator.calcDigest(MessageDigestGenerator.java:255)
	at org.rhq.core.util.MessageDigestGenerator.calcDigestString(MessageDigestGenerator.java:291)
	at org.rhq.plugins.jbossas5.script.ScriptComponent.discoverDeployedPackages(ScriptComponent.java:222)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:537)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
Comment 1 Charles Crouch 2011-08-25 10:28:20 EDT
Setting to high, for eng. to determine if it is still an issue
Comment 2 John Sanda 2011-09-28 11:26:28 EDT
I believe that this is a file permissions issue. The agent currently does not check whether or not the file is readable. Mike can you please confirm whether or not classpath.sh is readable by the agent?
Comment 3 Heiko W. Rupp 2011-09-28 12:06:43 EDT
Mike could you tell what you were trying to do when this showed up?

Were you trying to inventory scripts (script plugin)?
Comment 4 John Sanda 2011-09-28 15:11:56 EDT
When generating the initial change set, if a file is not readable, it is   skipped and excluded from the change set since we cannot compute the SHA for the file.
When generating a drift change set, if we detect a new file that is not readable, we skip it as well since we cannot compute the SHA. Now if an existing file that is already being monitored for drift has its permissions changed such that it is no longer readable, then it is treated and recorded as a deleted file entry.

commit hash: 786eb9d50b9c8beebf5a9a7edf18e8ba82ef79cd
Comment 5 Mike Foley 2011-09-29 14:19:36 EDT
tested with files with and without rw permission.  could not reproduce.
Comment 8 Stefan Negrea 2012-02-08 17:20:53 EST
The discovery process was not using the home directory for the JBoss instance as relative path for the file. Instead it was defaulting to the home directory of the agent installation. Since the file was not found among the agent files, it would throw an exception during SHA256 computation. 

I visually inspected the rest of this component and this was the only occurrence of the problem.
Comment 10 Heiko W. Rupp 2013-08-31 06:49:02 EDT
Closing as this was implemented in RHQ 4.3 and has not been reopened since.