Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOLVED]Cant specify fastjson when marshal #3212

Closed
senayuki opened this issue Apr 15, 2022 · 5 comments
Closed

[SOLVED]Cant specify fastjson when marshal #3212

senayuki opened this issue Apr 15, 2022 · 5 comments

Comments

@senayuki
Copy link

senayuki commented Apr 15, 2022

I trying to use fastjson instance of jackson, with camel-k 1.8.1, so I wrote this yaml

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: jackson-test
  namespace: camel
spec:
  dependencies:
  - mvn:mysql:mysql-connector-java:8.0.28
  - mvn:org.apache.commons:commons-dbcp2:2.8.0
  - mvn:com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2
  flows:
  - from:
      steps:
      - to:
          uri: freemarker:sql.ftl?contentCache=false
      - to:
          uri: (hidden bean)
      - marshal:
        json: 
           library: fastjson
      uri: rest:get:/

And I got this error in container
java.lang.IllegalArgumentException: Unexpected type: class org.apache.camel.model.dataformat.JsonDataFormat

I'm very confused. Why doesn't the "library" usage I found in the unit test of the source code work.
In addition, I think the yaml file of camel-k also puzzles me when I refer to the java example of camel. I don't know how to convert them accurately.

@oscerd
Copy link
Contributor

oscerd commented Apr 15, 2022

It should be:

      - marshal:
          json:
            library: Fastjson

your indentation seems to be wrong

@oscerd
Copy link
Contributor

oscerd commented Apr 15, 2022

It's a different way of writing routes through YAML, so there no automatic conversion, for the moment, from plain camel or Java DSL, to YAML.

@oscerd
Copy link
Contributor

oscerd commented Apr 15, 2022

Also Jackson is a thing, Fastjson is another thing.

@senayuki
Copy link
Author

Also Jackson is a thing, Fastjson is another thing.

Ow ow ow ow, I did make an indentation mistake. I was stupid! Thanks for your help!
The Jackson dependency is that I forgot to remove it when I was testing at the beginning, which is not a problem

@senayuki senayuki changed the title Cant specify fastjson when marshal [SOLVED]Cant specify fastjson when marshal Apr 15, 2022
@oscerd
Copy link
Contributor

oscerd commented Apr 15, 2022

My suggestion is to use jitpack while developing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants