KMongo和Tomcat的问题

时间:2018-11-30 16:16:51

标签: kotlin ktor kmongo

我正在尝试在部署到Tomcat的Web应用程序中使用KMongo和Ktor。 一切在本地都可以正常工作,但是当我部署到远程服务器时,却遇到了这个异常:

java.util.ServiceConfigurationError: org.litote.kmongo.service.ClassMappingTypeService: org.litote.kmongo.jackson.JacksonClassMappingTypeService not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
at java.base/java.util.ServiceLoader.access$200(ServiceLoader.java:390)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1236)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
at org.litote.kmongo.service.ClassMappingTypeKt$defaultService$2.invoke(ClassMappingType.kt:32)
at org.litote.kmongo.service.ClassMappingTypeKt$defaultService$2.invoke(ClassMappingType.kt)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at org.litote.kmongo.service.ClassMappingTypeKt.getDefaultService(ClassMappingType.kt)
at org.litote.kmongo.service.ClassMappingTypeKt.getCurrentService(ClassMappingType.kt:51)
at org.litote.kmongo.service.ClassMappingTypeKt.access$getCurrentService$p(ClassMappingType.kt:1)
at org.litote.kmongo.service.ClassMappingType.<init>(ClassMappingType.kt:59)
at org.litote.kmongo.service.ClassMappingType.<clinit>(ClassMappingType.kt:59)
at org.litote.kmongo.KMongo.configureRegistry$kmongo_core(KMongo.kt:232)
at org.litote.kmongo.KMongo.createClient(KMongo.kt:224)
at com.bhdyn.db.DBManager.start(DBManager.kt:20)
at com.bhdyn.ApplicationKt$module$2$1$1.invokeSuspend(Application.kt:35)
at com.bhdyn.ApplicationKt$module$2$1$1.invoke(Application.kt)
at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:248)
at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:111)
at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:131)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.routing.Routing.executeResult(Routing.kt:148)
at io.ktor.routing.Routing.interceptor(Routing.kt:29)
at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:93)
at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt)
at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:248)
at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:111)
at io.ktor.features.ContentNegotiation$Feature$install$1.invokeSuspend(ContentNegotiation.kt:60)
at io.ktor.features.ContentNegotiation$Feature$install$1.invoke(ContentNegotiation.kt)
at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:248)
at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:111)
at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:131)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:80)
at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt)
at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:248)
at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:111)
at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:131)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.server.servlet.KtorServlet$asyncService$1.invokeSuspend(KtorServlet.kt:133)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:236)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)

我认为kmongo使用的杰克逊图书馆与我有冲突,但是经过数小时的尝试解决后,我还是没明白。

有解决方案吗?

0 个答案:

没有答案