From: jrallen9 <jus...@te...> - 2010-01-01 17:31:39
|
I have a problem with how sigar is calling its native methods. I built a simple java test program which made method calls to gather stats on a Windows XP x86 computer. Using a Sigar object I was able to make method calls to CpuPerc, Mem, Filesystem and DiskUsage and display these results to a console. Since I'm using eclipse to develop this program all I had to do was add the sigar.jar to my class path and both java was able to load the jar, and sigar was able to load the sigar-winnt-x86.dll (which was in its default lib directory as sigar.jar). Fast Forward to integrating this code into a production project. Since adding this sigar code to a production project I'm building, I'm faced with a problem where the program calls native methods for CpuPerc.gather(), Mem.gather(), and FileSystem.gather(), just fine with out exceptions, but when calling DiskUsage.gather(), I get a SigarFileNotFoundException indicating the program can't find the native method for the DiskUsage.gather() to return with valid data. This error really confuses me, because when I don't include the path to the lib directory where sigar-winnt-x86.dll resides, every method which uses the sigar API will fail at the point it requires the native code. However when I do include the lib directory for sigar-winnt-x86.dll, all of the above objects are able to find the native code except for the DiskUsage object. The reason I mentioned the test program is because both the test program and the production program reference the same sigar.jar, and the sigar-winnt-x86.dll locations and files. The production program uses multiple threads, but only one thread is responsible for executing code using sigar API objects. In trying to troubleshoot this problem I've been sifting through the source distro of the sigar download and found win32_sigar.c and a C function : SIGAR_DECLARE(int) sigar_disk_usage_get(sigar_t *sigar, const char *dirname, sigar_disk_usage_t *disk) Is this function the native function which DiskUsage.fetch() calls into? Is win32_sigar.c included in the sigar-winnt-x86.dll? Any help trying to resolve this problem would be very much appreciated. Feel free to email me if you need additional stack trace, configuration questions, or have other probative questions. My email is justin (dot) allen (at) teradata (dot) com |