Hostname问题
在Kafka的启动的时候遇到以下报错(包括kafka Test启动):1
2
3
4
5
6
7
8
9
10
11java.lang.NoClassDefFoundError: Could not initialize class kafka.network.RequestChannel$
at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:114) ~[kafka_2.11-0.10.1.1.jar:na]
at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:492) ~[kafka_2.11-0.10.1.1.jar:na]
at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:487) ~[kafka_2.11-0.10.1.1.jar:na]
at scala.collection.Iterator$class.foreach(Iterator.scala:893) ~[scala-library-2.11.8.jar:na]
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336) ~[scala-library-2.11.8.jar:na]
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) ~[scala-library-2.11.8.jar:na]
at scala.collection.AbstractIterable.foreach(Iterable.scala:54) ~[scala-library-2.11.8.jar:na]
at kafka.network.Processor.processCompletedReceives(SocketServer.scala:487) ~[kafka_2.11-0.10.1.1.jar:na]
at kafka.network.Processor.run(SocketServer.scala:417) ~[kafka_2.11-0.10.1.1.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
经过反复测试需要配置主机的hostname有在host里头配置
第一步: 通过
hostname
命令查看主机hostname:1
2> hostname
my.local在
/etc/hosts
中配置hostname的映射1
127.0.0.1 my.local