kafka创建topic异常
问题描述:
kafak运行在weblogic账户下,jdk1.8,当在root账户下创建topic(当前账户下的jdk1.6)导致创建topic失败
./bin/kafka-topics.sh --create --zookeeper x.x.x.x:2181 --replication-factor 1 --partitions 8 --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:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at kafka.admin.TopicCommand.main(TopicCommand.scala)
问题解决:
Unsupported major.minor version 51.0 //运行在jdk1.7+,检查执行用户的jdk版本
java -version //查看当前账户下jdk版本