Unable to even begin compile after CUBA migration

Before I can even see what compile errors I get, I have a Liquibase error that I have no clue how to solve…

liquibase-migration-error

There are also numerous errors in the console…

[2021-11-05 08:03:04] INFO [liquibase.changelog] Data updated in UI_TABLE_PRESENTATION
[2021-11-05 08:03:04] INFO [liquibase.changelog] ChangeSet com/haulmont/cuba/liquibase/changelog/003-migrate-ui-data.xml::50::migrator ran successfully in 2ms
[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::10::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_CONTENT_STORAGE does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::15::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_USER_GROUP_ROLE does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::20::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_USER_GROUP_USER_LINK does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::21-pg::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_USER_GROUP_USER_LINK does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::22::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_USER_GROUP_USER_LINK does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::23::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_USER_GROUP_ROLE_LINK does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-bpm.xml::24::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.BPROC_USER_GROUP does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-imap.xml::10::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.IMAP_MAIL_BOX does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-imap.xml::20::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.IMAP_FOLDER does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-reports.xml::10::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.REPORT_REPORT does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-reports.xml::20::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.REPORT_REPORT does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-reports.xml::30::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.REPORT_REPORT does not exist

[2021-11-05 08:03:04] INFO [liquibase.changelog] Marking ChangeSet: com/haulmont/cuba/liquibase/changelog/004-migrate-reports.xml::40-other::migrator ran despite precondition failure due to onFail='MARK_RAN': 
          liquibase-change-log-1636113770267.xml : Table public.REPORT_REPORT does not exist

[2021-11-05 08:03:04] INFO [liquibase.lockservice] Successfully released change log lock

Any ideas? O_O

Click Build → Build Project in the IDE main menu to compile your project without running Liquibase diff generation.

The console messages you attached are not errors (see INFO level). They just tell that your project doesn’t need to run some conversion scripts.

Regards,
Konstantin

But the error in the screenshot is very definitely an error (an Exception in fact). This will likely prevent me from continuing to develop. I’ll attach that again.

liquibase-migration-error

I’ll need some type of assistance with this. Being unable to generate changelogs is a stopper…

Anything? This exception is pretty… opaque. There’s really no clues as to how to solve it since it’s internal to the changelog generation process. :frowning:

@krivopustov @stukalov ? :slight_smile:

Checking idea.log here is the full trace of the exception:

2021-11-10 09:05:54,008 [  27491]   INFO - tudio.backend.stat.StatManager - Event has been sent successfully 200 
2021-11-10 09:07:01,779 [  95262]   WARN - pbefore.SyncDbBeforeRunProcess - liquibase.command.CommandExecutionException: java.lang.IllegalStateException: Incorrect attribute type! Expected: Entity; Actual: java.util.List<Role> 
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.IllegalStateException: Incorrect attribute type! Expected: Entity; Actual: java.util.List<Role>
	at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManager.generateDiffChangeLog(LiquibaseCommandManager.kt:261)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:104)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.use(LiquibaseIntellijDiffGenerationHandler.kt:129)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.access$use(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:91)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManagerKt.runWithPluginClassLoader(LiquibaseCommandManager.kt:460)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1.compute(actions.kt:60)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:841)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.doRun(LiquibaseIntellijDiffGenerationHandler.kt:148)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$run$changeLogFile$1.compute(LiquibaseIntellijDiffGenerationHandler.kt:66)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$run$changeLogFile$1.compute(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:279)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:450)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:117)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$8(CoreProgressManager.java:556)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:81)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:243)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:243)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: liquibase.command.CommandExecutionException: java.lang.IllegalStateException: Incorrect attribute type! Expected: Entity; Actual: java.util.List<Role>
	at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
	at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209)
	... 33 more
Caused by: java.lang.IllegalStateException: Incorrect attribute type! Expected: Entity; Actual: java.util.List<Role>
	at com.haulmont.jmixstudio.util.AttributeUtil.createJoinTable(AttributeUtil.java:577)
	at com.haulmont.jmixstudio.util.AttributeUtil.getJoinTable(AttributeUtil.java:472)
	at com.haulmont.jmixstudio.model.EntityAttributeCacheProvider.lambda$getJoinTable$41(EntityAttributeCacheProvider.java:671)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:841)
	at com.haulmont.jmixstudio.util.EntityUtil.ra(EntityUtil.java:771)
	at com.haulmont.jmixstudio.model.EntityAttributeCacheProvider.getJoinTable(EntityAttributeCacheProvider.java:671)
	at com.haulmont.jmixstudio.model.EntityAttributePsi.getJoinTable(EntityAttributePsi.java:294)
	at com.haulmont.jmixstudio.db.ddl.AbstractLiquibaseGenerator.lambda$getAllJoinTables$3(AbstractLiquibaseGenerator.java:937)
	at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:39)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:227)
	at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:227)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:28)
	at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:72)
	at com.haulmont.jmixstudio.db.ddl.AbstractLiquibaseGenerator.getAllJoinTables(AbstractLiquibaseGenerator.java:932)
	at com.haulmont.jmixstudio.db.ddl.AbstractLiquibaseGenerator.getJoinTables(AbstractLiquibaseGenerator.java:917)
	at com.haulmont.jmixstudio.backend.liquibase.JmixLiquibaseGenerator.getJoinTables(JmixLiquibaseGenerator.kt:190)
	at liquibase.ext.intellij.snapshot.TableSnapshotGenerator.C(TableSnapshotGenerator.java:84)
	at liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator.snapshot(IntellijSnapshotGenerator.java:83)
	at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
	at liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator.snapshot(IntellijSnapshotGenerator.java:76)
	at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:315)
	at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:106)
	at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
	at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:38)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:215)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:188)
	at liquibase.command.core.DiffCommand.createReferenceSnapshot(DiffCommand.java:222)
	at liquibase.command.core.DiffCommand.createDiffResult(DiffCommand.java:144)
	at liquibase.command.core.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:57)
	at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
	... 34 more

Hi,

Can you search for attributes in your data model that have type declaration List<Role>? Probably there is some wrong annotation on this attribute.

    @JoinTable(name = "MEDFLEXJ_NOTE_TYPE_ROLE_LINK", joinColumns = @JoinColumn(name = "NOTE_TYPE_ID"), inverseJoinColumns = @JoinColumn(name = "ROLE_ID"))
    @ManyToMany
    @OrderBy("name")
    protected List<Role> allowedRoles;

This was fine in CUBA (and was generated by CUBA Studio!)

Thank you for this example. We’ll try to reproduce the problem and let you know about results.

Excellent. We are stopped dead until we have a resolution.

If needed, I could send the full CUBA project - but obviously, only in confidence directly to someone there, and you’d need to delete it completely when done.

Hi,

It seems that Studio doesn’t recognize Role class that is referenced in this attribute as an entity.
In this case Studio can’t resolve collection attribute type properly and we have such exception on changelog generation.
Please check that Role entity is properly defined in your project.

Regards, Alexander

Role is CUBA’s sec$Role - it was internal to the framework. This should have been handled by the migration, much like sec$User was.

But it seems it wasn’t, so we are dead stopped until this can be resolved somehow.

I’ll still need assistance on this matter too. Any ideas, @gaslov / @krivopustov ? :slight_smile:

What’s your current situation? Have you managed to compile all the project successfully?

No, because of the above listed error/exception during changelog generation. It seems the migration doesn’t handle CUBA’s sec$Role entity. See the above error screenshot and exception trace.

The migration procedure doesn’t automatically convert CUBA roles to Jmix roles, and it will not replace your links to Role entities. You should do it yourself, see Migration from CUBA / Security configuration entities for reference.