Marco Carletti created CAMEL-23729:
--------------------------------------
Summary: camel-google-secret-manager: NoClassDefFoundError due to
protobuf 3.x/4.x version mismatch
Key: CAMEL-23729
URL: https://issues.apache.org/jira/browse/CAMEL-23729
Project: Camel
Issue Type: Bug
Affects Versions: 4.18.2
Reporter: Marco Carletti
{{camel-google-secret-manager}} fails at runtime with {{NoClassDefFoundError:
com/google/protobuf/RuntimeVersion$RuntimeDomain}} because
{{google-cloud-secretmanager:2.84.0}} transitively requires protobuf 4.x, while
the Camel BOM pins
{{protobuf-java}} to 3.25.5.
*Root Cause*
{{google-cloud-secretmanager:2.84.0}} pulls
{{{}proto-google-cloud-secretmanager-v1:2.84.0{}}}, whose generated stubs were
compiled against protobuf 4.33.2. The class
{{com.google.protobuf.RuntimeVersion$RuntimeDomain}} was introduced in
protobuf 4.27.0 and is referenced from {{{}ListSecretsRequest.<clinit>{}}}.
The Camel parent BOM ({{{}parent/pom.xml{}}}) manages {{protobuf-java}} to
3.25.5, which does not contain that class. Maven silently downgrades protobuf
at build time:
{code:java}
com.google.protobuf:protobuf-java:jar:3.25.5:compile (version managed from
4.33.2)
{code}
At runtime, the static initializer of {{ListSecretsRequest}} fails with
{{{}NoClassDefFoundError{}}}.
*Affected Scope*
Only {{camel-google-secret-manager}} is affected. Other Google Cloud components
(BigQuery, PubSub, Sheets) use proto libraries still compatible with protobuf
3.x:
--
This message was sent by Atlassian Jira
(v8.20.10#820010)