java.lang.UnsupportedClassVersionError:Unsupported major.minor version 51.0

   今天在配置flume-ng时出现这样的错误:

03 Nov 2015 16:50:11,147 ERROR [conf-file-poller-0] (org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run:149)  - Unhandled error

java.lang.UnsupportedClassVersionError: org/apache/hadoop/io/SequenceFile$CompressionType : Unsupported major.minor version 51.0

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:643)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)

        at java.net.URLClassLoader.access$000(URLClassLoader.java:73)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:212)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)

        at org.apache.flume.sink.hdfs.HDFSEventSink.configure(HDFSEventSink.java:239)

        at org.apache.flume.conf.Configurables.configure(Configurables.java:41)

        at org.apache.flume.node.AbstractConfigurationProvider.loadSinks(AbstractConfigurationProvider.java:413)

        at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:98)

        at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)

        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

        at java.lang.Thread.run(Thread.java:701)


  在网上查了下说是,程序编译的时候用了一个较高版本的JDK,但是在程序运行的时候却用了一个较低版本的jdk。由于云服务器要运行另外一个软件,安装的是jdk1.6,而flume-ng需要jdk1.7所以报错。

      解决:下载jdk1.7解压安装,并将jdk1.7的安装路径添加到flume-env.sh中,重启flume-ng即可。

你可能感兴趣的:(jdk1.7,flume-ng)