quarkus: Unable to register classes for reflection (Jandex)
Describe the bug
I am using gradle and Java. gets the below warning.
Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- org.jooq.Catalog (source: JacksonProcessor > com.sumit.models.TestClass2)
- org.jooq.Schema (sources: JacksonProcessor > com.sumit.models.TestClass2, SmallRyeOpenApiProcessor > com.sumit.models.TestClass1)
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.
I got the point from where I am getting this warning from this code.
package com.sumit.models;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.immutables.value.Value;
import org.jooq.Catalog;
@Value.Immutable
@JsonDeserialize(as = ImmutableTestClass2.class)
public interface TestClass2 {
String name();
int value();
float quantity();
org.jooq.Schema another();
Catalog catalog();
}
In above code if you remove @JsonDeserialize(as = ImmutableTestClass2.class) warning will disapprear.
package com.sumit.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
@Schema(type = SchemaType.DEFAULT)
public record TestClass1 (
String name,
@JsonProperty(value = "schema_type")
org.jooq.Schema schemaType) {
}
In above code if you remove @Schema(type = SchemaType.DEFAULT) warning will disapprear.
this code is just a my attempt to reproduce the warning.
I have tried many thing like adding jandex, beans.xml, adding
quarkus.index-dependency.jooq1.group-id=org.jooq
quarkus.index-dependency.jooq1.artifact-id=jooq
in application.properties
Expected behavior
I would expect no warning in the log for Unable to properly register the hierarchy… … Jandex index:
Actual behavior
./gradlew clean build
Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- org.jooq.Catalog (source: JacksonProcessor > com.sumit.models.TestClass2)
- org.jooq.Schema (sources: JacksonProcessor > com.sumit.models.TestClass2, SmallRyeOpenApiProcessor > com.sumit.models.TestClass1)
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.
How to Reproduce?
To Reproduce Steps to reproduce the behavior:
git clone https://github.com/sumitchoudharycodes/reproduce-quarkus-jandex-warnings.git
./gradlew quarkusDev or ./gradlew clean build
Output of uname -a or ver
Linux a-18r489e3kansl 4.14.276-211.499.amzn2.x86_64 #1 SMP Wed Apr 27 21:08:48 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version “17.0.3” 2022-04-19 LTS OpenJDK Runtime Environment Corretto-17.0.3.6.1 (build 17.0.3+6-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.3.6.1 (build 17.0.3+6-LTS, mixed mode, sharing)
GraalVM version (if different from Java)
not using
Quarkus version or git rev
2.9.2.Final
Build tool (ie. output of mvnw --version or gradlew --version)
Gradle 7.4.2
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (10 by maintainers)
Thank you, @Sanne @geoand for having look into this. I got the problem on my actual proeject, actually I am using jooq generated class classes directly into my model’s. and this jooq generted classes have
SchemaandCatalogin their parent class as return type of some methods. removing them seems to solve these issue.Ok I looked at this better:
the converters are automatically generated by the library
org.immutables:value; I’m wondering if the JacksonProcessor could benefit from an easy oob integration with it, but that’s an entire new feature request to evaluate.it’s also probably a bad idea to expose the
SchemaandCalaogclasses from jooq directly on your API - don’t do that and your problems would be solved @sumitchoudharycodes 😃 It’s always better to be in control of how exactly you want your output mapped.so yes I agree with closing this issue.
The r2dbc warnings would go away if you index that library as well.
We probably could provide a configuration knob to disable all such warnings… I’m +0 on that. @gsmet WDYT?