0

The problem exists using eclips on window10

5월 25, 2017 9:15:52 오전 org.apache.catalina.core.StandardWrapperValve invoke
심각: Servlet.service() for servlet [jsp] in context with path [/ESTIS] threw exception [An exception occurred processing JSP page /Estis/Admin_SystemMonitoring.jsp at line 51

48:         SystemMonitoring sm=new SystemMonitoring();
49:         CPUVo cpuVo=new CPUVo();
50:         MemoryVo memoryVo=new MemoryVo();
51:         cpuVo=sm.getCPU();
52:         memoryVo=sm.getMemory();
53:     %>
54:     <div><%=cpuVo.getTotalSysTime() %></div>


Stacktrace:] with root cause
java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Cpu.gather(Lorg/hyperic/sigar/Sigar;)V
    at org.hyperic.sigar.Cpu.gather(Native Method)
    at org.hyperic.sigar.Cpu.fetch(Cpu.java:30)
    at org.hyperic.sigar.Sigar.getCpu(Sigar.java:320)
    at org.hyperic.sigar.Sigar.getCpuPerc(Sigar.java:341)
    at SystemMonitoring.SystemMonitoring.getCPU(SystemMonitoring.java:27)
    at org.apache.jsp.Estis.Admin_005fSystemMonitoring_jsp._jspService(Admin_005fSystemMonitoring_jsp.java:163)

I call Sigar API in Admin_SystemMonitoring.jsp

public CPUVo getCPU()

    {

        System.out.println("================== CPU DATA ====================");
        Sigar sigar = new Sigar();
        CpuPerc cpu = null;
        CpuPerc[] cpus = null;
        CPUVo vo=new CPUVo();
        try
        {
            cpu = sigar.getCpuPerc();
            cpus = sigar.getCpuPercList();
            vo.setUserTime(CpuPerc.format(cpu.getUser()));
            vo.setTotalSysTime(CpuPerc.format(cpu.getSys()));
            vo.setTotalIdle(CpuPerc.format(cpu.getIdle()));
            System.out.println(String.format("Total User Time : %s / Total Sys Time : %s / Total Idle  : %s ",
                    vo.getUserTime(),
                    vo.getTotalSysTime(),
                    vo.getTotalIdle()));

        } catch (Exception e)
        {
            e.printStackTrace();
        }
        return vo;
    }

but the SystemMonitoring class do work, if I call in in java main class. also, I add Sigar.jar in (project-properties-java build path) and (WebContent-WEB-INF-lib)

I don't know why it doesn't work if I call the method in jsp... how can I fix it?

  • If you are deploying your app in a different computer than yours, sigar dll or so files, depending on the OS, should be installed and accessible there. https://stackoverflow.com/questions/11612711/sigar-unsatisfiedlinkerror?rq=1 – RubioRic May 25 '17 at 06:31
  • @RubioRic I also add -Djava.library.path="./lib" as jvm argument like the link , but it still doen't work even in my com. how can i fix UnsatisfiedLinkError otherly? how can I install sigar dll on window 10 in eclips project? – HeidiHyejiKim May 25 '17 at 06:43
  • Others have solved the problem copying also the dll files to WebContent-WEB-INF-lib https://stackoverflow.com/questions/8286976/using-sigar-api-inside-a-war-file Have you tried that? – RubioRic May 25 '17 at 06:49
  • @RubioRic OMG I tried now and it works!!!!!!Thank u so much!!!!! – HeidiHyejiKim May 25 '17 at 06:52
  • You're welcome. Glad to help. :-) – RubioRic May 25 '17 at 06:53

0 Answers0