About junit,i meet a problem

09:40:38.226 WARN  com.haulmont.cuba.core.sys.CubaCoreApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [cuba-spring.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.2.cuba23): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [SampleOrderSheet] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.6.2.cuba23): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class com.artwell.sampleordersheet.entity.StyleAndInstance] uses a non-entity [class com.haulmont.bpm.entity.ProcDefinition] as target entity in the relationship attribute [field process].

%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20181206094550
this is my spring.xml,
i test SampleIntegrationTest.java,
%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20181206094851
this is entity of StyleAndInstance,i association ProcDefinition

According to the exception description [class com.artwell.sampleordersheet.entity.StyleAndInstance] uses a non-entity [class com.haulmont.bpm.entity.ProcDefinition] as target entity in the relationship attribute [field process], most probably your test setup does not include BPM app component. See comments in your test container class, for example:

public class SalesTestContainer extends TestContainer {

    public SalesTestContainer() {
        super();
        appComponents = new ArrayList<>(Arrays.asList(
                "com.haulmont.cuba"
                // add CUBA premium add-ons here
                // "com.haulmont.bpm",
                // "com.haulmont.charts",
                // "com.haulmont.fts",
                // "com.haulmont.reports",
                // and custom app components if any
        ));
        // ...
1 Like

image
i add bpm.
it’s also alert:
uses a non-entity [class com.haulmont.bpm.entity.ProcDefinition] as target entity in the relationship attribute [field process].

Could you attach a test project then?

sorry ,i used 6.8.11 ,it’s failed, i update 6.10.6 and it’s success