我们目前正在尝试从schema-registry 1.0.1升级到2.0.1。我们看到这在使用以下版本升级之前有效:kafka_2.10版本0.9.0.2.4.0.0,kafka-avro-serializer版本2.0.1,avro版本1.7.7
升级后,先前成功的相同请求现在因HTTP 404错误而失败:
[2016-07-26 10:11:05,748] INFO - - [26/Jul/2016:10:11:05 +0000] "POST //subjects/thing-avro-key/versions HTTP/1.1" 404 49 4 (io.confluent.rest-utils.requests:77)
2016-07-26 11:23:00.908 b.s.d.executor [ERROR]
org.apache.kafka.common.errors.SerializationException: Error registering Avro schema: "string"
Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: HTTP 404 Not Found; error code: 404
at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:157) ~[stormjar.jar:?]
我们使用CURL进行了检查,并且能够使用示例发布架构:
curl -X POST -i -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema": "{\"type\": \"string\"}"}' http://localhost:8081/subjects/Kafka-value/versions
然后我们认为Avro架构:“string”可能是问题所在,因此创建了一个ThingKey架构,但仍然遇到类似的错误:
2016-07-26 11:47:31.347 b.s.d.executor [ERROR]
org.apache.kafka.common.errors.SerializationException: Error registering Avro schema: {"type":"record","name":"ThingKey","namespace":"com.x.platform.messages","doc":"A thing identifier for partitioning","fields":[{"name":"thing_id","type":{"type":"string","avro.java.string":"String"},"doc":"Thing identifier"}]}
Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: HTTP 404 Not Found; error code: 404
我们使用以下代码发布消息:
ProducerRecord<String, SpecificRecordBase> producerRecord = new ProducerRecord<>(topic, getMessageKey(msg), extractAvroMessage(msg));
producer.send(producerRecord);
public SpecificRecordBase extractAvroMessage(KafkaMessage msg)
public String getMessageKey(KafkaMessage msg)
非常感谢任何想法或建议。
谢谢, 罗斯
更新:已修复 - 问题是由于请求路径中的其他斜杠导致由于版本2.0.1中更严格的验证而导致失败。详情请见:https://github.com/confluentinc/schema-registry/issues/388