kafka创建topic异常

时间:2024-01-02 20:48:08

问题描述:

   kafak运行在weblogic账户下,jdk1.8,当在root账户下创建topic(当前账户下的jdk1.6)导致创建topic失败

./bin/kafka-topics.sh --create --zookeeper x.x.x.x: --replication-factor  --partitions  --topic ngx
Exception in thread "main" java.lang.UnsupportedClassVersionError: joptsimple/OptionSpec : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:)
at java.lang.ClassLoader.defineClass(ClassLoader.java:)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:)
at java.net.URLClassLoader.access$(URLClassLoader.java:)
at java.net.URLClassLoader$.run(URLClassLoader.java:)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:)
at java.lang.ClassLoader.loadClass(ClassLoader.java:)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:)
at java.lang.ClassLoader.loadClass(ClassLoader.java:)
at kafka.admin.TopicCommand.main(TopicCommand.scala)

问题解决:

Unsupported major.minor version 51.0  //运行在jdk1.7+,检查执行用户的jdk版本  
java -version //查看当前账户下jdk版本