2008-09-06 19:06:12,808 ERROR [InventoryManager.discovery-1] (rhq.plugins.apache.util.ApacheBinaryInfo)- Error running binary 'C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe': executable cannot contain whitespace. Executable: [C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe] java.lang.IllegalArgumentException: executable cannot contain whitespace. Executable: [C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe] at org.rhq.core.system.ProcessExecution.<init>(ProcessExecution.java:56) at org.rhq.plugins.apache.util.ApacheBinaryInfo.getVersionCommandInfo(ApacheBinaryInfo.java:134) at org.rhq.plugins.apache.util.ApacheBinaryInfo.getApacheBinaryInfo(ApacheBinaryInfo.java:192) at org.rhq.plugins.apache.util.ApacheBinaryInfo.getInfo(ApacheBinaryInfo.java:75) at org.rhq.plugins.apache.ApacheServerDiscoveryComponent.discoverResources(ApacheServerDiscoveryComponent.java:78) at org.rhq.core.pc.inventory.AutoDiscoveryExecutor.pluginDiscovery(AutoDiscoveryExecutor.java:193) at org.rhq.core.pc.inventory.AutoDiscoveryExecutor.call(AutoDiscoveryExecutor.java:99) at org.rhq.core.pc.inventory.AutoDiscoveryExecutor.run(AutoDiscoveryExecutor.java:88) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619)
Underlying issue is this check in the constructor of ProcessExecution: StringTokenizer splitter = new StringTokenizer(executable); if (splitter.countTokens() > 1) { throw new IllegalArgumentException("executable cannot contain whitespace. Executable: [" + executable + "]"); } It filters all path with whitespaces -- even if they had been escaped as in "/tmp/t\ est/echo". Note that doing the following ProcessExecution pe = new ProcessExecution("dummy"); pe.setExecutable("/tmp/t\ est/echo"); will not check for whitespaces and will happily execute the echo command
See also https://jira.jboss.org/jira/browse/JBNADM-3459
I have to believe we can take that tokenizer check out. I can't see how that could ever be a good thing - since Windows loves spaces in full paths to executables. Whatever this was meant to fix, needs to be fixed in another way - this check has to be removed.
Check for spaces has been eliminated.
QA Verified, I have set the executable location to "/tmp/foo bar/httpd" (a symlink to the original location) and submitted. The system appears to have no problems finding the httpd server.
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-793