无法使私有 java.time.chrono.IsoChronology() 可访问 - Firebase
Unable to make private java.time.chrono.IsoChronology() accessible - Firebase
大家好,我正在尝试将以下 class 保存到我在 Firebase 上的 collection。
public class Review {
private String username;
private String comment;
private int grade;
private String gender;
private LocalDateTime timestamp;
}
但是当我使用 Postman 发送请求时,出现以下错误:
2021-12-19 23:53:01.652 ERROR 3348 --- [nio-9999-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.chrono.IsoChronology() accessible: module java.base does not "opens java.time.chrono" to unnamed module @4e268090] with root cause
java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.chrono.IsoChronology() accessible: module java.base does not "opens java.time.chrono" to unnamed module @4e268090
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188) ~[na:na]
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181) ~[na:na]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.<init>(CustomClassMapper.java:635) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.loadOrCreateBeanMapperForClass(CustomClassMapper.java:382) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:180) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.access0(CustomClassMapper.java:53) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.serialize(CustomClassMapper.java:941) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:181) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.access0(CustomClassMapper.java:53) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.serialize(CustomClassMapper.java:941) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:181) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:153) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.access0(CustomClassMapper.java:53) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.serialize(CustomClassMapper.java:941) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:181) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:104) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.convertToPlainJavaTypes(CustomClassMapper.java:79) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.UpdateBuilder.set(UpdateBuilder.java:213) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.UpdateBuilder.set(UpdateBuilder.java:195) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.DocumentReference.set(DocumentReference.java:205) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at dians_project.mapedonija.service.ShopService.updateShop(ShopService.java:76) ~[classes/:na]
at dians_project.mapedonija.service.ShopService.addReviews(ShopService.java:115) ~[classes/:na]
at dians_project.mapedonija.controller.ShopController.addShopReview(ShopController.java:70) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.12.jar:5.3.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.12.jar:5.3.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
当我调用以下方法(在 Firestore 中设置文档)时调用它:
dbFirestore.collection("shops").document(shop.getId()).set(shop);
我有每个 Shop
的 Review
列表,所以在添加新的 Review
之后,我更新相同的 Shop
。
我的猜测是 Firestore 处理 LocalDateTime
变量时出现问题。此错误的任何解决方案或在 Firestore 中存储时间戳的替代方法?
我不确定这是否是您问题的根源,但可能是。
LocalDateTime
不是时间戳
LocalDateTime
是时间戳的错误数据类型。 class 表示带有时间的日期,但缺少时区上下文或与 UTC 的偏移量。
暂时以 UTC 显示,请使用 Instant
。
在时区中看到的片刻,使用ZonedDateTime
。
暂时使用 UTC 偏移量,使用 OffsetDateTime
。
要与面向 SQL 的数据库进行交流,请使用 OffsetDateTime
。
这已在 Stack Overflow 上多次介绍,因此请搜索以了解更多信息。
大家好,我正在尝试将以下 class 保存到我在 Firebase 上的 collection。
public class Review {
private String username;
private String comment;
private int grade;
private String gender;
private LocalDateTime timestamp;
}
但是当我使用 Postman 发送请求时,出现以下错误:
2021-12-19 23:53:01.652 ERROR 3348 --- [nio-9999-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.chrono.IsoChronology() accessible: module java.base does not "opens java.time.chrono" to unnamed module @4e268090] with root cause
java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.chrono.IsoChronology() accessible: module java.base does not "opens java.time.chrono" to unnamed module @4e268090
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188) ~[na:na]
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181) ~[na:na]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.<init>(CustomClassMapper.java:635) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.loadOrCreateBeanMapperForClass(CustomClassMapper.java:382) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:180) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.access0(CustomClassMapper.java:53) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.serialize(CustomClassMapper.java:941) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:181) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.access0(CustomClassMapper.java:53) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.serialize(CustomClassMapper.java:941) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:181) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:153) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.access0(CustomClassMapper.java:53) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper$BeanMapper.serialize(CustomClassMapper.java:941) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:181) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.serialize(CustomClassMapper.java:104) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.CustomClassMapper.convertToPlainJavaTypes(CustomClassMapper.java:79) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.UpdateBuilder.set(UpdateBuilder.java:213) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.UpdateBuilder.set(UpdateBuilder.java:195) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at com.google.cloud.firestore.DocumentReference.set(DocumentReference.java:205) ~[google-cloud-firestore-1.35.0.jar:1.35.0]
at dians_project.mapedonija.service.ShopService.updateShop(ShopService.java:76) ~[classes/:na]
at dians_project.mapedonija.service.ShopService.addReviews(ShopService.java:115) ~[classes/:na]
at dians_project.mapedonija.controller.ShopController.addShopReview(ShopController.java:70) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.12.jar:5.3.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.12.jar:5.3.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
当我调用以下方法(在 Firestore 中设置文档)时调用它:
dbFirestore.collection("shops").document(shop.getId()).set(shop);
我有每个 Shop
的 Review
列表,所以在添加新的 Review
之后,我更新相同的 Shop
。
我的猜测是 Firestore 处理 LocalDateTime
变量时出现问题。此错误的任何解决方案或在 Firestore 中存储时间戳的替代方法?
我不确定这是否是您问题的根源,但可能是。
LocalDateTime
不是时间戳
LocalDateTime
是时间戳的错误数据类型。 class 表示带有时间的日期,但缺少时区上下文或与 UTC 的偏移量。
暂时以 UTC 显示,请使用 Instant
。
在时区中看到的片刻,使用ZonedDateTime
。
暂时使用 UTC 偏移量,使用 OffsetDateTime
。
要与面向 SQL 的数据库进行交流,请使用 OffsetDateTime
。
这已在 Stack Overflow 上多次介绍,因此请搜索以了解更多信息。