Make sure you have same *hadoop-core*.jar* and all the libraries included in the Hadoop lib directory in the classpath.
It looks like can not find the class org.apache.hadoop.log.metrics.EventCounter which was configured at log4j.properties. You should check the following line at log4j.properties: log4j.appender.EventCounter=org.apache.hadoop.log.metrics.EventCounter You can try to change it to org.apache.hadoop.metrics.jvm.EventCounter 2014-07-16 5:12 GMT+08:00 Ashish Dobhal <dobhalashish...@gmail.com>: > Hey Anandha, > I am using hadoop 2.3.0 on using the hadoop command I got the folowing > error. > > bin/hadoop oiv -i /home/hduser/fsimage1234 -o /home/hduser/please.txt > DEPRECATED: Use of this script to execute hdfs command is deprecated. > Instead use the hdfs command for it. > > log4j:ERROR Could not instantiate class > [org.apache.hadoop.log.metrics.EventCounter]. > java.lang.ClassNotFoundException: > org.apache.hadoop.log.metrics.EventCounter > at java.net.URLClassLoader$1.run(URLClassLoader.java:366) > at java.net.URLClassLoader$1.run(URLClassLoader.java:355) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:354) > at java.lang.ClassLoader.loadClass(ClassLoader.java:425) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) > at java.lang.ClassLoader.loadClass(ClassLoader.java:358) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:190) > at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198) > at > org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327) > at > org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124) > at > org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:785) > at > org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) > at > org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) > at > org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) > at > org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580) > at > org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526) > at org.apache.log4j.LogManager.<clinit>(LogManager.java:127) > at org.apache.log4j.Logger.getLogger(Logger.java:104) > at > org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:262) > at > org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:108) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:526) > at > org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1025) > at > org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:844) > at > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:541) > at > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292) > at > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:269) > at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:657) > at > org.apache.hadoop.hdfs.tools.offlineImageViewer.OfflineImageViewer.<clinit>(OfflineImageViewer.java:47) > log4j:ERROR Could not instantiate appender named "EventCounter". > Exception in thread "main" java.io.FileNotFoundException: > /home/hduser/please.txt (Permission denied) > at java.io.FileOutputStream.open(Native Method) > at java.io.FileOutputStream.<init>(FileOutputStream.java:221) > at java.io.FileOutputStream.<init>(FileOutputStream.java:110) > at > org.apache.hadoop.hdfs.tools.offlineImageViewer.TextWriterImageVisitor.<init>(TextWriterImageVisitor.java:62) > at > org.apache.hadoop.hdfs.tools.offlineImageViewer.LsImageVisitor.<init>(LsImageVisitor.java:58) > at > org.apache.hadoop.hdfs.tools.offlineImageViewer.OfflineImageViewer.main(OfflineImageViewer.java:254) > THANKS > > > > On Wed, Jul 16, 2014 at 2:28 AM, Anandha L Ranganathan < > analog.s...@gmail.com> wrote: > >> which version of hadoop are you using ? >> >> If it is 2.4.x and above use hdfs -oiv <input> <output> >> otherwise use hadoop -oiv. <input> <output> >> >> >> On Tue, Jul 15, 2014 at 12:51 PM, Ashish Dobhal < >> dobhalashish...@gmail.com> wrote: >> >>> Hey everyone i got the following error with the oiv tool. >>> Please help >>> ERROR >>> >>> hdfs oiv -i /home/hduser/fsimage1234 -o /home/hduser/interpret.txt >>> Exception in thread "main" java.lang.NoClassDefFoundError: >>> org/apache/commons/cli/ParseException >>> at java.lang.Class.getDeclaredMethods0(Native Method) >>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2570) >>> at java.lang.Class.getMethod0(Class.java:2813) >>> at java.lang.Class.getMethod(Class.java:1663) >>> at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) >>> at >>> sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) >>> Caused by: java.lang.ClassNotFoundException: >>> org.apache.commons.cli.ParseException >>> at java.net.URLClassLoader$1.run(URLClassLoader.java:366) >>> at java.net.URLClassLoader$1.run(URLClassLoader.java:355) >>> at java.security.AccessController.doPrivileged(Native Method) >>> at java.net.URLClassLoader.findClass(URLClassLoader.java:354) >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:425) >>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:358) >>> ... 6 more >>> THANKS A LOT >>> >> >> >