2015-10-21 63 views
0

如果我们在命令行中运行以下命令,它工作正常。但是,当我们从Nagios的运行这个命令基础的工具,它与下面的错误failes: -REST API不起作用

java -jar /opt/monitor/nagios/notify/REST/RestInterface.jar 
/opt/monitor/nagios/notify/REST/settings.xml "2015-10-20 12:57:11" L 

结果代码:1个

错误输出:

java.io.IOException: Couldn't get lock for RestInterface.log  
     at java.util.logging.FileHandler.openFiles(FileHandler.java:389)  
     at java.util.logging.FileHandler.(FileHandler.java:363)  
     at com.google.nagios.notify.RestInterface.loggerInit(Unknown Source)  
     at com.google.nagios.notify.RestInterface.main(Unknown Source)  
Oct 20, 2015 12:57:11 PM com.google.nagios.notify.RestInterface logToOS 
SEVERE: null 
java.io.IOException: Cannot run program "EVENTCREATE": error=2, No such file or directory  
     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)  
     at java.lang.Runtime.exec(Runtime.java:617)  
     at java.lang.Runtime.exec(Runtime.java:450)  
      at java.lang.Runtime.exec(Runtime.java:347)  
     at com.google.nagios.notify.RestInterface.logToOS(Unknown Source)  
     at com.google.nagios.notify.RestInterface.loggerInit(Unknown Source)  
     at com.google.nagios.notify.RestInterface.main(Unknown Source) 
Caused by: java.io.IOException: error=2, No such file or directory  
     at java.lang.UNIXProcess.forkAndExec(Native Method)  
     at java.lang.UNIXProcess.(UNIXProcess.java:186) 
     at java.lang.ProcessImpl.start(ProcessImpl.java:130)  
     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)  
     ... 6 more 
Exception in thread "main" java.lang.NullPointerException  
     at com.google.nagios.notify.RestInterface.loggerInit(Unknown Source)  
     at com.google.nagios.notify.RestInterface.main(Unknown Source)  
+0

你正在使用哪个操作系统? –

+0

Redhat Linux 6.5 – ErAB

+0

REST API正在使用命令行,但是当此命令从GUI运行时,它不起作用。 – ErAB

回答

2

似乎RestInterface .log被其他进程锁定。只要杀死其他进程即可写入文件。

+0

我们如何知道哪些进程锁定了文件RestInterface.log? – ErAB

+0

REST API正在使用命令行,但是当此命令从GUI运行时,它不起作用。 – ErAB

+1

检查哪些进程正在使用您的文件。打开终端 - >并输入这个命令'ps -ef | grep RestInterface.log'它会显示使用你的文件的进程列表。然后使用'kill -9 processID'命令终止进程。 –

相关问题