下面的Java代码抛出异常,如底部所示。 环境:Tomcat,Java8
KafkaConsumer <String, Map<ConfidentialityLevel, CommonCoreEvent>> consumer;
Properties props = new Properties();
String topic = "common-core-document-changes";
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka-dev-0.europe.intranet:9092");
props.put("schema.registry.url", "http://kafka-dev-0.europe.intranet:8081");
props.put(ConsumerConfig.CLIENT_ID_CONFIG, "dbnlxclasid1");
props.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID().toString());
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KafkaAvroDeserializer.class.getName());
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,true);
consumer = new KafkaConsumer<String, Map<ConfidentialityLevel, CommonCoreEvent>>;
使用的JAR文件:
org.apache.kafka.common.KafkaException:io.confluent.kafka.serializers.KafkaAvroDeserializer不是一个 的org.apache.kafka.common.serialization.Deserializer的实例 org.apache.kafka.common.config.AbstractConfig.getConfiguredInstance(AbstractConfig.java:304) 〜[kafka-clients-2.1.0.jar :?]在 org.apache.kafka.clients.consumer.KafkaConsumer。(KafkaConsumer.java:702) 〜[kafka-clients-2.1.0.jar :?]在 org.apache.kafka.clients.consumer.KafkaConsumer。(KafkaConsumer.java:652) 〜[kafka-clients-2.1.0.jar :?]在 org.apache.kafka.clients.consumer.KafkaConsumer。(KafkaConsumer.java:632) 〜[kafka-clients-2.1.0.jar :?]在 com.pegarules.generation.TestAvroConnection_010101_qPwokWCGxT9_f489yHaFPQ.TestAvroConnection01_01_01(TestAvroConnection_010101_qPwokWCGxT9_f489yHaFPQ.java:118) 〜[?:?]在 com.pegarules.generation.TestAvroConnection_010101_qPwokWCGxT9_f489yHaFPQ.invoke(TestAvroConnection_010101_qPwokWCGxT9_f489yHaFPQ.java:84) 〜[?:?]在 com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(LibraryRuntime.java:222) 〜[prprivate.jar :?]在 com.pega.pegarules.generation.internal.library.LibraryRuntime.invokeLibraryRuntime(LibraryRuntime.java:119) 〜[prprivate.jar :?]在 com.pega.pegarules.session.internal.mgmt.Executable.invokeLibraryRuntime(Executable.java:9164) 〜[prprivate.jar :?]在 com.pega.pegarules.priv.generator.LibrarySupport.resolveAndInvokeFunctionViaReflectionWithException(LibrarySupport.java:275) 〜[prpublic.jar :?]在 com.pegarules.generation.activity.sh_action_testavroconnection_799dcecaa7fc5c59f7e4b42a87bb6bd4.step1_circum0(sh_action_testavroconnection_799dcecaa7fc5c59f7e4b42a87bb6bd4.java:162) 〜[?:?]在 com.pegarules.generation.activity.sh_action_testavroconnection_799dcecaa7fc5c59f7e4b42a87bb6bd4.perform(sh_action_testavroconnection_799dcecaa7fc5c59f7e4b42a87bb6bd4.java:71) 〜[?:?]在 com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3586) 〜[prprivate.jar :?]在 com.pega.pegarules.session.internal.mgmt.Executable.doAction(Executable.java:3319) 〜[prprivate.jar :?]在 com.pegarules.generation.activity.ra_action_pyrunrecordexecute_f7d1e1c1513eef165c7ecbe136f3addd.step2_circum0(ra_action_pyrunrecordexecute_f7d1e1c1513eef165c7ecbe136f3addd.java:249) 〜[?:?]在 com.pegarules.generation.activity.ra_action_pyrunrecordexecute_f7d1e1c1513eef165c7ecbe136f3addd.perform(ra_action_pyrunrecordexecute_f7d1e1c1513eef165c7ecbe136f3addd.java:88) 〜[?:?]在 com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3586) 〜[prprivate.jar :?]在 com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10770) 〜[prprivate.jar :?]在 com.pegarules.generation.activity.ra_action_pzrunrecordexecute_c38281e0bb63f7c4aab88814460c8435.step11_circum0(ra_action_pzrunrecordexecute_c38281e0bb63f7c4aab88814460c8435.java:1027)〜[?:?] at com.pegarules.generation.activity.ra_action_pzrunrecordexecute_c38281e0bb63f7c4aab88814460c8435.perform(ra_action_pzrunrecordexecute_c38281e0bb63f7c4aab88814460c8435.java:246) 〜[?:?]在 com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3586) 〜[prprivate.jar :?]在 com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:646) 〜[prprivate.jar:?]