avro 从 1.7.6 升级到 1.9.2 后,hibernate-search 抛出 AvroTypeException

hibernate-search throws AvroTypeException after avro uprade from 1.7.6 to 1.9.2

我们的应用程序使用 hibernate-search 5.5 版。6.Final。根据 Maven 存储库,此版本的 hibernate-search 与 avro 版本 1.7.6-1.9.2 兼容。

我们正在进行自己的集群通信,为此我们正在序列化在从节点上所做的更改,以便将它们发送到主节点。在此序列化过程中,avro 抛出 AvroTypeException。

 ERROR org.hibernate.AssertionFailure                               (2a02:8106:229:d100:1:1:1:1, 195697EB4EE.jvm2, 01574163947948f5) - HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): org.hibernate.HibernateException: Error while indexing in Hibernate Search (after transaction completion)
2020-05-25 08:13:12,112 main [443-exec-2] ERROR g.springframework.orm.hibernate5.HibernateTransactionManager (2a02:8106:229:d100:1:1:1:1, 195697EB4EE.jvm2, 01574163947948f5) - Commit exception overridden by rollback exception
org.hibernate.AssertionFailure: Exception releasing cache locks
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:964) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.engine.spi.ActionQueue.afterTransactionCompletion(ActionQueue.java:491) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.internal.SessionImpl.afterTransactionCompletion(SessionImpl.java:2356) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.afterTransactionCompletion(JdbcCoordinatorImpl.java:491) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.afterCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:167) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access0(JdbcResourceLocalTransactionCoordinatorImpl.java:38) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:233) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:65) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:580) ~[spring-orm-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761) [spring-tx-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) [spring-tx-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:484) [spring-tx-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) [spring-tx-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) [spring-aop-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at com.sun.proxy.$Proxy147.insertRFQ(Unknown Source) [?:?]
    at net.allocation.astras.web.core.modules.events.services.LocalRFQService.insertRFQ(LocalRFQService.java:204) [astras-R6-4.6.1.jar:?]
    at net.allocation.astras.web.WFE.modules.events.controllers.events.rfq.create.AbstractCreateRFQController$InternalButtonHook.insertEvent(AbstractCreateRFQController.java:579) [astras-R6-4.6.1.jar:?]
    at net.allocation.astras.web.WFE.modules.events.controllers.events.create.AbstractCreateEventController$InternalButtonHook.onOkInternal(AbstractCreateEventController.java:2737) [astras-R6-4.6.1.jar:?]
    at net.allocation.astras.web.core.controllers.ui.OkCancelHook.onOk(OkCancelHook.java:273) [astras-R6-4.6.1.jar:?]
    at sun.reflect.GeneratedMethodAccessor831.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
    at net.allocation.astras.web.core.controllers.ui.ButtonMethodInvoker.call(ButtonMethodInvoker.java:78) [astras-R6-4.6.1.jar:?]
    at net.allocation.astras.web.core.controllers.ui.DefaultButtonHook.button(DefaultButtonHook.java:127) [astras-R6-4.6.1.jar:?]
    at net.allocation.astras.web.core.controllers.ui.AbstractUIViewController.handleRequestInternal(AbstractUIViewController.java:506) [astras-R6-4.6.1.jar:?]
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) [servlet-api.jar:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) [spring-webmvc-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) [servlet-api.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:9.0.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.34]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-websocket.jar:9.0.34]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.34]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.ResultsetExportFilter.doFilter(ResultsetExportFilter.java:234) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.TaskReminderFilter.doFilter(TaskReminderFilter.java:112) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.TimeZoneIntegrationFilter.doFilter(TimeZoneIntegrationFilter.java:65) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.security.RedirectTargetURLFilter.doFilter(RedirectTargetURLFilter.java:88) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.LicenceManagementFilter.doFilter(LicenceManagementFilter.java:104) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.security.RequestAuditFilter.doFilter(RequestAuditFilter.java:78) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.security.AstrasHttpSessionContextIntegrationFilter.doFilter(AstrasHttpSessionContextIntegrationFilter.java:262) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:184) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.34]
    at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:46) [ajaxanywhere-1.2.1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.34]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.SessionManagementFilter.doFilter(SessionManagementFilter.java:104) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.SiteIntegrationFilter.doFilter(SiteIntegrationFilter.java:206) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:122) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.ContentHandlingFilter.doFilter(ContentHandlingFilter.java:152) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.StatisticsFilter.doFilter(StatisticsFilter.java:86) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.security.SecurityAuditFilter.doFilter(SecurityAuditFilter.java:184) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:74) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at net.allocation.astras.web.core.filters.HTTPHeadFilter.doFilter(HTTPHeadFilter.java:48) [astras-R6-4.6.1.jar:?]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176) [spring-security-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.2.9.RELEASE.jar:4.2.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.34]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [catalina.jar:9.0.34]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.34]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [catalina.jar:9.0.34]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.34]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.34]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [catalina.jar:9.0.34]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.34]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-coyote.jar:9.0.34]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote.jar:9.0.34]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:9.0.34]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-coyote.jar:9.0.34]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.34]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.34]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: org.hibernate.HibernateException: Error while indexing in Hibernate Search (after transaction completion)
    at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnAfterTx.doAfterTransactionCompletion(EventSourceTransactionContext.java:190) ~[hibernate-search-orm-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:957) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    ... 110 more
Caused by: org.hibernate.search.exception.SearchException: HSEARCH000083: Unable to serialize List<LuceneWork>
    at org.hibernate.search.indexes.serialization.impl.LuceneWorkSerializerImpl.toSerializedModel(LuceneWorkSerializerImpl.java:109) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at net.allocation.astras.platform.core.fullTextSearch.AstrasBackendQueueProcessorWrapper.sendLuceneWorkList(AstrasBackendQueueProcessorWrapper.java:165) ~[astras-R6-4.6.1.jar:?]
    at net.allocation.astras.platform.core.fullTextSearch.AstrasBackendQueueProcessorWrapper.applyWork(AstrasBackendQueueProcessorWrapper.java:111) ~[astras-R6-4.6.1.jar:?]
    at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.performOperations(DirectoryBasedIndexManager.java:133) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.WorkQueuePerIndexSplitter.commitOperations(WorkQueuePerIndexSplitter.java:46) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:81) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:74) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnAfterTx.doAfterTransactionCompletion(EventSourceTransactionContext.java:187) ~[hibernate-search-orm-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:957) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    ... 110 more
Caused by: org.apache.avro.AvroTypeException: Not an enum: YES for schema: {"type":"enum","name":"Store","symbols":["YES","NO"]}
    at org.apache.avro.generic.GenericDatumWriter.writeEnum(GenericDatumWriter.java:218) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:133) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:206) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:195) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:130) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:144) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeArray(GenericDatumWriter.java:234) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:136) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:206) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:195) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:130) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:206) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:195) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:130) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:144) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeArray(GenericDatumWriter.java:234) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:136) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:206) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:195) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:130) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.2.jar:1.9.2]
    at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:72) ~[avro-1.9.2.jar:1.9.2]
    at org.hibernate.search.indexes.serialization.avro.impl.AvroSerializer.serialize(AvroSerializer.java:194) ~[hibernate-search-serialization-avro-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.indexes.serialization.impl.LuceneWorkSerializerImpl.toSerializedModel(LuceneWorkSerializerImpl.java:102) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at net.allocation.astras.platform.core.fullTextSearch.AstrasBackendQueueProcessorWrapper.sendLuceneWorkList(AstrasBackendQueueProcessorWrapper.java:165) ~[astras-R6-4.6.1.jar:?]
    at net.allocation.astras.platform.core.fullTextSearch.AstrasBackendQueueProcessorWrapper.applyWork(AstrasBackendQueueProcessorWrapper.java:111) ~[astras-R6-4.6.1.jar:?]
    at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.performOperations(DirectoryBasedIndexManager.java:133) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.WorkQueuePerIndexSplitter.commitOperations(WorkQueuePerIndexSplitter.java:46) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:81) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:74) ~[hibernate-search-engine-5.5.6.Final.jar:5.5.6.Final]
    at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnAfterTx.doAfterTransactionCompletion(EventSourceTransactionContext.java:187) ~[hibernate-search-orm-5.5.6.Final.jar:5.5.6.Final]

在我们将 avro 从 1.7.6 升级到 1.9.2 后,此异常开始出现。查找原因后,我找到了https://issues.apache.org/jira/browse/AVRO-1810。该问题表示该问题已针对 avro 1.9.0 得到解决。它没有为我们解决。 avro 1.9.2 的代码如下所示:

  /**
   * Called to write an enum value. May be overridden for alternate enum
   * representations.
   */
  protected void writeEnum(Schema schema, Object datum, Encoder out) throws IOException {
    if (!data.isEnum(datum))
      throw new AvroTypeException("Not an enum: " + datum + " for schema: " + schema);
    out.writeEnum(schema.getEnumOrdinal(datum.toString()));
  }

旧方法(版本 1.7.6):

  /** Called to write an enum value.  May be overridden for alternate enum
   * representations.*/
  protected void writeEnum(Schema schema, Object datum, Encoder out)
    throws IOException {
    out.writeEnum(schema.getEnumOrdinal(datum.toString()));
  }

hibernate-search 是否需要进行一些我不知道的调整可以解决这个问题?

Accoring to Maven repository, this version of the hibernate-search is compatible with avro versions 1.7.6-1.9.2.

我很好奇你从哪里得到的信息。 Hibernate Search 使用 Avro 1.7.6,绝对没有升级到 1.9,甚至没有用那个版本测试过。

有一个关于此升级的未决 PR here,但由于对向后兼容性的担忧,它目前已停止:我们不想破坏微版本和下一个主要版本(Hibernate Search)的兼容性6) 根本不使用 Avro。

关于解决方案...如果您坚持使用 Hibernate Search 5.5,您可能就不走运了,因为它不再由社区维护。一些(商业)供应商可能仍会提供更新。

如果您可以升级到 Hibernate Search 5.11,也许您可​​以尝试从 this code 构建 Hibernate Search 并在您的应用程序中使用它。