You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "AggelosGr (JIRA)" <ji...@apache.org> on 2016/05/17 14:38:13 UTC

[jira] [Created] (KARAF-4532) SystemCollector throws IOException

AggelosGr created KARAF-4532:
--------------------------------

             Summary: SystemCollector throws IOException
                 Key: KARAF-4532
                 URL: https://issues.apache.org/jira/browse/KARAF-4532
             Project: Karaf
          Issue Type: Bug
          Components: decanter
    Affects Versions: decanter-1.1.0
         Environment: Karaf 4.0.5 
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
            Reporter: AggelosGr
            Priority: Minor


I tried following the decanter guide and noticed that the system collector throws java.io.IOException when trying to execute the commands i specified inside the "org.apache.karaf.decanter.collector.system.cfg" file. 

E.g 
{quote}
2016-05-17 16:58:36,682 | WARN  | scheduler-simple | SystemCollector                  | 55 - org.apache.karaf.decanter.collector.system - 1.1.0 | Command decanter.collector.name execution failed
java.io.IOException: Cannot run program "system" (in directory "."): error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at java.lang.Runtime.exec(Runtime.java:620)
	at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
	at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
	at org.apache.karaf.decanter.collector.system.SystemCollector.run(SystemCollector.java:89)
	at org.apache.karaf.decanter.scheduler.simple.SimpleScheduler.run(SimpleScheduler.java:72)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 9 more
{quote}

This happens because the Dictionary object returned by the injected ComponentContext contains some extra keys except those skipped by [line 70 of the SystemCollector class|https://github.com/apache/karaf-decanter/blob/master/collector/system/src/main/java/org/apache/karaf/decanter/collector/system/SystemCollector.java#L70].

As you can see here
bq. 2016-05-17 16:58:36,671 | DEBUG | scheduler-simple | SystemCollector                  | 55 - org.apache.karaf.decanter.collector.system - 1.1.0 | properties: {service.pid=org.apache.karaf.decanter.collector.system, date=date "+%Y", component.name=org.apache.karaf.decanter.collector.system, felix.fileinstall.filename=file:/Users/agroumas/Downloads/apache-karaf-4.0.5/etc/org.apache.karaf.decanter.collector.system.cfg, decanter.collector.name=system, component.id=1}

the properties object contains three more properties which are being mistaken as commands: 
- component.name=org.apache.karaf.decanter.collector.system
- decanter.collector.name=system
- component.id=1





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)