I start of by this guide: https://guides.micronaut.io/micronaut-function-graalvm-aws-lambda-gateway/guide/index.html Which works and creates an API deployable in a local SAM instance.
In my real project I need access to JPA, database so I add the reference in the build.gradle:
compile group: 'com.oracle.ojdbc', name: 'ojdbc8', version: '19.3.0.0'
implementation("io.micronaut.configuration:micronaut-jdbc-hikari")
implementation( "io.micronaut.data:micronaut-data-hibernate-jpa:1.0.0.M5")
annotationProcessor("io.micronaut.data:micronaut-data-processor:1.0.0.M5")
Add also the TypeHint required for CRUD and the reflection-info required for ojdbc; https://github.com/oracle/graal/issues/1748#issuecomment-542353582 https://micronaut-projects.github.io/micronaut-data/latest/guide/#graalJPA
At the write stage of the graal build I get these errors:
error: Classes that should be initialized at run time got initialized during image building:
org.jboss.logging.Logger was unintentionally initialized at build time ...
org.hibernate.internal.CoreMessageLogger_$logger was unintentionally initialized at build time...
and so on with multiple loggers that Hibernate tries to instantiate.
This is an example, the same error occurs in a my real project where I have the connection to the database and CRUD implemented. In the example, to reproduce, I have not added those.