Quarkus: Panache repository doesn't work when injected in Kotlin test

Created on 10 Apr 2019  路  5Comments  路  Source: quarkusio/quarkus

I am getting the following error when I use the "augmented/enhanced" methods on the Panache repository injected in a kotlin test class:

[INFO] Running org.acme.rest.PanacheResourceTest
Entity id is: ${entity.id}
Apr 09, 2019 6:42:50 PM io.undertow.servlet.api.LoggingExceptionHandler handleThrowable
ERROR: UT005023: Exception handling request to /test-entity/27bef95b-fb28-4a0d-8d82-c9be1f7ed623
org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalStateException: This method is normally automatically overridden in subclasses: did you forget to annotate your entity with @Entity?
        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:209)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:252)
        at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$607.00000000915D5C20.run(Unknown Source)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:153)
        at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$608.000000009057ED10.get(Unknown Source)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
        at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:156)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:238)
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:234)

IMO after some deep debugging I think it is related to https://github.com/quarkusio/quarkus/issues/770 because the "augmented" class is present in the test-clases/ folder but the ArC container is returning the non-enhanced class.

This error shows only when the test class is written in Kotlin. Everything works as expected with Java ;)

I have a reproducer in this repo:
https://github.com/cristhiank/quarkus-bugs

https://github.com/cristhiank/quarkus-bugs/blob/master/src/test/java/org/acme/rest/PanacheResourceKotlinTest.kt

triagduplicate

Most helpful comment

Yeah, let's close it. Don't hesitate to reopen if it turns out to be different, though.

All 5 comments

I'll debug this later as well and see what I can come up with.

However are you sure it only fail for Kotlin? My naive attempt to run the reproducer failed with the Java test as well.

Sounds like a dupe of #1724, no?

I believe it is. However @cristhiank reported that it works for Java and not Kotlin. I personally have not been able to get it to work for Java either.

Yeah, let's close it. Don't hesitate to reopen if it turns out to be different, though.

@cristhiank

Everything works as expected with Java ;)

Would you have a copy of the working Java Test? I am having similar issues trying to test persisting a
PanacheEntity in Java

Was this page helpful?
0 / 5 - 0 ratings