0
我只想學習自定義轉換器並遇到問題。任何幫助深表感謝。駱駝版本2.17和JBoss保險絲6.3問題與駱駝定製@Converter使用春季DSL
@Converter
public class MyConvertor{
public MyConvertor(){}
@Converter
public static String convertTo(Exchange exchange) {}
}
在我的春天DSL
<convertBodyTo charset="UTF-8" id="_convertBodyTo1" type="com.x.convertor.MyConvertor"/>
在META-INF /服務/組織/阿帕奇/駱駝/ TypeConverter的
com.x.convertor.MyConvertor
錯誤消息:
org.apache.camel.InvalidPayloadException: No body available of type: com.x.convertor.MyConvertor but has value: GenericFile[output.txt] of type: org.apache.camel.component.file.GenericFile on: output.txt. Caused by: No type converter available to convert from type:
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: com.x.convertor.MyConvertor
沒有運氣。更新如下。你能幫 轉換 公共類MyConvertor { \t轉換 \t公衆的JSONObject的ConvertTo(GenericFile文件)拋出JSONException,IOException異常{ \t \t回報的JSONObject; \t} } –