1 回答
TA贡献1815条经验 获得超10个赞
您可以通过在您的程序中添加来在控制台中启用骆驼日志记录org.apache.log4j.BasicConfigurator.configure()。
使用它,您可以验证路由是否启动并使用了文件。所以通过添加一些日志来执行你的程序:
CamelContext camelContext = new DefaultCamelContext();
BasicConfigurator.configure();
camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
String publicKeyFileName = "file:C:\\LocalData\\Keys\\pgp_public.asc";
String keyUserid = " ";
from("file:C:\\Test\\Test\\IN")
.log("file received")
.marshal().pgp(publicKeyFileName, keyUserid)
.to("file:C\\Test\\Test\\OUT");
}
});
camelContext.start();
Thread.sleep(30000);
camelContext.stop();
}
我可以注意到路由正在启动,使用 in 文件夹中的文件然后失败,但出现以下异常:
Caused by: java.lang.NoSuchMethodError: org.bouncycastle.openpgp.PGPPublicKeyRingCollection.<init>(Ljava/io/InputStream;)V
at org.apache.camel.converter.crypto.PGPDataFormatUtil.findPublicKey(PGPDataFormatUtil.java:64)
at org.apache.camel.converter.crypto.PGPDataFormatUtil.findPublicKey(PGPDataFormatUtil.java:54)
at org.apache.camel.converter.crypto.PGPDataFormat.marshal(PGPDataFormat.java:64)
at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
添加回答
举报