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

PreferredConstructorDiscoverer attempts constructor discovery on synthetic Kotlin class [DATACMNS-1171] #1613

Closed
spring-projects-issues opened this issue Sep 19, 2017 · 10 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Sep 19, 2017

Gleb Klochkov opened DATACMNS-1171 and commented

Hi! I have Spring-boot service on Kotlin with Neo4j. It works fine with 5.0.0.RC3.
After i change my spring-boot version on 2.0.0.M4 i have exception on start:

2017-09-19 16:00:22.097 ERROR 17965 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '/auth' defined in file [/home/gleb/myown/kBackup/commander/out/production/classes/org/javatechs/kbackup/commander/service/menu/security/AuthApiController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nodeUserDetailsService' defined in file [/home/gleb/myown/kBackup/commander/out/production/classes/org/javatechs/kbackup/commander/service/security/NodeUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepo2': Cannot resolve reference to bean 'neo4jMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jMappingContext': Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: This class is an internal synthetic class generated by the Kotlin compiler, such as an anonymous class for a lambda, a SAM wrapper, a callable reference, etc. It's not a Kotlin class or interface, so the reflection library has no idea what declarations does it have. Please use Java reflection to inspect this class: class org.javatechs.kbackup.commander.util.jmx.JmxIniter$crerateUser$u$1
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:745) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:214) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1269) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1126) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:122) ~[spring-boot-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
    at org.javatechs.kbackup.commander.BackendApplicationKt.main(BackendApplication.kt:24) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.0.BUILD-SNAPSHOT.jar:2.0.0.BUILD-SNAPSHOT]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nodeUserDetailsService' defined in file [/home/gleb/myown/kBackup/commander/out/production/classes/org/javatechs/kbackup/commander/service/security/NodeUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepo2': Cannot resolve reference to bean 'neo4jMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jMappingContext': Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: This class is an internal synthetic class generated by the Kotlin compiler, such as an anonymous class for a lambda, a SAM wrapper, a callable reference, etc. It's not a Kotlin class or interface, so the reflection library has no idea what declarations does it have. Please use Java reflection to inspect this class: class org.javatechs.kbackup.commander.util.jmx.JmxIniter$crerateUser$u$1
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:745) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:214) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1269) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1126) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:275) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1133) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1060) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:832) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:737) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    ... 24 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepo2': Cannot resolve reference to bean 'neo4jMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jMappingContext': Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: This class is an internal synthetic class generated by the Kotlin compiler, such as an anonymous class for a lambda, a SAM wrapper, a callable reference, etc. It's not a Kotlin class or interface, so the reflection library has no idea what declarations does it have. Please use Java reflection to inspect this class: class org.javatechs.kbackup.commander.util.jmx.JmxIniter$crerateUser$u$1
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:378) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1607) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:275) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1133) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1060) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:832) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:737) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    ... 38 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jMappingContext': Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: This class is an internal synthetic class generated by the Kotlin compiler, such as an anonymous class for a lambda, a SAM wrapper, a callable reference, etc. It's not a Kotlin class or interface, so the reflection library has no idea what declarations does it have. Please use Java reflection to inspect this class: class org.javatechs.kbackup.commander.util.jmx.JmxIniter$crerateUser$u$1
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:367) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    ... 52 common frames omitted
Caused by: java.lang.UnsupportedOperationException: This class is an internal synthetic class generated by the Kotlin compiler, such as an anonymous class for a lambda, a SAM wrapper, a callable reference, etc. It's not a Kotlin class or interface, so the reflection library has no idea what declarations does it have. Please use Java reflection to inspect this class: class org.javatechs.kbackup.commander.util.jmx.JmxIniter$crerateUser$u$1
    at kotlin.reflect.jvm.internal.KClassImpl.reportUnresolvedClass(KClassImpl.kt:289) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl.access$reportUnresolvedClass(KClassImpl.kt:42) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:52) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:43) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl$Data.getDescriptor(KClassImpl.kt) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl.getDescriptor(KClassImpl.kt:172) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl.getConstructorDescriptors(KClassImpl.kt:186) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl$Data$constructors$2.invoke(KClassImpl.kt:90) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl$Data$constructors$2.invoke(KClassImpl.kt:43) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl$Data.getConstructors(KClassImpl.kt) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.internal.KClassImpl.getConstructors(KClassImpl.kt:222) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at kotlin.reflect.jvm.ReflectJvmMapping.getKotlinFunction(ReflectJvmMapping.kt:149) ~[kotlin-reflect-1.1.4-3.jar:1.1.4-3]
    at org.springframework.core.KotlinReflectionParameterNameDiscoverer.getParameterNames(KotlinReflectionParameterNameDiscoverer.java:75) ~[spring-core-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.core.PrioritizedParameterNameDiscoverer.getParameterNames(PrioritizedParameterNameDiscoverer.java:67) ~[spring-core-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers.buildPreferredConstructor(PreferredConstructorDiscoverer.java:209) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers.access$200(PreferredConstructorDiscoverer.java:89) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers$2.lambda$discover$0(PreferredConstructorDiscoverer.java:161) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_144]
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) ~[na:1.8.0_144]
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_144]
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_144]
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[na:1.8.0_144]
    at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers$2.discover(PreferredConstructorDiscoverer.java:164) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.mapping.model.PreferredConstructorDiscoverer.discover(PreferredConstructorDiscoverer.java:77) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.<init>(BasicPersistentEntity.java:93) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.<init>(BasicPersistentEntity.java:74) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.neo4j.mapping.Neo4jPersistentEntity.<init>(Neo4jPersistentEntity.java:56) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at org.springframework.data.neo4j.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:64) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at org.springframework.data.neo4j.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:44) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:376) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:343) ~[spring-data-commons-2.0.0.RC3.jar:na]
    at org.springframework.data.neo4j.mapping.Neo4jMappingContext.lambda$new$1(Neo4jMappingContext.java:57) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:1.8.0_144]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[na:1.8.0_144]
    at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1620) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_144]
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:1.8.0_144]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:1.8.0_144]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_144]
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[na:1.8.0_144]
    at org.springframework.data.neo4j.mapping.Neo4jMappingContext.<init>(Neo4jMappingContext.java:57) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at org.springframework.data.neo4j.repository.config.Neo4jMappingContextFactoryBean.createInstance(Neo4jMappingContextFactoryBean.java:62) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at org.springframework.data.neo4j.repository.config.Neo4jMappingContextFactoryBean.createInstance(Neo4jMappingContextFactoryBean.java:31) ~[spring-data-neo4j-5.0.0.RC3.jar:na]
    at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:141) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698) ~[spring-beans-5.0.0.RC4.jar:5.0.0.RC4]
    ... 59 common frames omitted

Affects: 2.0 RC3 (Kay)

Reference URL: spring-projects/spring-boot#10341

Issue Links:

  • DATAGRAPH-1030 Avoid unconditional registration of entities in Neo4jMappingContext from all scanned classes

  • SPR-15999 Support non-standard classes in Kotlin reflection discovery methods

Referenced from: pull request #245

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 19, 2017

Sébastien Deleuze commented

Gleb Klochkov Could you please provide a repro project on a HitHub repo or attached to this issue?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 19, 2017

Gleb Klochkov commented

@Sébastien Deleuze i made simple project with another, but similar exception

Caused by: java.lang.UnsupportedOperationException: Packages and file facades are not yet supported in Kotlin reflection. Meanwhile please use Java reflection to inspect this class: class org.javatechs.errorproject.backend.BackendApplicationKt

https://github.com/glebiuskv/errorproject

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 19, 2017

Sébastien Deleuze commented

Thanks I will have a look shortly

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 22, 2017

Sébastien Deleuze commented

I move this issue to Spring Data Commons since the repro project shows that the stack trace come from that part. I am going to create another issue for Spring Framework side where we should be more defensive too when calling ReflectJvmMapping.getKotlinFunction

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 22, 2017

Mark Paluch commented

The issue is caused because a synthetic Kotlin class is considered to be an entity. Because it's a Kotlin class, we attempt various, Kotlin-specific resolutions. The stack trace ends right now inside Spring Frameworks' Kotlin ParameterNameResolver. If the name resolution would pass, the next failure would happen inside of Spring Data's preferred constructor discoverer.

I think we should not allow synthetic Kotlin classes to be considered an entity and only accept regular classes (KotlinClassHeader.Kind.CLASS) if it's a Kotlin class to prevent subsequent errors that might arise from the various class types Kotlin is able to generate

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 24, 2017

Sébastien Deleuze commented

The Spring Framework errors should be fixed in latest snapshots via SPR-15999, please let me know if you see remaining ones

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 25, 2017

Gleb Klochkov commented

@Sébastien Deleuze No. Running test Project with springframework 5.0.0.BUILD-SNAPSHOT in deps still produce the same error

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 25, 2017

Oliver Drotbohm commented

The necessary tweaks in Spring Data are now in place as well. Feel free to give the snapshots a try

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 25, 2017

Mark Paluch commented

There's another issue caused by anonymous inner classes where Kotlin has an issue with the appropriate constructor resolution. I filed a ticket KT-20442 in Kotlin's issue tracker.

For now, please apply @EntityScan(…) with the appropriate base packages to scan only for entity classes. Otherwise, all classes (config-classes, services, …) are inspected for their entity structure and will lead to the mentioned exception

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 26, 2017

Gleb Klochkov commented

Ok. It works fine with @EntityScan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants