[
https://issues.apache.org/jira/browse/CAMEL-27237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27237 started by Federico Mariani.
------------------------------------------------
> camel-jbang - export to camel-main turns on the health check without adding
> camel-health, so an exported platform-http application does not start
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27237
> URL: https://issues.apache.org/jira/browse/CAMEL-27237
> Project: Camel
> Issue Type: Bug
> Components: camel-jbang
> Affects Versions: 4.23.0
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
>
> {{camel export --runtime=camel-main}} of a route that uses platform-http (or
> rest) turns on the embedded HTTP server and its health check in the exported
> {{application.properties}}:
> {noformat}
> camel.server.enabled=true
> camel.management.enabled=true
> camel.management.health-check-enabled=true
> {noformat}
> but the exported {{pom.xml}} does not get {{camel-health}}, so the exported
> application does not start:
> {noformat}
> java.lang.IllegalArgumentException: Camel health-check is not available. Add
> camel-health or camel-observability-services JAR
> {noformat}
> {{camel run}} does not show it, because the Camel CLI has {{camel-health}} on
> its classpath.
> h3. Reproducer
> With the Camel CLI 4.23.0 and any platform-http route, for example:
> {noformat}
> - route:
> id: echo
> from:
> uri: platform-http
> parameters:
> path: /echo
> steps:
> - setBody:
> expression:
> simple:
> expression: "type=${body?.getClass().getName()} body=${body}"
> {noformat}
> {noformat}
> camel export form.camel.yaml --runtime=camel-main
> --gav=org.example:form-main:1.0 --dir=app
> cd app
> mvn package -DskipTests
> java -jar target/form-main-1.0.jar
> {noformat}
> The pom has camel-main, camel-platform-http-main and camel-yaml-dsl, no
> camel-health, and the startup fails with the exception above.
> h3. Cause
> In {{CamelMainExporter}} (the same on main):
> * the dependencies are resolved first ({{resolveDependencies(settings,
> profile)}}), from the {{application.properties}} given to the export;
> * the health-check properties are added later, when the exporter writes
> {{application.properties}} (the embedded HTTP server block, for Camel 4.14
> and later);
> * the rule in {{doResolveDependencies}} that adds {{camel:health}} looks for
> {{camel.management.healthCheckEnabled}}, while the exporter writes
> {{camel.management.health-check-enabled}}.
> So {{camel-health}} is only added when the {{application.properties}} given
> to the export already has the camelCase key.
> h3. Possible fix
> Add {{camel-health}} when the exporter turns the health check on, and
> recognize both spellings of the key.
> _Claude Code on behalf of Croway_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)