Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panache fails with NPE when @Entity is forgotten #13338

Closed
emmanuelbernard opened this issue Nov 17, 2020 · 2 comments · Fixed by #13342
Closed

Panache fails with NPE when @Entity is forgotten #13338

emmanuelbernard opened this issue Nov 17, 2020 · 2 comments · Fixed by #13342
Labels
area/hibernate-orm Hibernate ORM area/panache area/persistence OBSOLETE, DO NOT USE area/spring Issues relating to the Spring integration area/user-experience Will make us lose users kind/bug Something isn't working
Milestone

Comments

@emmanuelbernard
Copy link
Member

Todo app with resource and Todo entity and proper configuration in app.properties

If I create the todo forgetting the @entity

package com.acme.model;

import io.quarkus.hibernate.orm.panache.PanacheEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.validation.constraints.NotBlank;

/**
 * @author Emmanuel Bernard [email protected]
 */
//@Entity
public class Todo extends PanacheEntity {
    @Column(nullable = false) @NotBlank
    public String title;
    public String url;
    public boolean completed;
    @Column(name = "ordering")
    public int order;
}

I get

0a-9a24acf61064-1: org.jboss.resteasy.spi.UnhandledException: 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:131)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:37)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:94)
        at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        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.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.NullPointerException
        at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.createBaseQuery(CommonPanacheQueryImpl.java:322)
        at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.createQuery(CommonPanacheQueryImpl.java:277)
        at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.list(CommonPanacheQueryImpl.java:228)
        at io.quarkus.hibernate.orm.panache.runtime.PanacheQueryImpl.list(PanacheQueryImpl.java:149)
        at io.quarkus.hibernate.orm.panache.runtime.JpaOperations$JavaJpaOperations.list(JpaOperations.java:32)
        at io.quarkus.hibernate.orm.panache.runtime.JpaOperations$JavaJpaOperations.list(JpaOperations.java:22)
        at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.listAll(AbstractJpaOperations.java:246)
        at io.quarkus.hibernate.orm.panache.runtime.JpaOperations.listAll(JpaOperations.java:268)
        at com.acme.model.Todo.listAll(Todo.java)
        at org.acme.spring.web.TodoResource.getAll(TodoResource.java:19)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/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)
        ... 20 more

upon refresh

@emmanuelbernard emmanuelbernard added the kind/bug Something isn't working label Nov 17, 2020
@ghost ghost added area/hibernate-orm Hibernate ORM area/panache area/persistence OBSOLETE, DO NOT USE area/spring Issues relating to the Spring integration labels Nov 17, 2020
@ghost
Copy link

ghost commented Nov 17, 2020

/cc @FroMage, @Sanne, @geoand, @gsmet, @loicmathieu

@emmanuelbernard
Copy link
Member Author

Another one @FroMage

@geoand geoand added the area/user-experience Will make us lose users label Nov 17, 2020
geoand added a commit to geoand/quarkus that referenced this issue Nov 17, 2020
geoand added a commit to geoand/quarkus that referenced this issue Nov 17, 2020
geoand added a commit to geoand/quarkus that referenced this issue Nov 17, 2020
geoand added a commit to geoand/quarkus that referenced this issue Nov 17, 2020
@ghost ghost added this to the 1.11 - master milestone Nov 17, 2020
@gsmet gsmet modified the milestones: 1.11 - master, 1.10.0.Final Nov 18, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/panache area/persistence OBSOLETE, DO NOT USE area/spring Issues relating to the Spring integration area/user-experience Will make us lose users kind/bug Something isn't working
Projects
None yet
3 participants