1

I'm doing a POC with Helidon MP + DBClient with MongoDB pokemon example but it is throwing Mapper exception. Only http://localhost:8080/db is working which displays the pokemons in the db. Any help is highly appreciated.

Thank You

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
4

1 回答 1

1

自己解决了这个问题并在这里发布,以防任何人面临同样的问题。在比较示例 helidon se 代码后找到了解决方案。缺少的是映射配置

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

于 2020-07-10T05:37:54.257 回答