You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Thomas Diesler (Jira)" <ji...@apache.org> on 2025/02/19 07:59:00 UTC

[jira] [Comment Edited] (CAMEL-21730) JBang export cannot validate route that depends on copied resources

    [ https://issues.apache.org/jira/browse/CAMEL-21730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17928323#comment-17928323 ] 

Thomas Diesler edited comment on CAMEL-21730 at 2/19/25 7:58 AM:
-----------------------------------------------------------------

I moved the webapp resources and route definition to a [common directory|https://github.com/tdiesler/camel-cloud-examples/tree/main/camel-main/platform-http-oauth/platform-http-files] and simplified the export cmd [like this|https://github.com/tdiesler/camel-cloud-examples/blob/main/camel-main/platform-http-oauth/Makefile#L20] ...

{code}
k8s-export:
	@$(CAMEL_CMD) kubernetes export platform-http-files/* \
	--dep=org.apache.camel.cloud:camel-oauth:0.1.0-SNAPSHOT \
	--gav=examples:platform-http-oauth:1.0.0 \
	--property=camel.oauth.baseUri=https://keycloak.local:30443/realms/camel \
	--property=camel.oauth.redirectUri=http://127.0.0.1:8080/auth \
	--property=camel.oauth.logout.redirectUri=http://127.0.0.1:8080/ \
	--property=camel.oauth.clientId=camel-client \
	--property=camel.oauth.clientSecret=camel-client-secret \
	--trait container.image-pull-policy=IfNotPresent \
	--ignore-loading-error=true \
	--image-builder=docker \
	--image-push=false \
	--runtime=camel-main
{code}

References to these resources in the route do not change, and the error from above still shows when --ignore-loading-error=false

Hence, the provided patch is still needed and I'd suggest to backport that to the LTS branches.


was (Author: tdiesler):
I moved the webapp resources and route definition to a [common directory|https://github.com/tdiesler/camel-cloud-examples/tree/main/camel-main/platform-http-oauth/platform-http-files] and simplified the export cmd [like this|https://github.com/tdiesler/camel-cloud-examples/blob/main/camel-main/platform-http-oauth/Makefile#L20] ...

{code}
k8s-export:
	@$(CAMEL_CMD) kubernetes export platform-http-files/* \
	--dep=org.apache.camel.cloud:camel-oauth:0.1.0-SNAPSHOT \
	--gav=examples:platform-http-oauth:1.0.0 \
	--property=camel.oauth.baseUri=https://keycloak.local:30443/realms/camel \
	--property=camel.oauth.redirectUri=http://127.0.0.1:8080/auth \
	--property=camel.oauth.logout.redirectUri=http://127.0.0.1:8080/ \
	--property=camel.oauth.clientId=camel-client \
	--property=camel.oauth.clientSecret=camel-client-secret \
	--trait container.image-pull-policy=IfNotPresent \
	--ignore-loading-error=true \
	--image-builder=docker \
	--image-push=false \
	--runtime=camel-main
{code}

References to these resources in the route do not change, and the error from above still shows when --ignore-loading-error=false

The provided patch is hence still needed and I'd suggest to backport that to the LTS branches.

> JBang export cannot validate route that depends on copied resources
> -------------------------------------------------------------------
>
>                 Key: CAMEL-21730
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21730
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Thomas Diesler
>            Assignee: Thomas Diesler
>            Priority: Minor
>             Fix For: 4.11.0
>
>
> With a route like this ...
> {code}
> - route:
>     from:
>       uri: "platform-http:/"
>       steps:
>         - setBody:
>             simple: "resource:classpath:META-INF/resources/index.html"
> {code}
> on export I get ...
> {code}
> org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> SetBody[simple{resource:classpath:META-INF/resources/index.html}] <<< in route: Route(route1)[From[platform-http:/] -> [SetBody[simple{resou... because of Illegal syntax: resource:classpath:META-INF/resources/index.html
> 	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:235)
> 	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:86)
> 	at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:736)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:597)
> 	at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2457)
> 	at org.apache.camel.support.service.BaseService.init(BaseService.java:85)
> 	at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2087)
> 	at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
> 	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2106)
> 	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:211)
> 	at org.apache.camel.main.KameletMain.doStart(KameletMain.java:384)
> 	at org.apache.camel.support.service.BaseService.start(BaseService.java:123)
> 	at org.apache.camel.dsl.jbang.core.commands.Run.runKameletMain(Run.java:1447)
> 	at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:908)
> 	at org.apache.camel.dsl.jbang.core.commands.Run.runExport(Run.java:352)
> 	at org.apache.camel.dsl.jbang.core.commands.ExportBaseCommand.runSilently(ExportBaseCommand.java:344)
> 	at org.apache.camel.dsl.jbang.core.commands.ExportCamelMain.export(ExportCamelMain.java:66)
> {code}
> The issue seems to be that export is calling KameletMain.doStart() by which the referenced resources have not been copied.



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