MetaClass not found for entity

Hello
I created a custom add-on and made it a jar file.
Then I added that jar file in another project.
Jar file has two entities: Widget and Template.

Tables are created in the database.
Now when I run this project I get MetaClass not found MetaClass not found for class com.company.gridcomponent.entity.Widget exception.
Should I add these entities to the metaClass and how?

When I build this project, the following exception occurs:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [io/jmix/autoconfigure/eclipselink/EclipselinkAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘entityManagerFactory’ parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘eclipselink_JmixEclipseLinkJpaVendorAdapter’ defined in URL [jar:file:/home/developer/.gradle/caches/modules-2/files-2.1/io.jmix.data/jmix-eclipselink/1.5.2/c8adfa0cb6c826c000eac514eacba2038e1f27a/jmix-eclipselink-1.5.2.jar!/io/jmix/eclipselink/impl/support/JmixEclipseLinkJpaVendorAdapter.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘eclipselink_JmixEclipseLinkSessionEventListener’: Unsatisfied dependency expressed through field ‘metadata’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘core_Metadata’ defined in URL [jar:file:/home/developer/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.5.2/7c6ff7846c06e5862d2277e1be60655cd4c1bb6f/jmix-core-1.5.2.jar!/io/jmix/core/impl/MetadataImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘core_MetadataLoader’ defined in URL [jar:file:/home/developer/.gradle/caches/modules-2/files-2.1/io.jmix.core/jmix-core/1.5.2/7c6ff7846c06e5862d2277e1be60655cd4c1bb6f/jmix-core-1.5.2.jar!/io/jmix/core/impl/MetadataLoader.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.jmix.core.impl.MetadataLoader]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: MetaClass not found for class com.company.gridstackcomponent.entity.Widget

Please help

Hello, @asroryuldashev57,
Entities should be detected automatically if the addon JAR file has been built correctly and added to the project properly.

Are Widget entity listed in logs during compileJava step of addon building? It should appear in logs in form of:

Enhancing entities in project ':addon' for source set 'main'
Project entities:
    JPA: [com.company.gridcomponent.entity.Widget, com.company.addon.entities.SomeEntity, <...>, com.company.addon.entities.AnotherEntity];
    DTO: [];

If not - then something went wrong or addon was build incorrectly.

More information about addon creation may be found in docs and this example of composite project.

Regards,
Dmitry

Thank you