Claus Ibsen created CAMEL-27164:
-----------------------------------

             Summary: camel-core - with camel-jackson and camel-jackson3 on the 
classpath, an option on the jackson data format fails with a ClassCastException
                 Key: CAMEL-27164
                 URL: https://issues.apache.org/jira/browse/CAMEL-27164
             Project: Camel
          Issue Type: Bug
          Components: camel-core, camel-jackson
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


Since CAMEL-22857 (Jackson 3 is the primary Jackson line), when both 
camel-jackson and camel-jackson3 are on the classpath, 
DefaultDataFormatResolver deliberately creates the Jackson 3 data format for 
the name {{jackson}}. The property configurer, though, is still looked up by 
the name {{jackson-dataformat}}, which both jars register, so the configurer of 
the jar found first on the classpath is used. When that is the Jackson 2 one, 
binding any option fails, for example:

{noformat}
Error binding property (unmarshalType=com.fasterxml.jackson.databind.JsonNode) 
with name: unmarshalType on bean: 
org.apache.camel.component.jackson3.JacksonDataFormat@... : class 
org.apache.camel.component.jackson3.JacksonDataFormat cannot be cast to class 
org.apache.camel.component.jackson.JacksonDataFormat
{noformat}

The same happens for {{protobufJackson}} and {{avroJackson}} 
(camel-jackson3-protobuf, camel-jackson3-avro).

Camel JBang 4.24.0-SNAPSHOT has camel-jackson3 on its classpath, so every route 
that adds camel-jackson and sets an option on the json data format fails to 
start, including the 70 Kamelets of the catalog that declare camel:jackson 
(json-deserialize-action, the field actions, the avro and protobuf actions). 
Found by the camel-kamelets integration tests against 4.24.0-SNAPSHOT 
(apache/camel-kamelets#3186).

The lookup by name is in DataFormatReifier.configureDataFormat and 
RestBindingAdviceFactory. The fix: use the configurer that belongs to the class 
of the data format that was created.

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to