Re: Graal (Native Image) with Cayenne

Andrus Adamchik <[email protected]> Wed, 5 Apr 2023 10:31:01 +0200
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi Andrew,

I don't have first-hand experience, but Cayenne was reported to work with GraalVM. E.g.: https://lists.apache.org/[email protected]:2023-1:graalvm

Andrus


> On Apr 5, 2023, at 10:26 AM, Andrew Lindesay <[email protected]> wrote:
> 
> Hello;
> 
> Has anybody here experimented with running an application using Cayenne with the GraalVM "native image" compiler?  The resultant executable seems to be having a problem with the DI system at run time; probably because there's some reflection going on in there -- seems likely.  Is there any documentation / guidance about how to start the `ServerRuntime` without the DI mechanism?
> 
> Caused by: org.apache.cayenne.di.DIRuntimeException: No applicable constructor is found for constructor injection in class 'org.apache.cayenne.log.Slf4jJdbcEventLogger'
> 	at org.apache.cayenne.di.spi.ConstructorInjectingProvider.initConstructor(ConstructorInjectingProvider.java:103) ~[na:na]
> 	at org.apache.cayenne.di.spi.ConstructorInjectingProvider.<init>(ConstructorInjectingProvider.java:42) ~[na:na]
> 	at org.apache.cayenne.di.spi.DefaultBindingBuilder.to(DefaultBindingBuilder.java:44) ~[na:na]
> 	at org.apache.cayenne.configuration.server.ServerModule.configure(ServerModule.java:349) ~[na:na]
> 	at org.apache.cayenne.di.spi.DefaultInjector.<init>(DefaultInjector.java:68) ~[na:na]
> 	at org.apache.cayenne.di.DIBootstrap.createInjector(DIBootstrap.java:38) ~[na:na]
> 	at org.apache.cayenne.di.DIBootstrap.createInjector(DIBootstrap.java:46) ~[na:na]
> 	at org.apache.cayenne.configuration.CayenneRuntime.<init>(CayenneRuntime.java:79) ~[haikudepotserver-webapp:4.1.1]
> 	at org.apache.cayenne.configuration.server.ServerRuntime.<init>(ServerRuntime.java:75) ~[haikudepotserver-webapp:4.1.1]
> 	at org.apache.cayenne.configuration.server.ServerRuntimeBuilder.build(ServerRuntimeBuilder.java:207) ~[na:na]
> 
> Regards.
> 
> -- 
> Andrew Lindesay