如何解决更新本机 quarkus 中的实体时的 Blaze Persistence Null Pointer 异常
在 Quarkus 本机中更新实体(通过实体视图)时,我有一个奇怪的行为(它在 jvm 上工作正常)。这些是我的实体:
@Entity
public class Role extends BaseEntity {
private boolean deleted;
private String name;
@OnetoMany
private Set<LocalizedText> localizedDescriptions = new HashSet<>();
@ManyToMany
private Set<Permission> permissions = new HashSet<>();
//SETTERS AND GETTERS
}
@Entity
public class LocalizedText extends BaseEntity {
@NotBlank
private String language;
@NotBlank
private String text;
}
@Entity
public class Permission extends BaseEntity {
private boolean deleted;
@NotBlank
private String name;
@OnetoMany
@NotEmpty
private Set<LocalizedText> localizedDescriptions = new HashSet<>();
}
这是实体视图:
@EntityView(Role.class)
@CreatableEntityView
@UpdatableEntityView
public interface RoleUpdateView {
@IdMapping
Long getId();
String getName();
void setName(String name);
@UpdatableMapping
Set<LocalizedTextUpdateView> getLocalizedDescriptions();
@UpdatableMapping
Set<SimplePermissionUpdateView> getPermissions();
}
@EntityView(LocalizedText.class)
@CreatableEntityView
@UpdatableEntityView
public interface LocalizedTextUpdateView {
@IdMapping
Long getId();
String getLanguage();
void setLanguage(String language);
String getText();
void setText(String text);
}
@EntityView(Permission.class)
@CreatableEntityView
@UpdatableEntityView
public interface SimplePermissionUpdateView {
@IdMapping
Long getId();
}
正如我所说,它在使用 jvm 时工作得很好,但它仅适用于本机模式下的实体创建。更新实体时,我得到一个 NPE。这是跟踪:
org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.Synchronousdispatcher.writeException(Synchronousdispatcher.java:218)
at org.jboss.resteasy.core.Synchronousdispatcher.invoke(Synchronousdispatcher.java:519)
at org.jboss.resteasy.core.Synchronousdispatcher.lambda$invoke$4(Synchronousdispatcher.java:261)
at org.jboss.resteasy.core.Synchronousdispatcher.lambda$preprocess$0(Synchronousdispatcher.java:161)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.Synchronousdispatcher.preprocess(Synchronousdispatcher.java:164)
at org.jboss.resteasy.core.Synchronousdispatcher.invoke(Synchronousdispatcher.java:247)
at io.quarkus.resteasy.runtime.standalone.Requestdispatcher.service(Requestdispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:138)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:84)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:41)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
at io.quarkus.vertx.http.runtime.StaticResourcesRecorder.lambda$start$1(StaticResourcesRecorder.java:65)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$4.handle(VertxHttpRecorder.java:338)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$4.handle(VertxHttpRecorder.java:316)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
at io.quarkus.vertx.http.runtime.security.HttpAuthorizer.doPermissionCheck(HttpAuthorizer.java:116)
at io.quarkus.vertx.http.runtime.security.HttpAuthorizer.checkPermission(HttpAuthorizer.java:99)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$3.handle(HttpSecurityRecorder.java:218)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$3.handle(HttpSecurityRecorder.java:210)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2$2.onItem(HttpSecurityRecorder.java:143)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2$2.onItem(HttpSecurityRecorder.java:104)
at io.smallrye.mutiny.operators.uni.UniMemoizeOp.drain(UniMemoizeOp.java:152)
at io.smallrye.mutiny.operators.uni.UniMemoizeOp.onItem(UniMemoizeOp.java:172)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKNownItem$KNownItemSubscription.forward(UniCreateFromKNownItem.java:38)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKNownItem$KNownItemSubscription.access$100(UniCreateFromKNownItem.java:26)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKNownItem.subscribe(UniCreateFromKNownItem.java:23)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
at io.smallrye.mutiny.operators.uni.builders.DefaultUniEmitter.complete(DefaultUniEmitter.java:36)
at io.quarkus.security.runtime.QuarkusIdentityProviderManagerImpl$1$1$1$1.run(QuarkusIdentityProviderManagerImpl.java:58)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossthread.run(JBossthread.java:501)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.getQueryParamEntries(HibernateExtendedQuerySupport.java:824)
at com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.createqueryParameters(HibernateExtendedQuerySupport.java:719)
at com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.executeUpdate(HibernateExtendedQuerySupport.java:415)
at com.blazebit.persistence.impl.plan.CustomModificationQueryPlan.executeUpdate(CustomModificationQueryPlan.java:52)
at com.blazebit.persistence.impl.query.CustomsqlQuery.executeUpdate(CustomsqlQuery.java:60)
at com.blazebit.persistence.view.impl.update.flush.CollectionAttributeFlusher.addElements(CollectionAttributeFlusher.java:534)
at com.blazebit.persistence.view.impl.update.flush.CollectionAttributeFlusher.replaceCollection(CollectionAttributeFlusher.java:1025)
at com.blazebit.persistence.view.impl.update.flush.CollectionAttributeFlusher.replaceCollection(CollectionAttributeFlusher.java:64)
at com.blazebit.persistence.view.impl.update.flush.AbstractPluralAttributeFlusher.invokeFlushOperation(AbstractPluralAttributeFlusher.java:286)
at com.blazebit.persistence.view.impl.update.flush.CollectionAttributeFlusher.flushQuery(CollectionAttributeFlusher.java:287)
at com.blazebit.persistence.view.impl.update.flush.CollectionAttributeFlusher.flushQuery(CollectionAttributeFlusher.java:64)
at com.blazebit.persistence.view.impl.update.flush.CompositeAttributeFlusher.flushQuery(CompositeAttributeFlusher.java:450)
at com.blazebit.persistence.view.impl.update.EntityViewUpdaterImpl.update(EntityViewUpdaterImpl.java:711)
at com.blazebit.persistence.view.impl.update.EntityViewUpdaterImpl.executeUpdate(EntityViewUpdaterImpl.java:637)
at com.blazebit.persistence.view.impl.EntityViewManagerImpl.update(EntityViewManagerImpl.java:1182)
at com.blazebit.persistence.view.impl.EntityViewManagerImpl.update(EntityViewManagerImpl.java:1142)
at com.blazebit.persistence.view.impl.EntityViewManagerImpl.save(EntityViewManagerImpl.java:1059)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService.save(RolesService.java:95)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_Subclass.save$$superaccessor8(RolesService_Subclass.zig:1366)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_Subclass$$function$$8.apply(RolesService_Subclass$$function$$8.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.security.runtime.interceptor.SecurityHandler.handle(SecurityHandler.java:24)
at io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor.intercept(RolesAllowedInterceptor.java:29)
at io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor_Bean.intercept(RolesAllowedInterceptor_Bean.zig:386)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:50)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInCallerTx(TransactionalInterceptorBase.java:252)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorrequired.doIntercept(TransactionalInterceptorrequired.java:34)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:53)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorrequired.intercept(TransactionalInterceptorrequired.java:26)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorrequired_Bean.intercept(TransactionalInterceptorrequired_Bean.zig:340)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_Subclass.save(RolesService_Subclass.zig:1323)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService.update(RolesService.java:101)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_Subclass.update$$superaccessor7(RolesService_Subclass.zig:1253)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_Subclass$$function$$7.apply(RolesService_Subclass$$function$$7.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.security.runtime.interceptor.SecurityHandler.handle(SecurityHandler.java:24)
at io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor.intercept(RolesAllowedInterceptor.java:29)
at io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor_Bean.intercept(RolesAllowedInterceptor_Bean.zig:386)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:50)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:127)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:100)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorrequired.doIntercept(TransactionalInterceptorrequired.java:32)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:53)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorrequired.intercept(TransactionalInterceptorrequired.java:26)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorrequired_Bean.intercept(TransactionalInterceptorrequired_Bean.zig:340)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_Subclass.update(RolesService_Subclass.zig:1210)
at cloud.officinaedisanto.heritage.coreservice.services.RolesService_ClientProxy.update(RolesService_ClientProxy.zig:225)
at cloud.officinaedisanto.heritage.coreservice.api.backoffice.RolesBOResource.update(RolesBOResource.java:53)
at cloud.officinaedisanto.heritage.coreservice.api.backoffice.RolesBOResource_Subclass.update$$superaccessor1(RolesBOResource_Subclass.zig:361)
at cloud.officinaedisanto.heritage.coreservice.api.backoffice.RolesBOResource_Subclass$$function$$1.apply(RolesBOResource_Subclass$$function$$1.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.security.runtime.interceptor.SecurityHandler.handle(SecurityHandler.java:24)
at io.quarkus.security.runtime.interceptor.AuthenticatedInterceptor.intercept(AuthenticatedInterceptor.java:29)
at io.quarkus.security.runtime.interceptor.AuthenticatedInterceptor_Bean.intercept(AuthenticatedInterceptor_Bean.zig:378)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at cloud.officinaedisanto.heritage.coreservice.api.backoffice.RolesBOResource_Subclass.update(RolesBOResource_Subclass.zig:318)
at java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:643)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:507)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:457)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:459)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:419)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:393)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:68)
at org.jboss.resteasy.core.Synchronousdispatcher.invoke(Synchronousdispatcher.java:492)
... 50 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.getField(HibernateExtendedQuerySupport.java:1296)
at com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.getQueryParamEntries(HibernateExtendedQuerySupport.java:821)
... 127 more
Caused by: java.lang.NullPointerException
at com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.getField(HibernateExtendedQuerySupport.java:1291)
... 128 more
有关如何修复此错误的任何想法?我做错了什么?
谢谢 欧盟
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。