You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/07/13 22:25:53 UTC

[GitHub] [camel-quarkus] dhanendras opened a new issue #1475: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.util.HashMap to the required type: java.nio.ByteBuffer with value {name=e}

dhanendras opened a new issue #1475:
URL: https://github.com/apache/camel-quarkus/issues/1475


   java.lang.RuntimeException: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.util.HashMap to the required type: java.nio.ByteBuffer with value {name=e}
   
   I am trying to upload form data from postman and below is my Quarkus-camel code
   
     rest() .description("Upload Multiple Report via camel and netty")
   		  .post("/submitodc")
   		  .bindingMode(RestBindingMode.off)
   		  .consumes(MediaType.MULTIPART_FORM_DATA)
   		  .to("direct:uploadReportProcessor");
   		  
   		  from("direct:uploadReportProcessor")
   		  .routeId("uploadProcessorRouteId") .process(OdcFileProcessor);
   		 
   
   Please let me know what am I missing over here.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger closed issue #1475: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.util.HashMap to the required type: java.nio.ByteBuffer with value {name=e}

Posted by GitBox <gi...@apache.org>.
aldettinger closed issue #1475:
URL: https://github.com/apache/camel-quarkus/issues/1475


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli commented on issue #1475: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.util.HashMap to the required type: java.nio.ByteBuffer with value {name=e}

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1475:
URL: https://github.com/apache/camel-quarkus/issues/1475#issuecomment-658314065


   you probably need to convert the result of your processor to the required type if you want to reply back with some data.
   
   I doubt this is a camel-quarkus issue but in any case, a reproducer would help


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on issue #1475: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.util.HashMap to the required type: java.nio.ByteBuffer with value {name=e}

Posted by GitBox <gi...@apache.org>.
aldettinger commented on issue #1475:
URL: https://github.com/apache/camel-quarkus/issues/1475#issuecomment-686318277


   @dhanendras The post above may explain how to deal with such cases.
   I'm going to close this ticket now but one is very welcome to reopen it if necessary.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on issue #1475: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.util.HashMap to the required type: java.nio.ByteBuffer with value {name=e}

Posted by GitBox <gi...@apache.org>.
aldettinger commented on issue #1475:
URL: https://github.com/apache/camel-quarkus/issues/1475#issuecomment-672971860


   Hi @dhanendras, and thanks for sharing you experience with camel-quarkus. I agree with Luca's view on this ticket.
   I played a bit with a route like:
   ```
   rest().post("/submitodc").consumes(MediaType.MULTIPART_FORM_DATA).to("direct:uploadReportProcessor");
   from("direct:uploadReportProcessor").process(e -> e.getMessage().setBody(Map.of("name", "e")));
   ```
   And indeed, we hit an issue as there are no pre-registered [converters](https://camel.apache.org/manual/latest/type-converter.html) to translate a `Map` to a `ByteBuffer`.
   
   In such situation, one may end up using [camel-quarkus-gson](https://camel.apache.org/camel-quarkus/latest/extensions/gson.html) as below:
   ```
   process(...).marshal().json(JsonLibrary.Gson);
   ```
   
   Or maybe a [custom converter](https://camel.apache.org/manual/latest/type-converter.html#TypeConverter-Addtypeconverterclassesatruntime) similar to this:
   ```
   public void configure() {
     getContext().getTypeConverterRegistry().addTypeConverters(new MyCustomConverters());
     ...
   }
   
   @Converter
   public static class MyCustomConverters implements TypeConverters {
     @Converter
     public ByteBuffer toByteBuffer(HashMap<?, ?> map) {
       return ByteBuffer.wrap(...);
     }
   }
   ```
   Does it make sense for you ?


----------------------------------------------------------------
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:
users@infra.apache.org