Exception when starting Jmix 2.2.3 with additional datastore

We get an error at startup when we created a new project with an additional datastore.

  1. create a new Jmix project (version 2.2.3)
  2. As we are working behind company proxy we need to configure gradle to find the needed dependencies via the proxy.
  3. Add additional datastore with studio
  4. Add an entity to this datastore

We added point 4 after reading

but our error message is different and still there after adding an entity:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportsourceEntityManagerFactory' defined in class path resource [com/layertec/app/jmix/canteen/report/ReportsourceStoreConfiguration.class]: Failed to read candidate component class: URL [jar:file:/home/chowdari/.gradle/caches/modules-2/files-2.1/com.vaadin.external.atmosphere/atmosphere-runtime/3.0.4.slf4jvaadin1/8dc40d21ab494869b19b53b4e671010bf1e51cd3/atmosphere-runtime-3.0.4.slf4jvaadin1.jar!/org/atmosphere/inject/AtmosphereRequestIntrospector.class]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.5.jar:6.1.5]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.5.jar:6.1.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.5.jar:6.1.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.4.jar:3.2.4]
at com.layertec.app.jmix.canteen.report.CanteenReportApplication.main(CanteenReportApplication.java:81) ~[main/:na]
Caused by: jakarta.persistence.PersistenceException: Failed to read candidate component class: URL [jar:file:/home/chowdari/.gradle/caches/modules-2/files-2.1/com.vaadin.external.atmosphere/atmosphere-runtime/3.0.4.slf4jvaadin1/8dc40d21ab494869b19b53b4e671010bf1e51cd3/atmosphere-runtime-3.0.4.slf4jvaadin1.jar!/org/atmosphere/inject/AtmosphereRequestIntrospector.class]
at org.springframework.orm.jpa.persistenceunit.PersistenceManagedTypesScanner.scanPackage(PersistenceManagedTypesScanner.java:166) ~[spring-orm-6.1.5.jar:6.1.5]
Caused by: jakarta.persistence.PersistenceException: Failed to read candidate component class: URL [jar:file:/home/chowdari/.gradle/caches/modules-2/files-2.1/com.vaadin.external.atmosphere/atmosphere-runtime/3.0.4.slf4jvaadin1/8dc40d21ab494869b19b53b4e671010bf1e51cd3/atmosphere-runtime-3.0.4.slf4jvaadin1.jar!/org/atmosphere/inject/AtmosphereRequestIntrospector.class]

at org.springframework.orm.jpa.persistenceunit.PersistenceManagedTypesScanner.scan(PersistenceManagedTypesScanner.java:118) ~[spring-orm-6.1.5.jar:6.1.5]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.buildDefaultPersistenceUnitInfo(DefaultPersistenceUnitManager.java:554) ~[spring-orm-6.1.5.jar:6.1.5]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.readPersistenceUnitInfos(DefaultPersistenceUnitManager.java:531) ~[spring-orm-6.1.5.jar:6.1.5]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:459) ~[spring-orm-6.1.5.jar:6.1.5]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:443) ~[spring-orm-6.1.5.jar:6.1.5]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.5.jar:6.1.5]
... 16 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[na:na]
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[na:na]
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[na:na]
at java.base/java.util.Objects.checkIndex(Objects.java:361) ~[na:na]
at java.base/java.util.ArrayList.get(ArrayList.java:427) ~[na:na]
at org.springframework.core.annotation.AnnotationTypeMappings.get(AnnotationTypeMappings.java:165) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.core.annotation.TypeMappedAnnotation.of(TypeMappedAnnotation.java:618) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.core.annotation.MergedAnnotation.of(MergedAnnotation.java:612) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.core.type.classreading.MergedAnnotationReadingVisitor.visitEnd(MergedAnnotationReadingVisitor.java:98) ~[spring-core-6.1.5.jar:6.1.5]
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

at org.springframework.asm.ClassReader.readElementValues(ClassReader.java:3022) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.asm.ClassReader.accept(ClassReader.java:610) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.asm.ClassReader.accept(ClassReader.java:426) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:48) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:122) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.orm.jpa.persistenceunit.PersistenceManagedTypesScanner.scanPackage(PersistenceManagedTypesScanner.java:141) ~[spring-orm-6.1.5.jar:6.1.5]
... 24 common frames omitted
1 Like

The message is different but the cause is probably the same - persistence provider turns to global search for entities with unpredictable results.

Make sure there is at least one entity defined for this additional data store (it should have Store(name = "your-store")) annotation.

BTW the issue is fixed in Jmix 2.3.0.

Regards,
Konstantin

1 Like

Hi @krivopustov ,

I thought we added an entity, but now I can’t reproduce the error.

thanks for your support.

Regards