Раширение Сущности ( аннотация @ReplaceEntity )

При расширении JPA-сущности с использованием аннотации @ReplaceEntity при старте приложения возникает ошибка инициализации бина ‘core_ExtendedEntities’ вызванной невозможностью приведения классовcom.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader ‘app’).
Классы:
– исходный–
@JmixEntity
@Table(name = “com_WORK_GROUP”)
@Entity(name = “icom_WorkGroup”)
public class WorkGroup extends StandardEntity {…}

– расширенный–
@JmixEntity
@Entity
@ReplaceEntity(WorkGroup.class)
public class WorkGroupExt extends WorkGroup {…}

Прошу помочь в решении проблемы.

stackTrace:

	... 99 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MetadataTools': Unsatisfied dependency expressed through field 'extendedEntities'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a.botia/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.22.jar:5.3.22]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ui_RememberMeAuthenticationLocaleResolver': Unsatisfied dependency expressed through field 'messageTools'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MessageTools': Unsatisfied dependency expressed through field 'metadata'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_Metadata': Unsatisfied dependency expressed through field 'tools'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MetadataTools': Unsatisfied dependency expressed through field 'extendedEntities'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a.botia/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')

	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.22.jar:5.3.22]
	... 113 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a.botia/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:315) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:296) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.22.jar:5.3.22]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MessageTools': Unsatisfied dependency expressed through field 'metadata'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_Metadata': Unsatisfied dependency expressed through field 'tools'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MetadataTools': Unsatisfied dependency expressed through field 'extendedEntities'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a.botia/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')

	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.22.jar:5.3.22]
	... 127 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.3.22.jar:5.3.22]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:311) ~[spring-beans-5.3.22.jar:5.3.22]
	... 140 common frames omitted
Caused by: java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')
	at io.jmix.core.ExtendedEntities.replaceExtendedMetaClasses(ExtendedEntities.java:99) ~[jmix-core-1.3.3.jar:na]
	at io.jmix.core.ExtendedEntities.<init>(ExtendedEntities.java:54) ~[jmix-core-1.3.3.jar:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na]
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.22.jar:5.3.22]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_Metadata': Unsatisfied dependency expressed through field 'tools'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MetadataTools': Unsatisfied dependency expressed through field 'extendedEntities'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a.botia/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')

	... 142 common frames omitted

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cuba_MetadataTools': Unsatisfied dependency expressed through field 'extendedEntities'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a./.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'core_ExtendedEntities' defined in URL [jar:file:/C:/Users/a.botia/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.3.3/2e10602c0fdc0edb6df52a02e1b3828965916cae/jmix-core-1.3.3.jar!/io/jmix/core/ExtendedEntities.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.ExtendedEntities]: Constructor threw exception; nested exception is java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')

Caused by: java.lang.ClassCastException: class com.haulmont.chile.core.model.impl.CubaSession cannot be cast to class io.jmix.core.metamodel.model.impl.SessionImpl (com.haulmont.chile.core.model.impl.CubaSession and io.jmix.core.metamodel.model.impl.SessionImpl are in unnamed module of loader 'app')


> Task :bootRun FAILED

Добрый день!

Очень похоже на баг, завел тикет: ReplaceEntity annotation cannot be used in a project migrated from CUBA · Issue #1282 · jmix-framework/jmix · GitHub

Спасибо за ответ, а Вы можете сориентировать по примерным срокам решения?

Проблема исправлена, исправление будет выпущено в ближайшем патче 1.4.2 на этой или следующей неделе.