初始化 Graphql 应用程序时出现 org.dataloader.DataLoaderRegistry 错误
Posted
技术标签:
【中文标题】初始化 Graphql 应用程序时出现 org.dataloader.DataLoaderRegistry 错误【英文标题】:org.dataloader.DataLoaderRegistry error while initialization of Graphql application 【发布时间】:2021-08-06 22:15:00 【问题描述】:我在我的应用程序中使用以下 jar 集。
compile files('libs/latest/graphql-java-servlet-6.1.3.jar')
compile files('libs/latest/graphql-java-16.2.jar')
compile files('libs/latest/graphql-java-tools-5.2.4.jar')
compile files('libs/latest/graphql-spring-boot-autoconfigure-5.0.2.jar')
compile files('libs/latest/graphql-spring-boot-starter-5.0.2.jar')
compile files('libs/latest/antlr4-runtime-4.9.2.jar')
compile files('libs/lombok-1.16.18.jar')
compile files('libs/latest/graphql-java-extended-scalars-16.0.1.jar')
在启动期间初始化 bean 时,我遇到了导致应用程序失败的错误。
org/dataloader/DataLoaderRegistry ,"ERR": org.apache.cxf.interceptor.Fault: org/dataloader/DataLoaderRegistry
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
at org.apache.cxf.jaxrs.LazyJAXRSInvoker.invoke(LazyJAXRSInvoker.java:197)
at org.apache.cxf.jaxrs.LazyJAXRSInvoker.invoke(LazyJAXRSInvoker.java:107)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
Caused by: java.lang.NoClassDefFoundError: org/dataloader/DataLoaderRegistry
at graphql.ExecutionInput$Builder.(ExecutionInput.java:198)
at graphql.ExecutionInput.newExecutionInput(ExecutionInput.java:172)
at graphql.GraphQL.execute(GraphQL.java:256)
at com.sample.PublishReportRestServiceImpl.getReports(PublishReportRestServiceImpl.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
... 145 more
Caused by: java.lang.ClassNotFoundException: org.dataloader.DataLoaderRegistry
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 155 more
有人可以帮忙解决这个问题吗?
【问题讨论】:
【参考方案1】:我能够通过在 WEB-INF/lib 文件夹中添加 java-dataloader-2.2.3.jar 来解决此问题,并且应用程序现在已启动并运行。
感谢您的宝贵时间。
【讨论】:
以上是关于初始化 Graphql 应用程序时出现 org.dataloader.DataLoaderRegistry 错误的主要内容,如果未能解决你的问题,请参考以下文章
尝试从反应应用程序连接到 graphcool 中继 API 时出现此错误:模块构建失败:错误:没有有效的 GraphQL 端点
AWS Amplify + Graphql + Dynamodb:突变时出现 ConditionalCheckFailedException 错误