<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: SAM application: &amp;quot;Unknown protocol id [12] received while deserializing the payload&amp;quot; received from the schema registry in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191809#M65435</link>
    <description>&lt;P&gt;&lt;A href="https://github.com/hortonworks/registry/blob/master/examples/schema-registry/avro/src/main/java/com/hortonworks/registries/schemaregistry/examples/avro/KafkaAvroSerDesApp.java" target="_blank"&gt;https://github.com/hortonworks/registry/blob/master/examples/schema-registry/avro/src/main/java/com/hortonworks/registries/schemaregistry/examples/avro/KafkaAvroSerDesApp.java&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2017 21:00:57 GMT</pubDate>
    <dc:creator>TimothySpann</dc:creator>
    <dc:date>2017-08-08T21:00:57Z</dc:date>
    <item>
      <title>SAM application: "Unknown protocol id [12] received while deserializing the payload" received from the schema registry</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191807#M65433</link>
      <description>&lt;P&gt;I created a minimal SAM application that reads Avro messages from Kafka and writes them to Druid:&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="19549-sam-temperature-humidity-app.png" style="width: 607px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18395iC9AC9B489E7319B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="19549-sam-temperature-humidity-app.png" alt="19549-sam-temperature-humidity-app.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The Avro schema for the data in the Kafka topic was previously added to the schema registry:&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="19550-schema-registry.png" style="width: 656px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18396iB24335CDB8FA7700/image-size/medium?v=v2&amp;amp;px=400" role="button" title="19550-schema-registry.png" alt="19550-schema-registry.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I run the topology, the following error is thrown:&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;com.hortonworks.registries.schemaregistry.serde.SerDesException: Unknown protocol id [12] received while deserializing the payload at com.hortonworks.registries.schemaregistry.serdes.avro.AvroSnapshotDeserializer.retrieveProtocolId(AvroSnapshotDeserializer.java:75) at com.hortonworks.registries.schemaregistry.serdes.avro.AvroSnapshotDeserializer.retrieveProtocolId(AvroSnapshotDeserializer.java:32) at com.hortonworks.registries.schemaregistry.serde.AbstractSnapshotDeserializer.deserialize(AbstractSnapshotDeserializer.java:145) at com.hortonworks.streamline.streams.runtime.storm.spout.AvroKafkaSpoutTranslator.apply(AvroKafkaSpoutTranslator.java:61) at org.apache.storm.kafka.spout.KafkaSpout.emitTupleIfNotEmitted(KafkaSpout.java:335) at org.apache.storm.kafka.spout.KafkaSpout.emit(KafkaSpout.java:316) at org.apache.storm.kafka.spout.KafkaSpout.nextTuple(KafkaSpout.java:236) at org.apache.storm.daemon.executor$fn__5136$fn__5151$fn__5182.invoke(executor.clj:647) at org.apache.storm.util$async_loop$fn__553.invoke(util.clj:484) at clojure.lang.AFn.run(AFn.java:22) at java.lang.Thread.run(Thread.java:745)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I took a peek at the code that's throwing the SerDesException. It seems that the first byte of the Avro inputstream is supposed to contain the protocol version/id:&lt;/P&gt;&lt;PRE&gt;protected byte retrieveProtocolId(InputStream inputStream) throws SerDesException {
    // first byte is protocol version/id.
    // protocol format:
    // 1 byte  : protocol version
    byte protocolId;
    try {
        protocolId = (byte) inputStream.read();
    } catch (IOException e) {
        throw new SerDesException(e);
    }

    if (protocolId == -1) {
        throw new SerDesException("End of stream reached while trying to read protocol id");
    }
    checkProtocolHandlerExists(protocolId);
    return protocolId;
}

private void checkProtocolHandlerExists(byte protocolId) {
    if (SerDesProtocolHandlerRegistry.get().getSerDesProtocolHandler(protocolId) == null) {
        throw new SerDesException("Unknown protocol id [" + protocolId + "] received while deserializing the payload");
    }
}
&lt;/PRE&gt;&lt;P&gt;The first byte of the Avro inputstream appears to be a form-feed character (ASCII code 12):&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="19551-first-byte-line-feed.png" style="width: 393px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18397i33C806B1D1CBBE79/image-size/medium?v=v2&amp;amp;px=400" role="button" title="19551-first-byte-line-feed.png" alt="19551-first-byte-line-feed.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;&lt;/P&gt;&lt;P&gt;Looking at the registry metastore, the only ID that exists is a 2:&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; SELECT id, type, schemaGroup, name FROM registry.schema_metadata_info;
+----+------+-------------+----------------------+
| id | type | schemaGroup | name                 |
+----+------+-------------+----------------------+
|  2 | avro | Kafka       | temperature_humidity |
+----+------+-------------+----------------------+
1 row in set (0.00 sec)
&lt;/PRE&gt;&lt;P&gt;I don't understand how the first byte of the Avro byte array could contain the ID for the schema registry unless it were created with a schema registry aware serializer.&lt;/P&gt;&lt;P&gt;Can you see what I'm doing wrong?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 07:23:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191807#M65433</guid>
      <dc:creator>awoolford</dc:creator>
      <dc:date>2019-08-18T07:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAM application: "Unknown protocol id [12] received while deserializing the payload" received from the schema registry</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191808#M65434</link>
      <description>&lt;P&gt;SAM expects messages are serialized with kafka avro serializer instead of raw avro messages in the topic. You should produce messages into kafka source's topic with KafkaAvroSerializer. You can look at &lt;A target="_blank" href=" SAM expects messages are serialized with kafka avro serializer instead of raw avro messages in the topic. YOu should produce messages into kafka source's topic with KafkaAvroSerializer. You can look at KafkaAvroSerDesApp for producing and consuming messages into/from topic using schema registry serializer/deserializer."&gt;KafkaAvroSerDesApp&lt;/A&gt; for producing and consuming messages into/from topic using schema registry serializer/deserializer.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 20:52:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191808#M65434</guid>
      <dc:creator>sduggana</dc:creator>
      <dc:date>2017-08-08T20:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAM application: "Unknown protocol id [12] received while deserializing the payload" received from the schema registry</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191809#M65435</link>
      <description>&lt;P&gt;&lt;A href="https://github.com/hortonworks/registry/blob/master/examples/schema-registry/avro/src/main/java/com/hortonworks/registries/schemaregistry/examples/avro/KafkaAvroSerDesApp.java" target="_blank"&gt;https://github.com/hortonworks/registry/blob/master/examples/schema-registry/avro/src/main/java/com/hortonworks/registries/schemaregistry/examples/avro/KafkaAvroSerDesApp.java&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 21:00:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/SAM-application-quot-Unknown-protocol-id-12-received-while/m-p/191809#M65435</guid>
      <dc:creator>TimothySpann</dc:creator>
      <dc:date>2017-08-08T21:00:57Z</dc:date>
    </item>
  </channel>
</rss>

