• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

NullPointerException

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.NullPointerException
at com.realsoftinc.admc.modules.osmonmodule.SunSolStub.GetPCpuTime(Unknown Source)
at com.realsoftinc.admc.modules.osmonmodule.OsMonModuleSunSol$ProcessMonitor.run(Unknown Source)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)
**********testof admcprocxmllogfillvector******** com.realsoftinc.admc.lib.admin


I am facing the Nullpointer exception, pls give me solution exactly where it is throwing this exception.

public final class ProcessMonitor extends TimerTask{
//double CpuTime;
double CfgCpuTime;
String PrComd;
String x_Priority ="";
private static final double CpuTime = 0;

public void run(){

if (runMonitor) {

if(fname ==null)
fname="";
if(line==-1)
line =0;

String msgTrap;
String date = dateObj.getDateTimeString();
//For each Process in Cfg file, Test it
for (int i = 1; i < cfgVect.getProcessVectSize(); i++) {
//Get Process Command Cfg file
PrComd = gcf.solProcCfg.getCommand(i);

// Get the Maximum number of process
String process = gcf.solProcCfg.getProcess(i);

String x_cfgPriority = gcf.solProcCfg.getPriority(i);
if(x_cfgPriority.endsWith("1"))
x_Priority = AdmcTrapDestInfo.ADMC_INFO_ALARM;
else if(x_cfgPriority.endsWith("2"))
x_Priority = AdmcTrapDestInfo.ADMC_MINOR_ALARM;
else if(x_cfgPriority.endsWith("3"))
x_Priority = AdmcTrapDestInfo.ADMC_MAJOR_ALARM;
else if(x_cfgPriority.endsWith("4"))
x_Priority = AdmcTrapDestInfo.ADMC_CRITICAL_ALARM;

//Get the Percentage of the Cpu time from Configs
CfgCpuTime = gcf.solProcCfg.getCpuTime(i);

try {
//Get the Percentage of the Cpu time from System..
double CpuTime = SunSolStub.GetPCpuTime(process);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Exception from CpuTime:");
e.printStackTrace();
}
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
double CpuTime = SunSolStub.GetPCpuTime(process);

Is 'process' null? What will GetPCpuTime do if it is? The problem could be elsewhere, but a NullPointer usually points to a null value, and this is the one getting passed around.
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a beginner topic, not an advanced one; I'll move this to the Java in General (Beginner) forum for you.
 
Did you just should on me? You should read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!