Claus Ibsen created CAMEL-24822:
-----------------------------------

             Summary: camel run: rest-openapi producer fails with a null Vert.x 
unless componentName=http is set
                 Key: CAMEL-24822
                 URL: https://issues.apache.org/jira/browse/CAMEL-24822
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang, camel-rest-openapi
            Reporter: Claus Ibsen


Found while writing the openapi-client example for CAMEL-24808.

A YAML route with

{code}
- to:
    uri: rest-openapi
    parameters:
      specificationUri: stock-api.json
      operationId: reserveStock
      host: http://localhost:8080
{code}

run with *camel run* fails at startup with:

{noformat}
Failed to start route ... because: java.lang.NullPointerException: Cannot 
invoke 
"io.vertx.core.Vertx.createHttpClient(io.vertx.core.http.HttpClientOptions)" 
because "vertx" is null
{noformat}

The component defaults to the vertx-http client, but camel-jbang's dependency 
detection adds camel-rest-openapi only, not camel-vertx-http, so the default 
client has no Vert.x. Setting *componentName: http* works because camel-http is 
then detected from the option value.

Proposal: when rest-openapi is used as a producer, add the default HTTP 
client's component to the dependencies (or default to camel-http under camel 
run), and make the error say which component to configure instead of an NPE.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to