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 repository doesn't work when injected in Kotlin test #1969

Closed
cristhiank opened this issue Apr 9, 2019 · 5 comments
Closed

Panache repository doesn't work when injected in Kotlin test #1969

cristhiank opened this issue Apr 9, 2019 · 5 comments
Labels
triage/duplicate This issue or pull request already exists

Comments

@cristhiank
Copy link
Contributor

cristhiank commented Apr 9, 2019

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 #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

cristhiank added a commit to cristhiank/quarkus-bugs that referenced this issue Apr 10, 2019
@cristhiank cristhiank changed the title Panache repository doesn't work when injecting in Kotlin test Panache repository doesn't work when injected in Kotlin test Apr 10, 2019
@geoand
Copy link
Contributor

geoand commented Apr 10, 2019

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.

@FroMage
Copy link
Member

FroMage commented Apr 10, 2019

Sounds like a dupe of #1724, no?

@geoand
Copy link
Contributor

geoand commented Apr 10, 2019

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.

@FroMage
Copy link
Member

FroMage commented Apr 10, 2019

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

@FroMage FroMage closed this as completed Apr 10, 2019
@FroMage FroMage added the triage/duplicate This issue or pull request already exists label Apr 10, 2019
@toriacht
Copy link

toriacht commented Apr 25, 2019

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants