Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Cannot use unspecified exception in load-balance failover strategy #503

Open
apupier opened this issue Mar 28, 2023 · 1 comment
Open

Cannot use unspecified exception in load-balance failover strategy #503

apupier opened this issue Mar 28, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@apupier
Copy link
Member

apupier commented Mar 28, 2023

Describe the Bug

when leaving the field blank (which is even the default), the yaml contains exception : '' which is nto working, it is causing this error at runtime:

org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> LoadBalanceType[FailoverLoadBalancer, [Choice[[When[simple{true} -> [Log[through choic]]]]], Log[at the bottom]]] <<< in route: Route(route1)[From[timer:demo] -> [SetProperty[aProp, simple... because of Cannot find class:  in the classpath
        at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:215)
        at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:75)
        at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:937)
        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:800)
        at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:3008)
        at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
        at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2679)
        at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
        at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2698)
        at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:262)
        at org.apache.camel.main.KameletMain.doStart(KameletMain.java:274)
        at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
        at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:560)
        at org.apache.camel.dsl.jbang.core.commands.Run.call(Run.java:208)
        at org.apache.camel.dsl.jbang.core.commands.Run.call(Run.java:75)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:129)
        at main.CamelJBang.main(CamelJBang.java:36)
Caused by: java.lang.IllegalArgumentException: Cannot find class:  in the classpath
        at org.apache.camel.reifier.loadbalancer.FailoverLoadBalancerReifier.createLoadBalancer(FailoverLoadBalancerReifier.java:46)
        at org.apache.camel.reifier.LoadBalanceReifier.createProcessor(LoadBalanceReifier.java:36)
        at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:857)
        at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:598)
        at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:211)

as mentioned in the description of the Exception field: if no exceptions are configured then all exceptions are monitored. But it is not possible to do it from UI.

The workaround is to modify the source code, reload and do not modify the load balance configuration again.

Step Extension involved in the bug

load-balance

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. add a step
  2. add a load-balance
  3. choose Fail-over strategy
  4. Click apply
  5. --> it generates:
- from:
    uri: timer:demo
    steps:
    - load-balance:
        failover:
          id: ''
          exception: ''
          sticky: true
          maximumFailover-Attempts: '-1'
        steps: []

Although there should be no value at all for exception, not an empty string.

Screenshots or Videos

No response

Platform

OperateFirst

@apupier apupier added the bug Something isn't working label Mar 28, 2023
@Delawen
Copy link
Member

Delawen commented Mar 28, 2023

Fix the step extension to avoid adding empty values as empty strings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants