BETA: java.lang.IllegalStateException: Entity 'XXXX [managed]' is a ChangeTracker but has no PropertyChangeListener

So, In Studio 7 Beta 2 with platform beta 1, if I try for any Entity to extend StandardEntity world breaks.
If I extend StandardUUID all is good.

I have seen some other posts similar and my findings were:

  • On the note about gradle version, I checked with gradle 4.10.1 (the wrapped one) and gradle 4.10.2 without success. Also, it looks like 7.0 won’t be that picky with the gradle versions
  • On the note about checking build/enhanced-classes, I do not have such folder, but maybe it is ok on 7?
  • There is an open issue about Groovy support but unsure on how to check if that’s the case (I do have Groovy enabled, but not used in Entity classes) [link]
  • I checked all my compositions/associations are LAZY
  • Using Set instead of List for OneToMany makes no change
  • On 7 the eclipselink.weaving is set to static, some post talks about weaving but not about static.

My persistence.xml has no properties set so all defaults are kept.

One Entity starts like that:

@NamePattern("%s %s|serialString,name")
@Table(name = "METAI4_PARTY")
@Entity(name = "metai4_Party")
public class Party extends StandardEntity {

Other entities are similar, some have OneToMany / ManyToOne. All fail with the same problem.

Don’t know what else to try :disappointed_relieved:

java.lang.IllegalStateException: Entity 'com.metanube.metai4.entity.project.Project-d848b70d-22c3-c629-4048-8220e918f288 [managed]' is a ChangeTracker but has no PropertyChangeListener
            at com.haulmont.cuba.core.PersistenceTools.getDirtyFields(PersistenceTools.java:99) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at com.haulmont.cuba.core.PersistenceTools.isDirty(PersistenceTools.java:139) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at com.haulmont.cuba.core.sys.persistence.EclipseLinkDescriptorEventListener.postUpdate(EclipseLinkDescriptorEventListener.java:140) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:720) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListeners(DescriptorEventManager.java:765) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:230) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at com.haulmont.cuba.core.sys.persistence.DescriptorEventManagerWrapper.executeEvent(DescriptorEventManagerWrapper.java:183) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1115) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:314) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:810) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:3018) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1889) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1871) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1821) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:273) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:131) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:4381) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1487) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1633) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:455) ~[org.eclipse.persistence.core-2.7.2-2-cuba.jar:na]
            at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:971) ~[org.eclipse.persistence.jpa-2.7.2-2-cuba.jar:na]
            at com.haulmont.cuba.core.sys.persistence.PersistenceImplSupport$ContainerResourceSynchronization.detachAll(PersistenceImplSupport.java:496) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at com.haulmont.cuba.core.sys.persistence.PersistenceImplSupport$ContainerResourceSynchronization.beforeCommit(PersistenceImplSupport.java:452) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:96) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:922) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:730) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714) ~[spring-tx-5.1.2.RELEASE.jar:5.1.2.RELEASE]
            at com.haulmont.cuba.core.sys.TransactionImpl.commit(TransactionImpl.java:104) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]
            at com.haulmont.cuba.core.app.RdbmsStore.load(RdbmsStore.java:171) ~[cuba-core-7.0-SNAPSHOT.jar:7.0-SNAPSHOT]

Hi,

Does the build.gradle contain following lines for global module?

entitiesEnhancing {
        main {
            enabled = true
        }
    }

Yes,

configure(globalModule) {
    entitiesEnhancing {
        main {
            enabled = true
        }
    }
}

Could you provide a sample project with this error?
I’ve tested locally and it works.
And what is the java version?

I will try to reproduce on a clean project later today, in the meantime:

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Dynamic Code Evolution 64-Bit Server VM (build 25.71-b01-dcevmlight-2, mixed mode)

You can try to reproduce problem with my test project: sample70.zip (84.7 KB)

Sample works. I will mess with it later comparing to my project see if I can spot the difference!
thanks for the help!

Hi,
I have not yet been able to reproduce but I noticed one difference between my code and my messings with sample.
I added a @EventListener(AppContextStartedEvent.class) to the sample to mimick my troubles, and then threw an Exception from there as this is were my code crashes.

at com.metanube.metai4.bq.AutoloadBqOnStartup.appStarted(AutoloadBqOnStartup.java:32) [app-core-0.1-SNAPSHOT.jar:na]

at com.company.sample70.core.AppStartedSubscriber$$EnhancerBySpringCGLIB$$26d08320.appStarted(<generated>) ~[na:na]

So, my @EventListener(AppContextStartedEvent.class) does not show up as “$$EnhancerBySpring…” (dependencies are injected though).

Might this be relevant? What could be the reason behind my subscriber not being “$$Enhancer…”?

I have also noticed that the exception gets raised when I do a dataManager.load()

still investigating!

Perhaps, problem relates to the groovy support. Could you try to disable groovy support for the project (if it enabled)?

Yes! I guess I have been caught twice on the same problem this week.

This diff made it work:

 configure([globalModule, coreModule, webModule]) {
-    apply(plugin: 'groovy')
     apply(plugin: 'net.ltgt.apt')

-    sourceSets {
-        main { groovy { srcDirs = ["src"] } }
-        test { groovy { srcDirs = ["test"] } }
-    }
-
     dependencies {
         compileOnly 'org.projectlombok:lombok:1.18.4'
         apt 'org.projectlombok:lombok:1.18.4'
 }
-  sourceSets.main.output.classesDir = new File(project.buildDir, "classes/main")
-  sourceSets.test.output.classesDir = new File(project.buildDir, "classes/test")
}

I am unable to reproduce on the sample project. But doing those changes on my build.gradle makes it work. I’m only using Groovy on testing for spockframework so I guess I can live without it until 7.0 release :slight_smile:

Marc,

We have created an issue: https://github.com/cuba-platform/cuba-gradle-plugin/issues/80 for the groovy support.

1 Like