Claus Ibsen created CAMEL-27188:
-----------------------------------

             Summary: camel-google-vertexai - resolves protobuf-java 3.25.5, 
endpoint fails to start
                 Key: CAMEL-27188
                 URL: https://issues.apache.org/jira/browse/CAMEL-27188
             Project: Camel
          Issue Type: Bug
          Components: camel-google
            Reporter: Claus Ibsen


h3. What happens

With Camel JBang 4.24.0-SNAPSHOT, any {{google-vertexai}} endpoint fails at 
start:

{noformat}
java.lang.NoClassDefFoundError: com/google/protobuf/RuntimeVersion$RuntimeDomain
        at 
com.google.cloud.aiplatform.v1.PredictRequest.<clinit>(PredictRequest.java:41)
        at 
com.google.cloud.aiplatform.v1.stub.GrpcPredictionServiceStub.<clinit>(GrpcPredictionServiceStub.java:83)
        at 
com.google.cloud.aiplatform.v1.stub.PredictionServiceStubSettings.createStub(PredictionServiceStubSettings.java:343)
        at 
com.google.cloud.aiplatform.v1.PredictionServiceClient.<init>(PredictionServiceClient.java:434)
        at 
com.google.cloud.aiplatform.v1.PredictionServiceClient.create(PredictionServiceClient.java:416)
        at 
org.apache.camel.component.google.vertexai.PredictionServiceClientFactory.create(PredictionServiceClientFactory.java:91)
        at 
org.apache.camel.component.google.vertexai.GoogleVertexAIEndpoint.doStart(GoogleVertexAIEndpoint.java:145)
        ...
Caused by: java.lang.ClassNotFoundException: 
com.google.protobuf.RuntimeVersion$RuntimeDomain
{noformat}

The {{protobuf-java}} on the classpath is *3.25.5*: with 
{{--dep=camel:google-vertexai}}, {{com.google.protobuf.Message}} is loaded from 
{{protobuf-java-3.25.5.jar}}, while 
{{proto-google-cloud-aiplatform-v1-3.103.0.jar}} needs protobuf 4.x. Adding 
{{--dep=com.google.protobuf:protobuf-java:4.35.1}} makes the component work. 
The Kamelet {{google-vertexai-sink}} does not start in Camel JBang because of 
this.

h3. How to reproduce

{code}
camel run route.yaml
{code}
with
{code}
- route:
    from:
      uri: timer:t?repeatCount=1
      steps:
        - setBody:
            constant: "What is the capital of France?"
        - to:
            uri: 
google-vertexai:my-project:us-central1:gemini-2.5-flash?serviceAccountKey=file:sa.json
{code}

h3. Where

* {{parent/pom.xml}} manages {{protobuf-java}} to {{$\{protobuf-version\}}} = 
4.35.1, so the Camel build and its tests get 4.35.1.
* {{components/camel-google/camel-google-vertexai/pom.xml}} depends on 
{{com.google.genai:google-genai}} 2.0.0 (declared first) and 
{{com.google.cloud:google-cloud-aiplatform}} 3.103.0. 
{{google-genai-2.0.0.pom}} has a direct dependency on {{protobuf-java}} 
{{3.25.5}} (its {{protobuf.version}} property), at depth 2, while aiplatform 
reaches protobuf-java only through {{proto-google-cloud-aiplatform-v1}} (depth 
3). When the parent's dependency management is not applied to the transitive 
graph (Camel JBang; likely also an application that does not manage 
protobuf-java itself), nearest-wins picks 3.25.5.

This is the same class of problem as CAMEL-23729 (secret-manager), seen from 
the other side.

h3. Suggested fix

Make the right version explicit in {{camel-google-vertexai/pom.xml}}, as the 
pom already does for {{google-auth-library-*}}: either add a direct 
{{com.google.protobuf:protobuf-java}} dependency (version from the parent) or 
exclude {{protobuf-java}} from {{google-genai}}, so that the published pom 
resolves protobuf 4.x for any consumer. Check the result with {{camel run 
--dep=camel:google-vertexai}} (or {{camel dependency list}}).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to