Issue #2650: References to objects of missing obsolete entity classes

Type: Bug ReoprtVersion: 2.8.5Priority: NormalStatus: FixedReplies: 12
#1

Hi again,

unfortunately, the provided patch to issue #2640 has created another issue:

When we migrate our product profiles, we get an exception regarding entities that were removed in an earlier version of our product (see below). These entities are not present in the database and the error does not occur with objectDB version 2.8.0_4. Did you change anything and do you have any hint as to what is wron on our side?

Best wishes

 

Caused by: com.objectdb.o._PersistenceException: Type com.btc.ep.formalnotation.bl.internal.dmos.PhaseImpl is not enhanced (enhance the type or enable reflection)
        at com.objectdb.o._PersistenceException.a(_PersistenceException.java:47)
        at com.objectdb.o.JPE.d(JPE.java:147)
        at com.objectdb.o.ERR.h(ERR.java:56)
        at com.objectdb.o.OST.onObjectDBError(OST.java:601)
        at com.objectdb.jpa.EMF.createEntityManager(EMF.java:152)
        at com.btc.ep.base.transactions.internal.TransactionManagerImpl.createAndSetEntityManagerIfPossible(TransactionManagerImpl.java:288)
        at com.btc.ep.base.transactions.internal.TransactionManagerImpl.doInit(TransactionManagerImpl.java:266)
        at com.btc.ep.base.transactions.internal.TransactionManagerImpl.init(TransactionManagerImpl.java:237)
        at com.btc.ep.base.transactions.annotations.TransactionAspect.ajc$around$com_btc_ep_base_transactions_annotations_TransactionAspect$1$344042f2(TransactionAspect.aj:102)
        at com.btc.ep.analysis.test.bl.internal.listeners.RequiementHierarchyConstraintsEnforcerListener.handleEvent(RequiementHierarchyConstraintsEnforcerListener.java:153)
        at com.btc.ep.core.notification.internal.services.NotificationListenerHolder.fire(NotificationListenerHolder.java:91)
        ... 6 more
Caused by: com.objectdb.o.UserException: Type com.btc.ep.formalnotation.bl.internal.dmos.PhaseImpl is not enhanced (enhance the type or enable reflection)
        at com.objectdb.o.MSG.a(MSG.java:64)
        at com.objectdb.o.TYM.E(TYM.java:1471)
        at com.objectdb.o.UTY.g(UTY.java:654)
        at com.objectdb.o.UTY.C(UTY.java:433)
        at com.objectdb.o.TYS.k(TYS.java:178)
        at com.objectdb.o.TYM.Z(TYM.java:546)
        at com.objectdb.o.TYM.<init>(TYM.java:196)
        at com.objectdb.o.OMF.w(OMF.java:865)
        at com.objectdb.o.OMF.s(OMF.java:817)
        at com.objectdb.jpa.EMF.s(EMF.java:130)
        at com.objectdb.o.OMF.x(OMF.java:715)
        at com.objectdb.jpa.EMF.createEntityManager(EMF.java:149)

 

#2

It is unclear how this new issue is related to the fix of issue #2640, so it could also be related to other recent changes. If you can specify the last build that didn't have the issue it could help.

Regarding the issue itself, is it correct that the objects are in the database but their classes have been deleted or missing? This is abnormal state for a database, so if possible, is is recommended to try fixing the database by running the Doctor.

A possible workaround that you can try is to change the configuration file and allow reflection, or include a dummy (enhanced) entity class in your project for that obsolete entity class.

ObjectDB Support
#3

This particular issue was introduced with version objectdb-2.8.2

 

>> Regarding the issue itself, is it correct that the objects are in the database but their classes have been deleted or missing?

The objectdb explorer does not show any objects of the given class in the database. The class was indeed removed.

 

>> This is abnormal state for a database, so if possible, is is recommended to try fixing the database by running the Doctor.

Running DBDoctor from 2.8.1 shows no issues:

ObjectDB Doctor [version 2.8.1]
Copyright (c) 2019, ObjectDB Software. All rights reserved.

Scanning the database file...
 3MB (total)
Analyzing database structure...
10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

No errors have been found.

 

However, the 2.8.5 DBDoctor throws the following exception with the same database:

[2021-03-31 15:19:54 #1 type]
Type com.btc.ep.vector.tc.internal.dmos.Identifiable is not enhanced.

[2021-03-31 15:19:55 #2 tool.doctor]
com.objectdb.o.UserException: Failed to locate set method for field property com.btc.ep.vector.tc.internal.dmos.Identifiable.uid using reflection
    at com.objectdb.o.MSG.a(MSG.java:77)
    at com.objectdb.o.UMR.s(UMR.java:944)
    at com.objectdb.o.UMR$k.y(UMR.java:1408)
    at com.objectdb.o.MMM.<init>(MMM.java:306)
    at com.objectdb.o.UTY.g(UTY.java:660)
    at com.objectdb.o.UTY.C(UTY.java:433)
    at com.objectdb.o.TYS.k(TYS.java:178)
    at com.objectdb.o.TYM.Z(TYM.java:546)
    at com.objectdb.o.TYM.<init>(TYM.java:196)
    at com.objectdb.o.MST.aA(MST.java:204)
    at com.objectdb.o.DCM.p(DCM.java:284)
    at com.objectdb.o.DCM.j(DCM.java:183)
    at com.objectdb.Doctor.main(Doctor.java:22)
Caused by: java.lang.NoSuchMethodException: com.btc.ep.vector.tc.internal.dmos.Identifiable.setUid(java.lang.String)
    at java.lang.Class.getDeclaredMethod(Class.java:2130)
    at com.objectdb.o.UMR$k.y(UMR.java:1384)
    ... 10 more
#4

One of the changes in version 2.8.2 is the new support of deleting classes using the Explorer, so it may be related. We cannot reproduce the exceptions with a simple test case, so your help with more information will be appreciated:

  1. Have you used this feature of deleting classes in the Explorer?
  2. Was com.btc.ep.vector.tc.internal.dmos.Identifiable deleted? or its class removed?
  3. Was com.btc.ep.formalnotation.bl.internal.dmos.PhaseImpl was deleted? or its class removed?
  4. What is the relationship between these two classes?
  5. What happens if you change the configuration to enable reflection mode (see #2 above)?
  6. Do you have a sample database or a test case that you share and can demonstrate either of these two exceptions?
ObjectDB Support
#5

We've done some more analysis on our side and found that PhaseImpl indeed still exists in the database. It is an Embeddable and was not removed properly.

We used to have an entity called SimplifiedUniversalPatternImpl, which contained the field PhaseImpl. We have removed all SimplifiedUniversalPatternImpl, but the PhaseImpl seem to remain in the db. Is this to be expected?

We can also see that there are a lot of other old entities (potentially these are also Embeddables) that cause the same error. These entities were removed from our schema a long time ago. So we now seem to be haunted by a lot of ghosts and would like to do something about this. How we gonna call?

#6

Regarding you questions:

  1. Have you used this feature of deleting classes in the Explorer? >> no
  2. Was com.btc.ep.vector.tc.internal.dmos.Identifiable deleted? or its class removed? >> both. We generally remove entities form the database in the first step and afterwards remove the classes.
  3. Was com.btc.ep.formalnotation.bl.internal.dmos.PhaseImpl was deleted? or its class removed? >> Same as in 2.
  4. What is the relationship between these two classes? >> There is no relationship between them, I think

We are working on providing a database to you and also on checking the reflection bit. Might take a while, though.

#7

If we enable reflection, we don't see the error.

#8

> but the PhaseImpl seem to remain in the db. Is this to be expected?

Yes, each class is handled separately.

> So we now seem to be haunted by a lot of ghosts and would like to do something about this. How we gonna call?

> If we enable reflection, we don't see the error.

If you can confirm that when reflection is enabled everything works as expected (check also the Doctor, which had its own exception), then it is a good sign and we can try to disable the error for missing classes, also when reflection is disabled.

> We are working on providing a database to you

That may help.

ObjectDB Support
#9

We have provided a database file in another ticket that should be kept private. ticket #2651

#10

Thank you for the test database. Build 2.8.5_01 should fix the Doctor exception (post #3). We cannot check whether it also solve the original exception (post #1).

ObjectDB Support
#11

Thanks for providing a patch. I can confirm that the DBDoctor exception is gone.

Unfortunately, the original issue is not fixed by the patch.

#12

Thank you for the feedback.

Could you please try build 2.8.5_02, which should solve #1 as well?

ObjectDB Support
#13

2.8.5_02 solves both issues :)

Thank you very much for your help and patience.

Reply