问题
代码语言:javascript复制[root@localhost bin]# ./kafka-server-start.sh ../config/server.properties
[2023-10-25 14:37:59,386] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2023-10-25 14:37:59,697] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.VerifyError: Uninitialized object exists on backward branch 193
Exception Details:
Location:
scala/collection/immutable/HashMap$HashTrieMap.split()Lscala/collection/immutable/Seq; @238: goto
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2ab6 0044 04a0 000f bb00 da59 2ab2 00df
0000010: b700 e2b0 2ab6 003e b800 523c 1b04 a401
0000020: 5b1b 056c 3d2a 1b05 6c2a b600 3eb7 00e4
0000030: 3e2a b600 3e02 1d78 7e36 042a b600 3e02
0000040: 1020 1d64 7c7e 3605 bb00 1c59 b200 e92a
0000050: b600 41c0 00eb b600 efb7 00f2 1cb6 00f6
0000060: 3a06 1906 c600 1a19 06b6 00f9 c000 773a
0000070: 0719 06b6 00fc c000 773a 08a7 000c bb00
0000080: fe59 01b7 0101 bf19 073a 0919 083a 0abb
0000090: 0002 5915 0419 09bb 001c 59b2 00e9 1909
00000a0: c000 ebb6 00ef b700 f203 b801 073a 0e3a
00000b0: 0d03 190d b901 0b01 0019 0e3a 1136 1036
00000c0: 0f15 0f15 10a0 0008 1911 a700 2715 0f04
00000d0: 6015 1019 0d15 0fb9 010e 0200 c000 053a
00000e0: 1719 1119 17b8 0112 3a11 3610 360f a7ff
00000f0: d3b8 0116 b700 803a 0bbb 0002 5915 0519
0000100: 0abb 001c 59b2 00e9 190a c000 ebb6 00ef
0000110: b700 f203 b801 073a 133a 1203 1912 b901
0000120: 0b01 0019 133a 1636 1536 1415 1415 15a0
0000130: 0008 1916 a700 2715 1404 6015 1519 1215
0000140: 14b9 010e 0200 c000 053a 1819 1619 18b8
0000150: 0119 3a16 3615 3614 a7ff d3b8 0116 b700
0000160: 803a 0cbb 00da 5919 0bbb 00da 5919 0cb2
0000170: 00df b700 e2b7 00e2 b02a b600 4103 32b6
0000180: 011b b0
Stackmap Table:
same_frame(@20)
full_frame(@126,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147]},{})
append_frame(@135,Object[#119],Object[#119])
full_frame(@193,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147],Object[#119],Object[#119],Object[#119],Object[#119],Top,Top,Object[#28],Object[#78],Integer,Integer,Object[#145]},{Uninitialized[#143],Uninitialized[#143],Integer,Object[#119]})
full_frame(@205,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147],Object[#119],Object[#119],Object[#119],Object[#119],Top,Top,Object[#28],Object[#78],Integer,Integer,Object[#145]},{Uninitialized[#143],Uninitialized[#143],Integer,Object[#119]})
full_frame(@241,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147],Object[#119],Object[#119],Object[#119],Object[#119],Top,Top,Object[#28],Object[#78],Integer,Integer,Object[#145]},{Uninitialized[#143],Uninitialized[#143],Integer,Object[#119],Object[#145]})
full_frame(@299,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147],Object[#119],Object[#119],Object[#119],Object[#119],Object[#2],Top,Object[#28],Object[#78],Integer,Integer,Object[#145],Object[#28],Object[#78],Integer,Integer,Object[#145]},{Uninitialized[#249],Uninitialized[#249],Integer,Object[#119]})
full_frame(@311,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147],Object[#119],Object[#119],Object[#119],Object[#119],Object[#2],Top,Object[#28],Object[#78],Integer,Integer,Object[#145],Object[#28],Object[#78],Integer,Integer,Object[#145]},{Uninitialized[#249],Uninitialized[#249],Integer,Object[#119]})
full_frame(@347,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#147],Object[#119],Object[#119],Object[#119],Object[#119],Object[#2],Top,Object[#28],Object[#78],Integer,Integer,Object[#145],Object[#28],Object[#78],Integer,Integer,Object[#145]},{Uninitialized[#249],Uninitialized[#249],Integer,Object[#119],Object[#145]})
full_frame(@377,{Object[#2],Integer},{})
at scala.collection.immutable.HashMap$.scala$collection$immutable$HashMap$$makeHashTrieMap(HashMap.scala:340)
at scala.collection.immutable.HashMap$.scala$collection$immutable$HashMap$$makeHashTrieMap(HashMap.scala:344)
at scala.collection.immutable.HashMap$HashMap1.updated0(HashMap.scala:390)
at scala.collection.immutable.HashMap.updated(HashMap.scala:79)
at scala.collection.immutable.Map$Map4.updated(Map.scala:467)
at scala.collection.immutable.Map$Map4.$plus(Map.scala:468)
at scala.collection.immutable.Map$Map4.$plus(Map.scala:430)
at scala.collection.mutable.MapBuilder.$plus$eq(MapBuilder.scala:32)
at scala.collection.mutable.MapBuilder.$plus$eq(MapBuilder.scala:28)
at scala.collection.generic.Growable.$anonfun$$plus$plus$eq$1(Growable.scala:62)
at scala.collection.generic.Growable$$Lambda$6/315138752.apply(Unknown Source)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:62)
at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:53)
at scala.collection.mutable.MapBuilder.$plus$plus$eq(MapBuilder.scala:28)
at scala.collection.generic.GenMapFactory.apply(GenMapFactory.scala:51)
at kafka.server.KafkaConfig$.<init>(KafkaConfig.scala:338)
at kafka.server.KafkaConfig$.<clinit>(KafkaConfig.scala)
at kafka.Kafka$.buildServer(Kafka.scala:72)
at kafka.Kafka$.main(Kafka.scala:91)
at kafka.Kafka.main(Kafka.scala)
排查思路
这玩意儿一看就是JDK版本的问题
问题出在 JDK 次要版本上。 Scala 2.12 需要更新版本的 JDK,然后是 1.8.0_111
我这里的版本虽然看起来对,但是JAVA_HOME不对。 无论运行哪个版本的 JRE,都需要 JAVA_HOME 指向正确的 JDK 版本。
解决办法
- 要么更新系统默认的JAVA_HOME的值
- 要么启动前 export JAVA_HOME
我采用了第二种方法
代码语言:javascript复制[root@localhost bin]# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-1.el7_9.x86_64/jre
[root@localhost bin]# ./kafka-server-start.sh ../config/server.properties
问题解决