Claus Ibsen created CAMEL-25831:
-----------------------------------

             Summary: camel-core - dev mode: after the Java source of a bean is 
deleted, every reload fails with FileNotFoundException
                 Key: CAMEL-25831
                 URL: https://issues.apache.org/jira/browse/CAMEL-25831
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.24.0


In dev mode ({{camel run --dev}}, or {{camel.main.routesReloadEnabled}}), a 
reload whose files include a Java source also loads the files that declare 
beans again, so their beans are created again ({{RouteWatcherReloadStrategy}}, 
the bean resources from the model). The file of a bean that was deleted stays 
among them. So once the Java source of a bean is deleted, the next reload fails:
{noformat}
Error reloading routes from file: ... due to: java.io.FileNotFoundException: 
src/main/java/camel/example/Greeter.java does not exist
        at 
org.apache.camel.support.RouteWatcherReloadStrategy.onRouteReload(RouteWatcherReloadStrategy.java:600)
{noformat}
The strategy restores the routes that ran, and takes the files of the failed 
reload into the next one, so every later reload fails as well, also the reload 
of a changed YAML route. The app keeps the routes it had.

Reproduced with {{camel run --source-dir=. --dev}}: a YAML route calls the 
class {{camel.example.Greeter}} with {{$\{bean:...\}}}, from 
{{src/main/java/camel/example/Greeter.java}}. Delete that file and write the 
class as {{Greeter.java}} in the project folder: the reload fails, and a change 
of the route does not reload either.

Found in a benchmark of Oct 18-19 2026: the harness moved {{Order.java}} like 
that between two steps, and the next change of the model failed to reload.

The strategy skips the file of a route that is gone ({{isDeletedFile}}), but 
not the files of the beans, nor the files in {{RouteWatcherReloadResources}} 
from the registry.

_Claude Code on behalf of davsclaus_



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

Reply via email to