rbaumgar opened a new issue #1915:
URL: https://github.com/apache/camel-k/issues/1915


   try to use application/json payload on Rest POST. tried with Jackson and 
Gson Library.
   
   Camel 3.5.1
   Camel-K 1.2.0
   
   kamel run routes.xml --dev  -d camel-jackson -d camel-gson
   ```
       <route id="add" >
           <from uri="rest:post:add"/> 
           <log message="got request Camel K ${body}"/>
           <to uri="log:fo1?showAll=true"/>
           <!--<to uri="dataformat:json-jackson:unmarshal"/>-->
           <to uri="log:fo2?showAll=true"/>
           <to uri="dataformat:json-gson:unmarshal"/>
           <to uri="log:fo3?showAll=true"/>
           <log message="got request Camel K ${body.get('docName')}"/>
       </route>
   ```
   
   ```
   [2] 2021-01-15 08:49:00,255 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] 
(main) Apache Camel 3.5.1.fuse-jdk11-800007-redhat-00001 (camel-1) started in 
0.096 seconds
   [2] 2021-01-15 08:49:00,620 INFO  [io.quarkus] (main) camel-k-integration 
1.2.0 on JVM (powered by Quarkus 1.7.5.Final-redhat-00007) started in 3.628s. 
Listening on: http://0.0.0.0:8080
   [2] 2021-01-15 08:49:00,621 INFO  [io.quarkus] (main) Profile prod 
activated. 
   [2] 2021-01-15 08:49:00,621 INFO  [io.quarkus] (main) Installed features: 
[camel-bean, camel-core, camel-dataformat, camel-endpointdsl, 
camel-k-loader-xml, camel-k-runtime-core, camel-k-runtime-quarkus, camel-log, 
camel-main, camel-platform-http, camel-rest, camel-support-common, 
camel-xml-io, cdi, mutiny, smallrye-context-propagation, vertx, vertx-web]
   [2] 2021-01-15 08:49:04,333 INFO  [add] (vert.x-eventloop-thread-1) got 
request Camel K {  "docName":"camel-k-document", "docContent":"from Camel K 
secret content" }
   [2] 2021-01-15 08:49:04,340 INFO  [fo1] (vert.x-eventloop-thread-1) 
Exchange[Id: EB212E2B1E69FF2-0000000000000000, ExchangePattern: InOnly, 
Properties: {CamelToEndpoint=log://fo1?showAll=true}, Headers: 
{Accept=text/plain, CamelHttpMethod=POST, CamelHttpPath=/add, 
CamelHttpQuery=null, CamelHttpRawQuery=null, CamelHttpUri=/add, 
CamelHttpUrl=http://routes-camelk.apps.ocp4.openshift.freeddns.org/add, 
Content-Length=77, Content-Type=application/json, 
Forwarded=for=192.168.50.1;host=routes-camelk.apps.ocp4.openshift.freeddns.org;proto=http,
 Host=routes-camelk.apps.ocp4.openshift.freeddns.org, User-Agent=curl/7.61.1, 
X-Forwarded-For=192.168.50.1, 
X-Forwarded-Host=routes-camelk.apps.ocp4.openshift.freeddns.org, 
X-Forwarded-Port=80, X-Forwarded-Proto=http}, BodyType: byte[], Body: {  
"docName":"camel-k-document", "docContent":"from Camel K secret content" }]
   [2] 2021-01-15 08:49:04,342 INFO  [fo2] (vert.x-eventloop-thread-1) 
Exchange[Id: EB212E2B1E69FF2-0000000000000000, ExchangePattern: InOnly, 
Properties: {CamelToEndpoint=log://fo2?showAll=true}, Headers: 
{Accept=text/plain, CamelHttpMethod=POST, CamelHttpPath=/add, 
CamelHttpQuery=null, CamelHttpRawQuery=null, CamelHttpUri=/add, 
CamelHttpUrl=http://routes-camelk.apps.ocp4.openshift.freeddns.org/add, 
Content-Length=77, Content-Type=application/json, 
Forwarded=for=192.168.50.1;host=routes-camelk.apps.ocp4.openshift.freeddns.org;proto=http,
 Host=routes-camelk.apps.ocp4.openshift.freeddns.org, User-Agent=curl/7.61.1, 
X-Forwarded-For=192.168.50.1, 
X-Forwarded-Host=routes-camelk.apps.ocp4.openshift.freeddns.org, 
X-Forwarded-Port=80, X-Forwarded-Proto=http}, BodyType: byte[], Body: {  
"docName":"camel-k-document", "docContent":"from Camel K secret content" }]
   [2] 2021-01-15 08:49:04,350 INFO  [fo3] (vert.x-eventloop-thread-1) 
Exchange[Id: EB212E2B1E69FF2-0000000000000000, ExchangePattern: InOnly, 
Properties: {CamelToEndpoint=log://fo3?showAll=true}, Headers: 
{Accept=text/plain, CamelHttpMethod=POST, CamelHttpPath=/add, 
CamelHttpQuery=null, CamelHttpRawQuery=null, CamelHttpUri=/add, 
CamelHttpUrl=http://routes-camelk.apps.ocp4.openshift.freeddns.org/add, 
Content-Length=77, Content-Type=application/json, 
Forwarded=for=192.168.50.1;host=routes-camelk.apps.ocp4.openshift.freeddns.org;proto=http,
 Host=routes-camelk.apps.ocp4.openshift.freeddns.org, User-Agent=curl/7.61.1, 
X-Forwarded-For=192.168.50.1, 
X-Forwarded-Host=routes-camelk.apps.ocp4.openshift.freeddns.org, 
X-Forwarded-Port=80, X-Forwarded-Proto=http}, BodyType: 
com.google.gson.internal.LinkedTreeMap, Body: {docName=camel-k-document, 
docContent=from Camel K secret content}]
   [2] 2021-01-15 08:49:04,394 INFO  [add] (vert.x-eventloop-thread-1) got 
request Camel K camel-k-document
   [2] 2021-01-15 08:49:04,397 WARN  
[org.apa.cam.imp.eng.DefaultReactiveExecutor] (vert.x-eventloop-thread-1) Error 
executing reactive work due to 
org.apache.camel.NoTypeConversionAvailableException: No type converter 
available to convert from type: com.google.gson.internal.LinkedTreeMap to the 
required type: java.nio.ByteBuffer with value {docName=camel-k-document, 
docContent=from Camel K secret content}. This exception is ignored.: 
java.lang.RuntimeException: 
org.apache.camel.NoTypeConversionAvailableException: No type converter 
available to convert from type: com.google.gson.internal.LinkedTreeMap to the 
required type: java.nio.ByteBuffer with value {docName=camel-k-document, 
docContent=from Camel K secret content}
   ```


----------------------------------------------------------------
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.

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


Reply via email to