jcgroup icon indicating copy to clipboard operation
jcgroup copied to clipboard

unable to run example program

Open tvmanikandan opened this issue 10 years ago • 5 comments

Hello, I am trying to run ExampleTest.java as a JUnit Program in eclipse. I have compiled "c" source files and created ".so".

In eclipse I have specified the shared object using the option -Djava.library.path.

The program crashes and the trace is given below:

java.lang.NullPointerException at java.io.Reader.(Reader.java:78) at java.io.InputStreamReader.(InputStreamReader.java:72) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1049) at org.apache.commons.io.IOUtils.toString(IOUtils.java:359) at me.haosdent.cgroup.manage.Admin.(Admin.java:38) at me.haosdent.cgroup.ExampleTest.setUpClass(ExampleTest.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

java.lang.NullPointerException at me.haosdent.cgroup.ExampleTest.tearDownClass(ExampleTest.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Please help.

-Mani

tvmanikandan avatar Nov 26 '14 06:11 tvmanikandan

Got the same issue (and some others). I made a PR to fix it https://github.com/haosdent/jcgroup/pull/6 . It should work if you rename the src/main/resources/RENAMEMEuser_conf to src/main/resources/user_conf and put your user and password in it , but you should also check if you have cgroups installed and configured as well

luan-cestari avatar Dec 30 '14 14:12 luan-cestari

about the file, it was removed, but here is the commit when it used to exist in the project https://github.com/haosdent/jcgroup/commit/7f5dd5ba047a3a604c5649e74ceccf9814660a19

luan-cestari avatar Dec 30 '14 14:12 luan-cestari

For example, on Fedora and related distros (RHEL/CentOS/etc) you probably need to run sudo yum install libcgroup-tools libcgroup to install the cgroups and its commands

luan-cestari avatar Dec 30 '14 17:12 luan-cestari

Thank you for your report. I do all my tests in ubuntu. Let me test it in CentOS. Maybe need some bug fix.

haosdent avatar Dec 30 '14 18:12 haosdent

@tvmanikandan Sorry for miss the issue from github notification until today....

haosdent avatar Dec 30 '14 18:12 haosdent