turing85 opened a new issue, #4860:
URL: https://github.com/apache/camel-quarkus/issues/4860

   # Bug description
   Using `simple("${exchange.getMessage().getBody()}"` throws an exception at 
runtime when compiling natively:
   
   ```
   Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method 
with name: getMessage() not found on bean: 
Exchange[ED6D02F79FBB419-0000000000000000] of type: 
org.apache.camel.support.DefaultExchange on the exchange: 
Exchange[ED6D02F79FBB419-0000000000000000]
   ...
   ```
   
   # Affected versions:
   Quarkus,  at least from `2.13.x.Final` up to the current version 
(`3.0.1.Final`). 
   
   # Reproducer:
   - clone [this repository 
(`github.com`)](https://github.com/turing85/camel-simple-language-bug):
       ```bash
       git clone https://github.com/turing85/camel-simple-language-bug.git
       cd camel-simple-language-bug
       ```
   - Build the application:
       ```bash
       ./mvnw clean verify
       ```
   - Observe that the tests pass:
       ```bash
       ...
       [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
       ...
       ```
   - Build the application natively:
       ```bash
       ./mvn --define native clean verify
       ```
   - Observe that the tests fail with the above mentioned error in the 
application log, and an unexpected status code on the tests, reporting a status 
of `500` instead of the expected `200`:
       ```bash
       ...
       Caused by: org.apache.camel.component.bean.MethodNotFoundException: 
Method with name: getMessage() not found on bean: 
Exchange[FD7D7D11C0B4B98-0000000000000000] of type: 
org.apache.camel.support.DefaultExchange on the exchange: 
Exchange[FD7D7D11C0B4B98-0000000000000000]
       ...
       Expected status code <200> but was <500>.
       ...
       ```
   
   # Workaround
   Add the following to `application.yml`
   
   ```yaml
   quarkus:
     camel:
       native:
         reflection:
           include-patterns:
             - org.apache.camel.support.AbstractExchange
             - org.apache.camel.support.MessageSupport
   ```
   
   # Possible solution
   The corresponding extension should register those classes for reflection by 
default. This, however, begs the question: what else should be registered. 
Thus, we should analyze all relevant classes used by the `simple(...)` language 
and ensure that they all work as expected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to