jProcesses icon indicating copy to clipboard operation
jProcesses copied to clipboard

Null Pointer Exceptions

Open petercambal opened this issue 6 years ago • 5 comments

Hello, I am using you library at Linux: Linux ip----*** 4.9.77-31.58.amzn1.x86_64 x86_64 x86_64 x86_64 GNU/Linux


From time to time I got exception: java.lang.NullPointerException at org.jutils.jprocesses.info.UnixProcessesService.parseList(UnixProcessesService.java:49) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:50) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:43) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:35) at org.jutils.jprocesses.JProcesses.getProcessList(JProcesses.java:136)


Edit: I found another One java.lang.NullPointerException at org.jutils.jprocesses.info.UnixProcessesService.loadFullCommandData(UnixProcessesService.java:171) at org.jutils.jprocesses.info.UnixProcessesService.parseList(UnixProcessesService.java:88) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:50) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:43) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:35)


It would be great if you could check this issue, why is this happening and how to prevent this.

petercambal avatar Mar 26 '18 12:03 petercambal

Hello,

What happens if you launch from your bash console the following command.?:

ps -e -o pid,command

profesorfalken avatar Mar 26 '18 13:03 profesorfalken

It prints list of processes, attributes processID and command. I will put a screenshot below.

screenshot_1

petercambal avatar Mar 26 '18 14:03 petercambal

Hi,

This is weird. The only thing that can cause this NPE is an error executing the command.

Normally the stack of the IOException should be logged at severe level:

Logger.getLogger(ProcessesUtils.class.getName()).log(Level.SEVERE, null, ex);

Could you check if you have a log somewhere of type: "Cannot run program"... ?

Thanks

profesorfalken avatar Mar 26 '18 16:03 profesorfalken

Another question. Does it happen systematically?

I have build a new version that should give us more clues.

If you are using maven, just add the dependency as:

<dependency>
         <groupId>org.jprocesses</groupId>
         <artifactId>jProcesses</artifactId>
     	<version>1.6.5-SNAPSHOT</version>
  </dependency>

If not, you can download the JAR file directly from here: https://oss.sonatype.org/content/repositories/snapshots/org/jprocesses/jProcesses/1.6.5-SNAPSHOT/jProcesses-1.6.5-20180326.171140-2.jar

profesorfalken avatar Mar 26 '18 17:03 profesorfalken

It hapenned 24x over last 4 days, on 4 servers. Others seems fine. I did not notice any log with "Cannot run program" message. I am going to deploy code with new version and I will keep you updated.

Edit: I updated version in maven xml file, but it can not find dependency with this version.

petercambal avatar Mar 27 '18 11:03 petercambal