SatyamPandey-07 opened a new issue, #9193:
URL: https://github.com/apache/camel-quarkus/issues/9193

   ### Bug description
   
   
   
   ## Description
   When configuring a Camel REST DSL route with JSON binding mode 
(`bindingMode(RestBindingMode.json)`), if an error occurs during response 
marshalling (such as attempting to serialize a POJO containing Java 8 
`java.time.LocalDateTime` fields without explicit configuration or encountering 
serialization errors), the exception is silently swallowed. Instead of 
propagating the exception to the Camel error handler or returning an HTTP 500 
Internal Server Error status code to the client, Camel Quarkus returns an HTTP 
200 OK with `Content-Type: text/plain` and an empty (0-byte) response body.
   
   ## Steps to Reproduce
   1. Configure a Camel REST DSL endpoint with JSON binding mode:
      ```java
      rest("/items")
          .get("/details")
          .bindingMode(RestBindingMode.json)
          .to("direct:getDetails");
   
   
   In direct:getDetails, return a POJO containing an unconfigured date/time 
type:
   java
   from("direct:getDetails")
       .process(exchange -> {
           exchange.getMessage().setBody(new ItemDetails("Item 1", 
LocalDateTime.now()));
       });
   
   
   Send an HTTP GET request to /items/details:
   bash
   curl -i http://localhost:8080/items/details
   Observe that the HTTP response code is 200 OK while the response body is 
empty.
   
   ## Expected Behavior
   Response marshalling failures must not be swallowed. The underlying 
InvalidDefinitionException or serialization error should be logged, propagated 
to the Camel error handler, and returned to the caller with an HTTP 500 status 
code. Additionally, autoDiscoverObjectMapper should default to true in Camel 
Quarkus so that the pre-configured Quarkus CDI ObjectMapper (with 
JavaTimeModule support) is utilized automatically.
   
   ## Actual Behavior / Error Logs
   text'''
   HTTP/1.1 200 OK
   Content-Type: text/plain
   Content-Length: 0
   Date: Fri, 18 Sep 2026 12:00:00 GMT
   [Empty body - No payload returned and no exception reported in HTTP status 
or error handler]
   
   Underlying swallowed exception in the runtime log:
   
   text'''
   com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 
date/time type `java.time.LocalDateTime` not supported by default: add Module 
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling
    at [Source: UNKNOWN; byte offset: #UNKNOWN]
       at 
com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
       at 
com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1330)
       at 
com.fasterxml.jackson.databind.ser.impl.UnsupportedTypeSerializer.serialize(UnsupportedTypeSerializer.java:35)
   
   ## Proposed Fix
   Default autoDiscoverObjectMapper to true on the REST DSL Jackson data format 
in camel-quarkus-jackson so that the application's Quarkus-configured 
ObjectMapper is automatically discovered and used.
   
   Ensure unhandled exceptions occurring in the outbound REST binding pipeline 
set Exchange.EXCEPTION_CAUGHT and propagate to the exchange failure path to 
produce an HTTP 500 error response.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to