骆驼 AtlasMap UnrecognizedPropertyException

Camel AtlasMap UnrecognizedPropertyException

我正在骆驼路线上试驾 atlasmap。我创建了一个非常简单的测试输入 xml 文件、一个 adm 文件和一个路由。我得到一个例外。

public class ImportRoute extends RouteBuilder {
    @Override
    public void configure() throws Exception {

        from(file("/edi/test/test_file_origin/").include("^.*\.xml$"))
                .autoStartup(true)
                .to(
                        atlasmap("mapping/xml_to_json.adm")
                )
                .to(log("Done"));
    }
}

test.xml @'"/edi/test/test_file_origin/"':

<test>
    <id>3</id>
</test>

我的例外:

io.atlasmap.api.AtlasException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "id" (class io.atlasmap.v2.DataSourceMetadata), not marked as ignorable (8 known properties: "documentType", "documentId", "name", "inspectionType", "dataSourceType", "isSource", "source", "inspectionParameters"])
 at [Source: (GZIPInputStream); line: 1, column: 2083] (through reference chain: io.atlasmap.v2.ADMDigest["exportMeta"]->java.lang.Object[][0]->io.atlasmap.v2.DataSourceMetadata["id"])
    at io.atlasmap.core.ADMArchiveHandler.getDataSourceMetadataMap(ADMArchiveHandler.java:327)
    at io.atlasmap.core.DefaultAtlasContext.<init>(DefaultAtlasContext.java:119)
    at io.atlasmap.core.DefaultAtlasContextFactory.createContext(DefaultAtlasContextFactory.java:191)
    at org.apache.camel.component.atlasmap.AtlasMapEndpoint.getOrCreateAtlasContext(AtlasMapEndpoint.java:253)
    at org.apache.camel.component.atlasmap.AtlasMapEndpoint.onExchange(AtlasMapEndpoint.java:198)
    at org.apache.camel.support.ProcessorEndpoint.process(ProcessorEndpoint.java:61)
    at org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:66)
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:169)
    at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:395)
    at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
    at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:147)
    at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:312)
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:483)
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:237)
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:198)
    at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:190)
    at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:107)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "id" (class io.atlasmap.v2.DataSourceMetadata), not marked as ignorable (8 known properties: "documentType", "documentId", "name", "inspectionType", "dataSourceType", "isSource", "source", "inspectionParameters"])
 at [Source: (GZIPInputStream); line: 1, column: 2083] (through reference chain: io.atlasmap.v2.ADMDigest["exportMeta"]->java.lang.Object[][0]->io.atlasmap.v2.DataSourceMetadata["id"])
    at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:855)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1212)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1604)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1582)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:299)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
    at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
    at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4526)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3505)
    at io.atlasmap.core.ADMArchiveHandler.getDataSourceMetadataMap(ADMArchiveHandler.java:315)

Jackson 是否可能在项目的其他地方配置不正确?最终,我想将 adm 文件的 json 输出映射到一个 Java 对象,我将通过 JPA 保留它。

看起来版本不匹配,请确保您使用的 AtlasMap UI 版本与 camel-atlasmap 组件使用的版本相同。