在骆驼中获得以下异常:
Exchange[
Id ID-Dell-PC-51429-1581618665098-0-4
ExchangePattern InOnly
Headers {breadcrumbId=ID-Dell-PC-51429-1581618665098-0-3, CamelFileAbsolute=false, CamelFileAbsolutePath=C:\Users\Dell\eclipse-workspace\camelHelloWorld\input\TIL.txt, CamelFileContentType=text/plain, CamelFileLastModified=1581618006722, CamelFileLength=12050, CamelFileName=TIL.txt, CamelFileNameConsumed=TIL.txt, CamelFileNameOnly=TIL.txt, CamelFileParent=input, CamelFilePath=input\TIL.txt, CamelFileRelativePath=TIL.txt, CamelRedelivered=false, CamelRedeliveryCounter=0}
BodyType org.apache.camel.component.file.GenericFile
Body [Body is file based: GenericFile[TIL.txt]]
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: Unexpected / unmapped characters found at the end of the fixed-length record at line : 2
at org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:281)
at org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.createModel(BindyFixedLengthDataFormat.java:262)
at org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:196)
at org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:67)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:433)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
尝试使用以下方法转换固定文件格式:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"id",
"name",
.
.
})
@XmlRootElement(name = "Til")
@FixedLengthRecord(length = 239)
public class Til {
@XmlElement(name = "ID", required = true)
@DataField(pos = 1, length = 4)
protected String id;
@XmlElement(name = "NAME", required = true)
@DataField(pos = 5, length = 15)
protected String name;
.
.
}
文件中的总字符数为 239。
这个错误可能是什么原因?修复此问题需要任何类型的修剪或填充?