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

Native executable run fails with Error creating bean with name 'couchbaseClusterEnvironment' #1892

Closed
korkutkose opened this issue Jan 8, 2024 · 7 comments
Labels
status: feedback-provided Feedback has been provided

Comments

@korkutkose
Copy link

A successfully built artifact with the latest spring boot and spring-data-couchbase versions have been failing on runtime.
I sure know that we need to register a few reflections in order to make it work but should we? I mean the question is that is spring-data-couchbase fully spring-native supported or some reflections have to be generated?

couchbase-demo's runtime fails branch can be used to replicate this issue.

 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.1)

2024-01-08T16:51:55.012+03:00  INFO 31883 --- [           main] [                                                 ] c.k.c.CouchbaseDemoApplication           : Starting AOT-processed CouchbaseDemoApplication using Java 21.0.1 with PID 31883 (/Users/mehmetkorkut/development/couchbase-demo/target/couchbase-demo started by mehmetkorkut in /Users/mehmetkorkut/development/couchbase-demo)
2024-01-08T16:51:55.012+03:00  INFO 31883 --- [           main] [                                                 ] c.k.c.CouchbaseDemoApplication           : No active profile set, falling back to 1 default profile: "default"
2024-01-08T16:51:55.015+03:00  WARN 31883 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'couchbaseConfig' of type [com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [transactionInterceptorCustomizer]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-01-08T16:51:55.021+03:00  WARN 31883 --- [           main] [                                                 ] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptorCustomizer': Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Unsatisfied dependency expressed through method 'transactionAdvisor' parameter 1: Error creating bean with name 'transactionInterceptor': Error creating bean with name 'couchbaseTransactionManager': Unsatisfied dependency expressed through method 'couchbaseTransactionManager' parameter 0: Error creating bean with name 'couchbaseClientFactory': Unsatisfied dependency expressed through method 'couchbaseClientFactory' parameter 0: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
2024-01-08T16:51:55.021+03:00 ERROR 31883 --- [           main] [                                                 ] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptorCustomizer': Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Unsatisfied dependency expressed through method 'transactionAdvisor' parameter 1: Error creating bean with name 'transactionInterceptor': Error creating bean with name 'couchbaseTransactionManager': Unsatisfied dependency expressed through method 'couchbaseTransactionManager' parameter 0: Error creating bean with name 'couchbaseClientFactory': Unsatisfied dependency expressed through method 'couchbaseClientFactory' parameter 0: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:606) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[couchbase-demo:6.1.2]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:277) ~[na:na]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:806) ~[couchbase-demo:6.1.2]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:609) ~[couchbase-demo:6.1.2]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[couchbase-demo:3.2.1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) ~[couchbase-demo:3.2.1]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:464) ~[couchbase-demo:3.2.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[couchbase-demo:3.2.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1358) ~[couchbase-demo:3.2.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1347) ~[couchbase-demo:3.2.1]
	at com.korkutkose.couchbasedemo.CouchbaseDemoApplication.main(CouchbaseDemoApplication.java:13) ~[couchbase-demo:na]
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ~[na:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Unsatisfied dependency expressed through method 'transactionAdvisor' parameter 1: Error creating bean with name 'transactionInterceptor': Error creating bean with name 'couchbaseTransactionManager': Unsatisfied dependency expressed through method 'couchbaseTransactionManager' parameter 0: Error creating bean with name 'couchbaseClientFactory': Unsatisfied dependency expressed through method 'couchbaseClientFactory' parameter 0: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:344) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:264) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:204) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1216) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[couchbase-demo:6.1.2]
	at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[couchbase-demo:6.1.2]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:111) ~[couchbase-demo:6.1.2]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:96) ~[couchbase-demo:6.1.2]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:78) ~[couchbase-demo:6.1.2]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:366) ~[couchbase-demo:6.1.2]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:318) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:437) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1776) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[couchbase-demo:6.1.2]
	... 16 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptor': Error creating bean with name 'couchbaseTransactionManager': Unsatisfied dependency expressed through method 'couchbaseTransactionManager' parameter 0: Error creating bean with name 'couchbaseClientFactory': Unsatisfied dependency expressed through method 'couchbaseClientFactory' parameter 0: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:606) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911) ~[na:na]
	at org.springframework.beans.factory.support.RegisteredBean.resolveAutowiredArgument(RegisteredBean.java:229) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:341) ~[na:na]
	... 36 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couchbaseTransactionManager': Unsatisfied dependency expressed through method 'couchbaseTransactionManager' parameter 0: Error creating bean with name 'couchbaseClientFactory': Unsatisfied dependency expressed through method 'couchbaseClientFactory' parameter 0: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:344) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:264) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:204) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1216) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getObject(DefaultListableBeanFactory.java:2070) ~[na:na]
	at org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration$1.postProcessBeforeInitialization(AbstractCouchbaseConfiguration.java:393) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:421) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1765) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[couchbase-demo:6.1.2]
	... 47 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couchbaseClientFactory': Unsatisfied dependency expressed through method 'couchbaseClientFactory' parameter 0: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:344) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:264) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:204) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1216) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911) ~[na:na]
	at org.springframework.beans.factory.support.RegisteredBean.resolveAutowiredArgument(RegisteredBean.java:229) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:341) ~[na:na]
	... 65 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couchbaseCluster': Unsatisfied dependency expressed through method 'couchbaseCluster' parameter 0: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:344) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:264) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:204) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1216) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911) ~[na:na]
	at org.springframework.beans.factory.support.RegisteredBean.resolveAutowiredArgument(RegisteredBean.java:229) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:341) ~[na:na]
	... 82 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'couchbaseClusterEnvironment': Instantiation of supplied bean failed
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1222) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911) ~[na:na]
	at org.springframework.beans.factory.support.RegisteredBean.resolveAutowiredArgument(RegisteredBean.java:229) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:341) ~[na:na]
	... 99 common frames omitted
Caused by: com.couchbase.client.core.error.CouchbaseException: non-shadowed Jackson not present
	at org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration.couchbaseClusterEnvironment(AbstractCouchbaseConfiguration.java:175) ~[couchbase-demo:5.2.1]
	at com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$0.CGLIB$couchbaseClusterEnvironment$11(<generated>) ~[couchbase-demo:na]
	at com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[couchbase-demo:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[couchbase-demo:6.1.2]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[na:na]
	at com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$0.couchbaseClusterEnvironment(<generated>) ~[couchbase-demo:na]
	at org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration__BeanDefinitions.lambda$getCouchbaseClusterEnvironmentInstanceSupplier$2(AbstractCouchbaseConfiguration__BeanDefinitions.java:75) ~[na:na]
	at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:63) ~[couchbase-demo:6.1.2]
	at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:51) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$withGenerator$0(BeanInstanceSupplier.java:171) ~[na:na]
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[couchbase-demo:6.1.2]
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:206) ~[na:na]
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[couchbase-demo:6.1.2]
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:218) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1216) ~[couchbase-demo:6.1.2]
	... 112 common frames omitted```
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 8, 2024
@korkutkose korkutkose changed the title Native executable run fails with non-shadowed Jackson not present Native executable run fails with Error creating bean with name 'couchbaseClusterEnvironment' Jan 8, 2024
@korkutkose
Copy link
Author

korkutkose commented Jan 8, 2024

Hi @mikereiche,
Thanks for the quick responses. That’s correct, when we comment it out we also can successfully build the artifact. That’s why I specifically mentioned “run fails” in subject.
However, when you run that artifact it throws the exception above (nothing is wrong for the java -jar command, issue only happens in native mode)
Do we need to do something extra to include jackson in runtime?
Yea my bad, forgot to fix that typo in main branch.

@mikereiche
Copy link
Collaborator

mikereiche commented Jan 8, 2024

Which JDK are you using? These are my current choices, and only 21.0.1 is accepted by mvnw (apparently), and it's not a graalVm. (even though it will run with ./mvnw native:compile -Pnative)

The downloads have GraalVM 21 and 22, but the highest JDK version they are for is 17. https://www.oracle.com/downloads/graalvm-downloads.html

%  /usr/libexec/java_home -V
Matching Java Virtual Machines (8):
    21.0.1 (x86_64) "Homebrew" - "OpenJDK 21.0.1" /usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home
    20.0.1 (x86_64) "Oracle Corporation" - "Oracle GraalVM 20.0.1+9.1" /Library/Java/JavaVirtualMachines/graalvm-jdk-20.0.1+9.1/Contents/Home
    20 (x86_64) "Oracle Corporation" - "Java SE 20" /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
    17.0.9 (x86_64) "Oracle Corporation" - "GraalVM EE 21.3.8" /Library/Java/JavaVirtualMachines/graalvm-ee-java17-21.3.8/Contents/Home
    17.0.1 (x86_64) "Oracle Corporation" - "Java SE 17.0.1" /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
    16 (x86_64) "Oracle Corporation" - "Java SE 16" /Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home
    11.0.20 (x86_64) "Homebrew" - "OpenJDK 11.0.20" /usr/local/Cellar/openjdk@11/11.0.20/libexec/openjdk.jdk/Contents/Home```
    
    ```
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project couchbase-demo: Fatal error compiling: error: release version 21 not supported 
    ```

@mikereiche
Copy link
Collaborator

mikereiche commented Jan 8, 2024

Was able to reproduce with the 20.0.1 that I have after changing the java.version in pom.xml from 21 to 20 <java.version>20</java.version>

 couchbase-demo % target/couchbase-demo

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.1)

2024-01-08T13:40:04.855-08:00  INFO 35143 --- [           main] [                                                 ] c.k.c.CouchbaseDemoApplication           : Starting AOT-processed CouchbaseDemoApplication using Java 20.0.1 with PID 35143 (/Users/michaelreiche/jackson/couchbase-demo/target/couchbase-demo started by michaelreiche in /Users/michaelreiche/jackson/couchbase-demo)
.
.
.
Caused by: com.couchbase.client.core.error.CouchbaseException: non-shadowed Jackson not present
	at org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration.couchbaseClusterEnvironment(AbstractCouchbaseConfiguration.java:175) ~[couchbase-demo:na]
	at com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$0.CGLIB$couchbaseClusterEnvironment$29(<generated>) ~[couchbase-demo:na]
	at com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[couchbase-demo:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[couchbase-demo:6.1.2]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[na:na]
	at com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$0.couchbaseClusterEnvironment(<generated>) ~[couchbase-demo:na]
	at org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration__BeanDefinitions.lambda$getCouchbaseClusterEnvironmentInstanceSupplier$2(AbstractCouchbaseConfiguration__BeanDefinitions.java:75) ~[na:na]
	at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:63) ~[couchbase-demo:6.1.2]
	at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:51) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$withGenerator$0(BeanInstanceSupplier.java:171) ~[na:na]
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[couchbase-demo:6.1.2]
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:206) ~[na:na]
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[couchbase-demo:6.1.2]
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:218) ~[na:na]
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[couchbase-demo:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1216) ~[couchbase-demo:6.1.2]
	... 111 common frames omitted


@mikereiche
Copy link
Collaborator

mikereiche commented Jan 8, 2024

@mikereiche
Copy link
Collaborator

mikereiche commented Jan 8, 2024

Ok - if you run this:

java -Dspring.aot.enabled=true -agentlib:native-image-agent=config-output-dir=. -jar target/couchbase-demo-0.0.1-SNAPSHOT.jar

And then copy the output:

cp *.json src/main/resources/META-INF/native-image

then build

./mvnw -Pnative clean native:compile

it will run without erroring out at that point. And even do the insert/get in my CommandRunner (CommandRunner: found document ...)

 target/couchbase-demo

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.1)

2024-01-08T15:38:12.533-08:00  INFO 39945 --- [           main] [                                                 ] c.k.c.CouchbaseDemoApplication           : Starting AOT-processed CouchbaseDemoApplication using Java 20.0.1 with PID 39945 (/Users/michaelreiche/jackson/couchbase-demo/target/couchbase-demo started by michaelreiche in /Users/michaelreiche/jackson/couchbase-demo)
2024-01-08T15:38:12.533-08:00  INFO 39945 --- [           main] [                                                 ] c.k.c.CouchbaseDemoApplication           : No active profile set, falling back to 1 default profile: "default"
2024-01-08T15:38:12.540-08:00  WARN 39945 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'couchbaseConfig' of type [com.korkutkose.couchbasedemo.configuration.CouchbaseConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [transactionInterceptorCustomizer]? Check the corresponding BeanPostProcessor declaration and its dependencies.
mapper is : class com.fasterxml.jackson.databind.ObjectMapper
generator: com.fasterxml.jackson.core.json.UTF8JsonGenerator@73d2a41b
value: com.couchbase.client.java.codec.JacksonJsonSerializer$PreflightCheckSubject@3764c3e7
result: [B@111e518e
2024-01-08T15:38:12.814-08:00  WARN 39945 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'couchbaseClusterEnvironment' of type [com.couchbase.client.java.env.ClusterEnvironment] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [transactionInterceptorCustomizer]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-01-08T15:38:12.847-08:00  WARN 39945 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'couchbaseCluster' of type [com.couchbase.client.java.Cluster] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [transactionInterceptorCustomizer]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-01-08T15:38:12.848-08:00  WARN 39945 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'couchbaseClientFactory' of type [org.springframework.data.couchbase.SimpleCouchbaseClientFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [transactionInterceptorCustomizer]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-01-08T15:38:12.848-08:00  WARN 39945 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'couchbaseTransactionManager' of type [org.springframework.data.couchbase.transaction.CouchbaseCallbackTransactionManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [transactionInterceptorCustomizer]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-01-08T15:38:12.868-08:00  INFO 39945 --- [           main] [                                                 ] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-01-08T15:38:12.868-08:00  INFO 39945 --- [           main] [                                                 ] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-01-08T15:38:12.868-08:00  INFO 39945 --- [           main] [                                                 ] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.17]
2024-01-08T15:38:12.873-08:00  INFO 39945 --- [           main] [                                                 ] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-01-08T15:38:12.873-08:00  INFO 39945 --- [           main] [                                                 ] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 340 ms
2024-01-08T15:38:12.933-08:00  INFO 39945 --- [      cb-events] [                                                 ] com.couchbase.core                       : [com.couchbase.core][DnsSrvLookupFailedEvent][26ms] DNS SRV lookup failed (name not found). This is expected if the there is no DNS SRV record associated with the hostname in the connection string. Will now try to bootstrap directly from the given hostname. To suppress this message, specify an IP address instead of a hostname (for example: 127.0.0.1 instead of localhost), specify more than one hostname, or set the `io.enableDnsSrv` client setting to false.
2024-01-08T15:38:12.934-08:00  INFO 39945 --- [      cb-events] [                                                 ] com.couchbase.core                       : [com.couchbase.core][CoreCreatedEvent] {"clientVersion":"3.4.11","clientGitHash":"${buildNumber}","coreVersion":"2.4.11","coreGitHash":"${buildNumber}","userAgent":"couchbase-java/3.4.11 (Mac OS X 13.3.1 amd64; Substrate VM 20.0.1+9-jvmci-23.0-b12)","maxNumRequestsInRetry":32768,"ioEnvironment":{"nativeIoEnabled":true,"eventLoopThreadCount":6,"eventLoopGroups":["KQueueEventLoopGroup"]},"ioConfig":{"captureTraffic":[],"mutationTokensEnabled":true,"networkResolution":"auto","dnsSrvEnabled":true,"tcpKeepAlivesEnabled":true,"tcpKeepAliveTimeMs":60000,"configPollIntervalMs":2500,"kvCircuitBreakerConfig":"disabled","queryCircuitBreakerConfig":"disabled","viewCircuitBreakerConfig":"disabled","searchCircuitBreakerConfig":"disabled","analyticsCircuitBreakerConfig":"disabled","managerCircuitBreakerConfig":"disabled","eventingCircuitBreakerConfig":"disabled","backupCircuitBreakerConfig":"disabled","numKvConnections":1,"maxHttpConnections":12,"idleHttpConnectionTimeoutMs":1000,"configIdleRedialTimeoutMs":300000,"memcachedHashingStrategy":"StandardMemcachedHashingStrategy"},"compressionConfig":{"enabled":true,"minRatio":0.83,"minSize":32},"securityConfig":{"tlsEnabled":false,"nativeTlsEnabled":true,"hostnameVerificationEnabled":true,"trustCertificates":null,"trustManagerFactory":null,"ciphers":[]},"timeoutConfig":{"kvMs":2500,"kvDurableMs":10000,"kvScanMs":75000,"managementMs":75000,"queryMs":75000,"viewMs":75000,"searchMs":75000,"analyticsMs":75000,"connectMs":10000,"disconnectMs":10000,"eventingMs":75000,"backupMs":75000},"loggerConfig":{"customLogger":null,"fallbackToConsole":false,"consoleLogLevel":{"name":"INFO","resourceBundleName":"sun.util.logging.resources.logging","localizedName":"INFO"},"consoleLoggerFormatter":"DefaultLoggerFormatter","disableSlf4j":false,"loggerName":"CouchbaseLogger","diagnosticContextEnabled":false},"orphanReporterConfig":{"emitIntervalMs":10000,"sampleSize":10,"queueLength":1024,"enabled":true},"thresholdLoggingTracerConfig":{"enabled":true,"emitIntervalMs":10000,"sampleSize":10,"queueLength":1024,"kvThresholdMs":500,"queryThresholdMs":1000,"searchThresholdMs":1000,"analyticsThresholdMs":1000,"viewThresholdMs":1000,"transactionsThresholdMs":5000},"loggingMeterConfig":{"enabled":true,"emitIntervalMs":600000},"retryStrategy":"BestEffortRetryStrategy","requestTracer":"ThresholdLoggingTracer","meter":"LoggingMeter","numRequestCallbacks":0,"scheduler":"ParallelScheduler","schedulerThreadCount":12,"transactionsConfig":{"durabilityLevel":"MAJORITY","timeoutMs":15000,"cleanupConfig":{"runLostAttemptsCleanupThread":true,"runRegularAttemptsCleanupThread":true,"cleanupWindowMs":60000,"cleanupSet":""},"numAtrs":1024,"metadataCollection":"none","scanConsistency":"none"}} {"connectionString":"couchbase://localhost","coreId":"0x45504ae00000001","numCoreInstances":1,"seedNodes":[{"address":"localhost"}]}
2024-01-08T15:38:12.935-08:00  INFO 39945 --- [      cb-events] [                                                 ] com.couchbase.transactions               : [com.couchbase.transactions][TransactionsStartedEvent] Transactions successfully initialised, regular cleanup enabled=true, lost cleanup enabled=true
2024-01-08T15:38:12.935-08:00  INFO 39945 --- [      cb-events] [                                                 ] com.couchbase.node                       : [com.couchbase.node][NodeCreatedEvent] Node created {"coreId":"0x45504ae00000001","managerPort":"8091","remote":"localhost"}
2024-01-08T15:38:12.938-08:00  INFO 39945 --- [           main] [                                                 ] .i.s.PathMatchingResourcePatternResolver : Skipping search for files matching pattern [**/*.class]: directory [/com/korkutkose/couchbasedemo/persistence] does not exist
2024-01-08T15:38:12.988-08:00  INFO 39945 --- [           main] [                                                 ] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2024-01-08T15:38:12.994-08:00  INFO 39945 --- [           main] [                                                 ] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path ''
2024-01-08T15:38:12.994-08:00  INFO 39945 --- [           main] [                                                 ] c.k.c.CouchbaseDemoApplication           : Started CouchbaseDemoApplication in 0.476 seconds (process running for 0.485)
2024-01-08T15:38:12.996-08:00  INFO 39945 --- [           main] [                                                 ] c.k.c.controller.CommandRunner           : runner
2024-01-08T15:38:12.998-08:00  INFO 39945 --- [           main] [                                                 ] c.k.c.controller.CommandRunner           : CommandRunner: found document with id: {id:1,seasonSnapshotId:null,day:null}
2024-01-08T15:38:13.039-08:00  INFO 39945 --- [      cb-events] [                                                 ] com.couchbase.core                       : [com.couchbase.core][BucketOpenedEvent][97ms] Opened bucket "my_bucket" {"coreId":"0x45504ae00000001"}
package com.korkutkose.couchbasedemo.controller;

import com.korkutkose.couchbasedemo.persistence.DemoDocument;
import com.korkutkose.couchbasedemo.persistence.DocumentRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class CommandRunner implements CommandLineRunner {

  private static final Logger logger = LoggerFactory.getLogger(CommandRunner.class);
  private final DocumentRepository repository;

  public CommandRunner(DocumentRepository repository) {
    this.repository = repository;
  }

  @Override
  public void run(String...args) throws Exception {
    logger.info("runner");

    DemoDocument doc = new DemoDocument();
    doc.setId("1");
    this.repository.save(doc);

    final var sampleDocument = this.repository
      .findById(doc.getId());

    logger.info("CommandRunner: found document with id: "+ sampleDocument.get());

    if (sampleDocument.isPresent()) {
      // cleanup for next run
      this.repository.deleteById(sampleDocument.get().getId());
    }
  }
}

@korkutkose
Copy link
Author

korkutkose commented Jan 9, 2024

Hi @mikereiche,
Sorry for the delay, timezone issues :) So yeah, I just noticed that I haven't provided enough information for the sake of this ticket about the environments we have.
I was on GraalVM 21.0.1 (with latest spring boot dependencies) and another colleague of mine was on GraalVM 17.0.8 (with spring boot 3.0.9). We both tried to build a GraalVM native executable with the help of native-maven-plugin and hit the same wall on different projects.

I've just updated my sample with the Dockerfile, so that we would definitely have the same environments for both building and running the sample. If you wanna build, do not forget to give some juice to your docker desktop since native builds are resource hoarders.

After created this ticket, I had run the native tracing agent and generated bunch of reflections already. But to be frank, I haven't had to generate any reflections for a managed dependency up until now. That's why I had to open to this ticket and ask if this library is fully spring-native compatible or not.

It's totally fine generating additional reflections but maybe we can add this in a doc or something for feature references. WDYT?

Thanks again for all your efforts,
Cheers.

<plugin>
  <groupId>org.graalvm.buildtools</groupId>
  <artifactId>native-maven-plugin</artifactId>
</plugin>
java -version                                                                                                                                                                           ─╯
java version "21.0.1" 2023-10-17
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)
./mvnw -version                                                                                                                                                                         ─╯
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: /Users/mehmetkorkut/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5
Java version: 21.0.1, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/graalvm-jdk-21.0.1+12.1/Contents/Home
Default locale: en_TR, platform encoding: UTF-8
OS name: "mac os x", version: "14.2.1", arch: "aarch64", family: "mac"

@mikereiche
Copy link
Collaborator

mikereiche commented Jan 9, 2024

I mean the question is that is spring-data-couchbase fully spring-native supported or some reflections have to be generated?
After created this ticket, I had run the native tracing agent and generated bunch of reflections already.

As you determined, it doesn't work without adding reflections and it does work with adding reflections.

It's totally fine generating additional reflections but maybe we can add this in a doc or something for feature references.

We could say something like - "For using GraalVM Native Images with Spring Boot refer to Spring Boot GraalVM Native Image Support". But given that the Couchbase Java SDK is not supported for GraalVM Native Images, I don't want to send developers down that path.

@mikereiche mikereiche added status: feedback-provided Feedback has been provided and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants