0
我試圖在我的項目中重新分配分區,並且出現此錯誤。Kafka ReassignPartitionsCommand:IllegalArgumentException:long不是值類型
2017-08-22 15:57:28 DEBUG ZookeeperBackedAdoptionLogicImpl:320 - Calling ReassignPartitionsCommand with args:[--reassignment-json-file=partitions-to-move.json.1503417447767, --zookeeper=172.31.14.207:2181, --execute]
java.lang.IllegalArgumentException: long is not a value type
at joptsimple.internal.Reflection.findConverter(Reflection.java:66)
at joptsimple.ArgumentAcceptingOptionSpec.ofType(ArgumentAcceptingOptionSpec.java:111)
at kafka.admin.ReassignPartitionsCommand$ReassignPartitionsCommandOptions.<init>(ReassignPartitionsCommand.scala:301)
at kafka.admin.ReassignPartitionsCommand$.validateAndParseArgs(ReassignPartitionsCommand.scala:236)
at kafka.admin.ReassignPartitionsCommand$.main(ReassignPartitionsCommand.scala:34)
at kafka.admin.ReassignPartitionsCommand.main(ReassignPartitionsCommand.scala)
at rebalancer.core.ZookeeperBackedAdoptionLogicImpl.reassignPartitionToLocalBroker(ZookeeperBackedAdoptionLogicImpl.java:321)
at rebalancer.core.ZookeeperBackedAdoptionLogicImpl.adoptRemotePartition(ZookeeperBackedAdoptionLogicImpl.java:267)
at rebalancer.core.ZookeeperBackedAdoptionLogicImpl.run(ZookeeperBackedAdoptionLogicImpl.java:118)
我創建了json文件並將其用作重新分配分區的輸入。我試圖用kafka的內建腳本使用同一個文件,它正在工作。
kafka-reassign-partitions.bat --reassignment-json-file=partitions-to-move.json.1503417447767 --zookeeper=172.31.14.207:2181 --execute
我也試着寫一個簡單的程序使用相同的代碼來測試相同的文件,它的工作爲好。這發生在任何json文件上,我在測試之前重置了kafka環境。
public class reassignPartition {
private static CuratorFramework client;
public static void main (String[] args) {
client = CuratorFrameworkFactory.newClient(args[0] + ":2181", new ExponentialBackoffRetry(1000, 30));
client.start();
String reassignmentConfigFileName = args[1];
String[] reassignCmdArgs = { "--reassignment-json-file=" + Paths.get(reassignmentConfigFileName),
"--zookeeper=" + client.getZookeeperClient().getCurrentConnectionString(), "--execute" };
System.out.println("Calling ReassignPartitionsCommand with args:{}"+ Arrays.toString(reassignCmdArgs));
ReassignPartitionsCommand.main(reassignCmdArgs);
}
}
可能是什麼問題?
更新: Json的內容
{"partitions":[{"topic":"test1","partition":0,"replicas":[1]}],"version":1}
打印您的json文件內容pls – GuangshengZuo
@GuangshengZuo添加了json內容 –