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

[spring-boot-starter-jooq] Jooq doen't work properly with spring boot 3.0.0 native #33552

Closed
ceyhunn opened this issue Dec 20, 2022 · 2 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@ceyhunn
Copy link

ceyhunn commented Dec 20, 2022

Hi,
I successfully build and run spring boot native app, but I can't fetch data with jooq from postgresql. It shows following error:


java.lang.NullPointerException: null
        at org.jooq.impl.DefaultBinding.binding(DefaultBinding.java:471) 
        at org.jooq.impl.DefaultBinding.binding(DefaultBinding.java:315)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:387)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:335)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:331)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:319)
        at org.jooq.impl.ArrayDataType.<init>(ArrayDataType.java:63)
        at org.jooq.impl.AbstractDataType.getArrayDataType(AbstractDataType.java:611)
        at org.jooq.impl.DefaultDataType.getArrayDataType(DefaultDataType.java:136)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:392)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:335) 
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:331)
        at org.jooq.impl.DefaultDataType.<init>(DefaultDataType.java:315)
        at org.jooq.impl.BuiltInDataType.<init>(BuiltInDataType.java:60)
        at org.jooq.impl.SQLDataType.<clinit>(SQLDataType.java:316)
        at com.example.is.jooq.tables....
        at com.example.is.jooq.tables....
        at com.example.is.jooq.tables....
        at com.example.is.jooq.tables....
        at java.base@17.0.5/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) 
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) 
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) 
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) 
......
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 20, 2022
@philwebb
Copy link
Member

We have an open issue to add a smoke test to ensure jOOQ works but it looks like it will require additional hints.

There's an open ticket on the jOOQ issue tracker about supporting GraalVM and there's also the option of contributing graalvm-reachability-metadata which Spring Boot could use.

In short, I think this is a jOOQ or graalvm-reachability-metadata issue and not something we can fix directly in Spring Boot.

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2022
@philwebb philwebb added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 20, 2022
@NicklasWallgren
Copy link

NicklasWallgren commented Jan 13, 2023

For anyone looking for a quick fix, until support has been added to graalvm-reachability-metadata.

@Configuration
@ImportRuntimeHints(ThirdPartyHintsRegistrar.class)
public class NativeImageRuntimeHintsConfiguration {

    static class ThirdPartyHintsRegistrar implements RuntimeHintsRegistrar {
        @Override
        public void registerHints(final RuntimeHints hints, final ClassLoader classLoader) {
            // Temporary hints which should be included into the libraries, or https://github.com/oracle/graalvm-reachability-metadata
            
            List.of(
                "java.time.LocalDate[]",
                "java.time.LocalDateTime[]",
                "java.time.LocalTime[]",
                "java.time.ZonedDateTime[]",
                "java.time.OffsetDateTime[]",
                "java.time.OffsetTime[]",
                "java.time.Instant[]",
                "java.sql.Timestamp[]",
                "java.sql.Date[]",
                "java.sql.Time[]",
                "java.math.BigInteger[]",
                "java.math.BigDecimal[]",
                "org.jooq.types.UNumber[]",
                "org.jooq.types.UByte[]",
                "org.jooq.types.UInteger[]",
                "org.jooq.types.ULong[]",
                "org.jooq.types.Unsigned[]",
                "org.jooq.types.UShort[]",
                "java.lang.Byte[]",
                "java.lang.Integer[]",
                "java.lang.Long[]",
                "java.lang.Float[]",
                "java.lang.Double[]",
                "java.lang.String[]",
                "org.jooq.types.YearToMonth[]",
                "org.jooq.types.YearToSecond[]",
                "org.jooq.types.DayToSecond[]",
                "org.jooq.RowId[]",
                "org.jooq.Result[]",
                "org.jooq.Record[]",
                "org.jooq.JSON[]",
                "org.jooq.JSONB[]",
                "org.jooq.XML[]",
                "org.jooq.Geography[]",
                "org.jooq.Geometry[]",
                "java.util.UUID[]",
                "byte[]",
                "org.jooq.impl.SQLDataType",
                "org.jooq.util.cubrid.CUBRIDDataType",
                "org.jooq.util.derby.DerbyDataType",
                "org.jooq.util.firebird.FirebirdDataType",
                "org.jooq.util.h2.H2DataType",
                "org.jooq.util.hsqldb.HSQLDBDataType",
                "org.jooq.util.ignite.IgniteDataType",
                "org.jooq.util.mariadb.MariaDBDataType",
                "org.jooq.util.mysql.MySQLDataType",
                "org.jooq.util.postgres.PostgresDataType",
                "org.jooq.util.sqlite.SQLiteDataType",
                "org.jooq.util.oracle.OracleDataType",
                "org.jooq.util.sqlserver.SQLServerDataType",
                "org.jooq.impl.DefaultBinding$Mdsys",
                "org.jooq.impl.DefaultBinding$SdoElemInfoArray",
                "org.jooq.impl.DefaultBinding$SdoOrdinateArray",
                "org.jooq.impl.DefaultBinding$SdoGeometry",
                "org.jooq.impl.DefaultBinding$SdoGeometryRecord",
                "org.jooq.impl.DefaultBinding$SdoPointType",
                "org.jooq.impl.DefaultBinding$SdoPointTypeRecord"
            ).forEach(it -> {
                hints.reflection().registerType(TypeReference.of(it), MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
            });
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

4 participants