Hi

We have fixed something about loading from within fatjar's of spring boot,
but that is very likely in newer Camel releases.
yaml-dsl is also evolving over that period so using an old 3.9 version with
yaml is not recommended.

I suggest to use Java DSL if you must use that old version. Also note that
Camel 3.14.x supports Java 8, so you could maybe try that release.
I am however not sure if Camel 3.14.x runs on SB 2.1.x


On Fri, Feb 10, 2023 at 4:22 PM Harnish Patel <hpa...@workfusion.com> wrote:

> Yes, they are old, but currently we are restricted to Spring Boot
> 2.1.18.RELEASE (and Java 8) due to the internal platform version. We plan
> to upgrade Spring Boot later this year, but for now we have to go with this
> version.
>
> -----Original Message-----
> From: Claus Ibsen <claus.ib...@gmail.com>
> Sent: Friday, February 10, 2023 1:54 AM
> To: users@camel.apache.org
> Subject: Re: Camel Spring Boot unable to load routes from a jar file
>
> EXTERNAL MESSAGE
>
> ________________________________
> ________________________________
>
> Hi
>
> Are you sure about the versions as they are very old.
>
> On Fri, Feb 10, 2023 at 3:21 AM Harnish Patel <hpa...@workfusion.com>
> wrote:
>
> > Hey everyone,
> >
> > I have a spring boot app. in which I my routes defined in .yaml files
> > under /resources/camel/ folder.
> > Spring boot version: 2.1.18.RELEASE
> > Camel version: 3.9.0
> >
> > I have the specified following spring boot property in bootstrap.yml:
> > camel:
> >   springboot:
> >     routes-include-pattern: classpath:camel/*.yaml
> >
> > This works fine and the routes get loaded successfully when I run this
> > locally. Log output:
> > 2023-02-09 17:28:42.796 DEBUG 34104 --- [           main]
> > o.a.c.s.boot.SpringBootRoutesCollector   : Loading additional
> RoutesBuilder
> > from: classpath:camel/*.yaml
> > 2023-02-09 17:28:42.797 TRACE 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : Getting resource URL for
> > package: camel/ with classloader:
> > jdk.internal.loader.ClassLoaders$AppClassLoader@4d7e1886
> > 2023-02-09 17:28:42.797 TRACE 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : URL from classloader:
> > file:/C:/source/connectors-core/target/classes/camel/
> > 2023-02-09 17:28:42.797 TRACE 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : Decoded urlPath:
> > /C:/source/connectors-core/target/classes/camel/ with protocol: file
> > 2023-02-09 17:28:42.797 TRACE 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : Scanning for resources in:
> > /C:/source/connectors-core/target/classes/camel/ matching pattern: *.yaml
> > 2023-02-09 17:28:42.797 TRACE 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : Loading from directory
> > using
> > file: C:\source\connectors-core\target\classes\camel
> > 2023-02-09 17:28:42.798 DEBUG 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : Found resource: route1.yaml
> > matching pattern: *.yaml -> true
> > 2023-02-09 17:28:42.801 TRACE 34104 --- [           main]
> > .e.DefaultResourceResolvers$FileResolver : Creating resource:
> > C:\source\connectors-core\target\classes\camel\route1.yaml from file
> system
> > 2023-02-09 17:28:42.801 DEBUG 34104 --- [           main]
> > c.i.e.DefaultPackageScanResourceResolver : Found resource: route2.yaml
> > matching pattern: *.yaml -> true
> > 2023-02-09 17:28:42.801 TRACE 34104 --- [           main]
> > .e.DefaultResourceResolvers$FileResolver : Creating resource:
> > C:\source\connectors-core\target\classes\camel\route2.yaml from file
> > system
> >
> > But, it doesn't load these routes when deploying the app. as a jar file.
> > Log output:
> > Loading additional RoutesBuilder from: classpath:camel/*.yaml
> > 16:46:52.490
> > Getting resource URL for package: camel/ with classloader:
> > org.springframework.boot.loader.LaunchedURLClassLoader@254989ff
> > 16:46:52.490
> > URL from classloader:
> > jar:file:/opt/wf/vds-data/workers/app/c.w.c/connectors-core/1.0.0/work
> > er.jar!/BOOT-INF/classes!/camel/
> > 16:46:52.491
> > Decoded urlPath:
> > file:/opt/wf/vds-data/workers/app/c.w.c/connectors-core/1.0.0/worker.j
> > ar!/BOOT-INF/classes!/camel/
> > with protocol: jar
> > 16:46:52.491
> > Scanning for resources in:
> > /opt/wf/vds-data/workers/app/c.w.c/connectors-core/1.0.0/worker.jar
> > matching pattern: *.yaml
> > 16:46:52.491
> > Loading from jar using file:
> > /opt/wf/vds-data/workers/app/c.w.c/connectors-core/1.0.0/worker.jar
> > 16:46:53.094
> > No additional RoutesBuilder discovered from: classpath:camel/*.yaml
> >
> > If I specify the spring boot property to be a single file
> > (route1.yaml), then the route is loaded fine. But specifying it as
> "*.yaml" doesn't work.
> >
> > Appreciate any pointers on how to resolve this issue.
> >
> > Thanks,
> > Harnish Patel
> >
> >
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to