davsclaus opened a new issue, #9548:
URL: https://github.com/apache/camel-quarkus/issues/9548
### Bug description
The Apicurio Registry 3.3.4 protobuf serde
(`io.apicurio:apicurio-registry-protobuf-serde-kafka`) does not load on Camel
Quarkus main, because the protobuf-java runtime that Quarkus manages is older
than the protoc that generated the Apicurio classes.
Versions:
- Camel Quarkus `main` (4.0.0-SNAPSHOT of 2026-11-20 15:07, Camel 4.23.0),
Quarkus 4.0.0
- Quarkus 4.0.0 (and 4.0.0.CR1, and Quarkus `main`) manages
`com.google.protobuf:protobuf-java` **4.35.1** (`protobuf-java.version` =
`protoc.version`). The Camel Quarkus BOM does not manage protobuf-java, so the
Quarkus version applies.
- Quarkus 4.0.0 manages Apicurio Registry **3.3.4**
(`apicurio-registry.version`, avro and jsonschema serdes). The protobuf serde
is not in the BOM, so an application adds it at that version.
- The protobuf classes in the Apicurio 3.3.4 protobuf serdes are generated
with protoc **4.36.2**: `RuntimeVersion.validateProtobufGencodeVersion(PUBLIC,
4, 36, 2, ...)` in `io.apicurio.registry.serde.protobuf.ref.RefOuterClass`
(`apicurio-registry-serde-common-protobuf`), `additionalTypes.Decimals` and
`metadata.ProtobufSchemaMetadata`
(`apicurio-registry-protobuf-schema-utilities`).
The error, the first time one of these classes is used (for example by the
`ProtobufKafkaSerializer` / `ProtobufKafkaDeserializer` set as
`valueSerializer` / `valueDeserializer` on a Kafka endpoint):
```
java.lang.ExceptionInInitializerError
Caused by:
com.google.protobuf.RuntimeVersion$ProtobufRuntimeVersionException: Detected
incompatible Protobuf Gencode/Runtime versions when loading RefOuterClass:
gencode 4.36.2, runtime 4.35.1. Runtime version cannot be older than the linked
gencode version.
```
and after the first time, `NoClassDefFoundError: Could not initialize class
...`.
### Reproducer
`quarkus-bom` 4.0.0 + `camel-quarkus-bom` 4.0.0-SNAPSHOT (Apache snapshots
repository) imported, and these dependencies:
```xml
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-protobuf-serde-kafka</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit</artifactId>
<scope>test</scope>
</dependency>
```
```java
@QuarkusTest
class ApicurioProtobufSerdeTest {
@Test
void protobufSerdeClassesInitialize() throws Exception {
System.out.println("protobuf-java runtime: " + RuntimeVersion.MAJOR
+ "." + RuntimeVersion.MINOR + "."
+ RuntimeVersion.PATCH);
// generated by protoc 4.36.2 in
apicurio-registry-serde-common-protobuf 3.3.4
Class.forName("io.apicurio.registry.serde.protobuf.ref.RefOuterClass", true,
getClass().getClassLoader());
new ProtobufKafkaSerializer<>();
}
}
```
`mvn test` prints `protobuf-java runtime: 4.35.1` and fails with the
`ProtobufRuntimeVersionException` above. `mvn dependency:tree
-Dincludes=com.google.protobuf`:
```
\- io.apicurio:apicurio-registry-protobuf-serde-kafka:jar:3.3.4:compile
\- io.apicurio:apicurio-registry-serde-common-protobuf:jar:3.3.4:compile
+- io.apicurio:apicurio-registry-schema-util-protobuf:jar:3.3.4:compile
| \- com.google.protobuf:protobuf-java-util:jar:4.35.1:compile
\- com.google.protobuf:protobuf-java:jar:4.35.1:compile
```
With `com.google.protobuf:protobuf-java` and `protobuf-java-util` managed at
4.36.2 in the application, the same test passes. That is the workaround for now.
### What Camel did
[CAMEL-27300](https://issues.apache.org/jira/browse/CAMEL-27300)
(apache/camel#30495, in Camel 4.24.0) had the same failure in Camel itself and
changed the Camel parent:
- `protobuf-version` (the protobuf-java and protobuf-java-util runtime) is
now 4.36.2.
- A new `protoc-version` (4.35.1, unchanged) generates Camel's own protobuf
classes (camel-salesforce Pub/Sub, camel-kserve, camel-tensorflow-serving).
Their gencode stays at or below the protobuf-java that Quarkus manages, so they
still load on Quarkus 4.0.0. A runtime may be newer than the gencode, but not
older.
The Camel Quarkus BOM does not take protobuf-java from Camel, so this does
not reach Camel Quarkus applications. The `camel-main` branch (Camel
4.24.0-SNAPSHOT, Quarkus 4.0.0.CR1) is in the same situation: `quarkus-bom`
4.0.0.CR1 manages 4.35.1 and the branch's BOM does not manage protobuf-java.
Like #9319 (camel-salesforce gencode 4.35.1, Quarkus runtime 4.35.0), the
fix is probably to align protobuf-java in Quarkus to >= 4.36.2. Quarkus derives
`protobuf-java.version` from `protoc.version`, so separating the two the way
Camel did would let the runtime move without changing the gencode of the
Quarkus gRPC classes. Until then, the Apicurio protobuf serde in Camel Quarkus
needs the workaround above.
_Claude Code on behalf of Claus Ibsen_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]