375 words

Exception after update of indices of Entity class

#1
2017-08-03 13:18

Hello,

I changed the index definition of an entity class from @Index()... to @Indices() and now I get the following stacktrace upon start:

Exception in thread "ODB-IndexActivation" java.lang.ClassCastException: com.objectdb.o.PIX cannot be cast to com.objectdb.o.FIX
at com.objectdb.o.EIX.<init>(EIX.java:70)
at com.objectdb.o.IXM.L(IXM.java:721)
at com.objectdb.o.IXM.M(IXM.java:697)
at com.objectdb.o.IXM.L(IXM.java:659)
at com.objectdb.o.IXM.K(IXM.java:602)
at com.objectdb.o.IXM.J(IXM.java:572)
at com.objectdb.o.IIS.j(IIS.java:67)
at com.objectdb.o.IXS.i(IXS.java:92)
at com.objectdb.o.IIS.p(IIS.java:55)
at com.objectdb.o.IXM.Vz(IXM.java:453)
at com.objectdb.o.PBI.C(PBI.java:146)
at com.objectdb.o.PBI.q(PBI.java:115)
at com.objectdb.o.MBI.VC(MBI.java:83)
at com.objectdb.o.MST.U8(MST.java:783)
at com.objectdb.o.IXM.E(IXM.java:378)
at com.objectdb.o.IXM.run(IXM.java:350)
at java.lang.Thread.run(Thread.java:748)

Is there any way to fix this?

Best regards,
Markus Ritter

doppelrittberger
doppelrittberger's picture
Joined on 2016-01-13
User Post #26
#2
2017-08-03 13:35

Which ObjectDB version are you using? According to the stack trace it is not the most recent build. Could you please try opening the database after the index change with the most recent ObjectDB build and then post a stack trace again?

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,786
#3
2017-08-03 13:20

Hello,

with the latest 2.7.1_02 I get the following stacktrace:

Exception in thread "ODB-IndexActivation" java.lang.ClassCastException: com.objectdb.o.PIX cannot be cast to com.objectdb.o.FIX
at com.objectdb.o.EIX.<init>(EIX.java:70)
at com.objectdb.o.IXM.L(IXM.java:722)
at com.objectdb.o.IXM.M(IXM.java:698)
at com.objectdb.o.IXM.L(IXM.java:660)
at com.objectdb.o.IXM.K(IXM.java:603)
at com.objectdb.o.IXM.J(IXM.java:573)
at com.objectdb.o.IIS.j(IIS.java:67)
at com.objectdb.o.IXS.i(IXS.java:92)
at com.objectdb.o.IIS.p(IIS.java:55)
at com.objectdb.o.IXM.Vz(IXM.java:454)
at com.objectdb.o.PBI.C(PBI.java:146)
at com.objectdb.o.PBI.q(PBI.java:115)
at com.objectdb.o.MBI.VC(MBI.java:83)
at com.objectdb.o.MST.U8(MST.java:783)
at com.objectdb.o.IXM.E(IXM.java:379)
at com.objectdb.o.IXM.run(IXM.java:351)
at java.lang.Thread.run(Thread.java:748)

Best regards

doppelrittberger
doppelrittberger's picture
Joined on 2016-01-13
User Post #27
#4
2017-08-03 13:53

Thanks. Changing from @Index()... to @Indices() should not change anything if it is only annotation change with no real index definition change. Could you describe the index change itself?

The stack trace may indicate an issue with an embedded class with no indexes or fields (which maybe had indexes before). Have you changed the indexes of an embedded class?

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,787
#5
2017-08-04 06:51

Hello,

here are my classes:

@Indices ({
    @Index (members = {"recurrence.recurringEvent"}),
    @Index (members = {"relations.related"})
})
public class Event extends Entity
{
    @Embedded
    private Recurrence recurrence = null;
    @ElementCollection
    private Collection<Relation> relations = new LinkedHashSet<>();
    ...
}
@Embeddable
public class Recurrence
{
    private String recurringEventId = null;
    private Event recurringEvent = null;
    ...
}
@Embeddable
public abstract class Relation
{
    private String relatedId = null;
    private Event related = null;
     ...
}

I changed the Indices from

@Index("recurrence.recurringEvent") to

@Indices{@Index("recurrence.recurringEventId"),@Index("relations.relatedId")}

Than it crashes. Now I use 

@Indices{@Index("recurrence.recurringEvent"),@Index("relations.related")}

and it works.

Best regards

doppelrittberger
doppelrittberger's picture
Joined on 2016-01-13
User Post #28
#6
2017-08-04 15:14

OK. We cannot reproduce it, but please report again if it reoccurs.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,790
#7
2017-08-10 07:41

Hello,

I got the error again. As stated above I changed the indices from single index to multiple indices. Running the database doctor will then remove all events from their calendars.

Best regards
Markus

doppelrittberger
doppelrittberger's picture
Joined on 2016-01-13
User Post #29
#8
2017-08-10 08:32

Did it happen again with the same index change, but now on a different database file? or a new index change on the same database file? Any other details may help. Do you have a way to reproduce it (even on your computer)?

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,793
#9
2017-08-10 11:01

Build 2.7.1_03 includes an attempt to fix this exception. Could you please try it?

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,796
#10
2017-08-10 12:23

Hello,

unfortunately this did not fix my issue. I opened a new ticket at http://www.objectdb.com/database/support/636. There is also our database file attached.

Best regards

doppelrittberger
doppelrittberger's picture
Joined on 2016-01-13
User Post #30

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel