3

我正在尝试使用一个下载记录器,它应该记录两个端点之间的任何类型的文件传输,如下面在 camel-context.xml 中定义的那样

        <process ref="downloadLogger"/>
        <to uri="file:src/main/resources/META-INF?noop=true"/>


        <!-- Prepare the message for calling OFBiz service -->
        <setHeader headerName="Ofbiz.ServiceName">
            <constant>DownLoadLogger</constant>
        </setHeader>
        <setHeader headerName="Ofbiz.Param.note">
            <simple>${in.body}</simple>
        </setHeader>

        <!-- Call the OFBiz service -->
        <camel:process ref="ofbizDispatcher"/>
    </camel:route>

但这会导致

java.io.NotSerializableException: org.apache.camel.component.file.GenericFile 
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1196)[camel-core-2.9.0.jar:2.9.0]
at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:87)[camel-core-2.9.0.jar:2.9.0]
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:128)[camel-core-2.9.0.jar:2.9.0]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.9.0.jar:2.9.0]
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.9.0.jar:2.9.0]
at org.apache.camel.component.rmi.RmiProducer.process(RmiProducer.java:45)[camel-rmi-2.9.0.jar:2.9.0]

我正在使用 jdk 1.6 骆驼 2.9 罐子。请建议我是否在任何地方缺少任何配置。

提前致谢

帕德马拉雅

4

2 回答 2

1

在 'from uri' 和 'to uri' 之间使用以下语句

<convertBodyTo type="byte[]"/>
于 2013-05-23T12:08:58.987 回答
0

将其转换为字符串后我得到了这个工作,转换为字节并不起作用!:(

 .convertBodyTo(String.class)
于 2015-09-24T09:41:30.043 回答