带有MongoDB宠物小精灵示例的Helidon MP + DBClient抛出Mapper异常

时间:2020-07-09 13:53:44

标签: mongodb helidon

我正在使用Helidon MP + DBClient和MongoDB pokemon示例进行POC,但它会抛出Mapper异常。只有http:// localhost:8080 / db可以在数据库中显示神奇宝贝。非常感谢您的帮助。

谢谢

Caused by: io.helidon.common.mapper.MapperException: Failed to map class com.oracle.d
x4c.taas.poc.common.Pokemon to java.util.Map<java.lang.String, ?>: Failed to find DB
mapper.
        at io.helidon.dbclient.DbMapperManagerImpl$1.toNamedParameters(DbMapperManage
rImpl.java:148)
        at io.helidon.dbclient.DbMapperManagerImpl.lambda$toNamedParameters$2(DbMappe
rManagerImpl.java:62)
        at io.helidon.dbclient.DbMapperManagerImpl.executeMapping(DbMapperManagerImpl
.java:79)
        at io.helidon.dbclient.DbMapperManagerImpl.toNamedParameters(DbMapperManagerI
mpl.java:61)
        at io.helidon.dbclient.common.NamedStatementParameters.namedParam(NamedStatem
entParameters.java:49)
        at io.helidon.dbclient.common.AbstractStatement.namedParam(AbstractStatement.
java:125)
        at com.oracle.dx4c.taas.poc.common.AbstractPokemonService.lambda$insertPokemo
n$0(AbstractPokemonService.java:98)
        at io.helidon.dbclient.mongodb.MongoDbClient.execute(MongoDbClient.java:122)
        at com.oracle.dx4c.taas.poc.common.AbstractPokemonService.insertPokemon(Abstr
actPokemonService.java:96)
        at io.helidon.webserver.Handler.lambda$create$0(Handler.java:94)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:98)
        at io.helidon.webserver.Handler.lambda$create$1(Handler.java:94)
        at java.base/java.util.Optional.ifPresentOrElse(Optional.java:201)
        at io.helidon.webserver.Handler.lambda$create$3(Handler.java:93)
        at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(Complet
ableFuture.java:714)
        ... 41 more

1 个答案:

答案 0 :(得分:0)

本人解决了该问题,并在此发布,以防任何人面临相同的问题。 比较示例停机坪代码后找到了解决方案。缺少的映射配置

META-INF / services / io.helidon.dbclient.spi.DbMapperProvider 将映射器类文件添加到此配置中解决了我的问题。