com.objectdb.o.NLV cannot be cast to com.objectdb.o.CMV

#1

We are using ObjectDB 2.5.1_04. The following JPQL query causes an internal exception:

SELECT COUNT(r) FROM RecordingMetaData AS r WHERE ((r.mapFromCli LIKE '192.168.10.13%' ESCAPE '\'))

The exception:

Caused by: java.lang.IllegalStateException: com.objectdb.o.InternalException: Unexpected internal exception  
        at com.arunta.base.db.RecordingMetaDataDAO.getSingleResult(RecordingMetaDataDAO.java:958)            
        at com.arunta.app.services.RecordingService.getSingleResult(RecordingService.java:384)               
        ... 15 more                                                                                          
Caused by: com.objectdb.o.InternalException: Unexpected internal exception                                   
        at com.objectdb.o.JPE.h(JPE.java:165)                                                                
        at com.objectdb.o.ERR.f(ERR.java:70)                                                                 
        at com.objectdb.o.OBC.onObjectDBError(OBC.java:1484)                                                 
        at com.objectdb.jpa.JpaQuery.getSingleResult(JpaQuery.java:723)                                      
        at com.arunta.base.db.RecordingMetaDataDAO.getSingleResult(RecordingMetaDataDAO.java:938)            
        ... 16 more                                                                                          
Caused by: java.lang.ClassCastException: com.objectdb.o.NLV cannot be cast to com.objectdb.o.CMV             
        at com.objectdb.o.SLS.Uv(SLS.java:148)                                                               
        at com.objectdb.o.SBI.u(SBI.java:109)                                                                
        at com.objectdb.o.OBI.w(OBI.java:479)                                                                
        at com.objectdb.o.OBI.<init>(OBI.java:188)                                                           
        at com.objectdb.o.SBI.<init>(SBI.java:50)                                                            
        at com.objectdb.o.MST.aY(MST.java:778)                                                               
        at com.objectdb.o.BQI.Uu(BQI.java:128)                                                               
        at com.objectdb.o.GQI.Uu(GQI.java:120)                                                               
        at com.objectdb.o.PRG.ag(PRG.java:679)                                                               
        at com.objectdb.o.PRG.af(PRG.java:553)                                                               
        at com.objectdb.o.QRM.U6(QRM.java:265)                                                               
        at com.objectdb.o.MST.U6(MST.java:933)                                                               
        at com.objectdb.o.WRA.U6(WRA.java:293)                                                               
        at com.objectdb.o.WSM.U6(WSM.java:113)                                                               
        at com.objectdb.o.QRR.g(QRR.java:244)                                                                
        at com.objectdb.o.QRR.f(QRR.java:153)                                                                
        at com.objectdb.jpa.JpaQuery.getSingleResult(JpaQuery.java:716)                                      
        ... 17 more

The relevant code from RecordingMetaData:

@Entity(name="RecordingMetaData")
@SequenceGenerator(
    name="RecordingMetaData_sequence",
    sequenceName="RecordingMetaData_sequence",
    allocationSize=1
)
public class RecordingMetaData {

    private Long id;
    private Long version;
    :   
    private String mapFromCli;
    :
    public void setMapToCli(String mapToCli) {
        this.mapToCli = mapToCli;
    }

    @Basic
    public String getMapFromCli() {
        return mapFromCli;
    }

 

Any suggestions on how to avoid the exception?

Thank you

Emil

 

 

#2

Same problem in 2.5.4_03.

#3

Please post the stack trace that you get with version 2.5.4_03.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#4

Here is the stack trace when using your DB explorer tool to run the query:

 

[ObjectDB 2.5.4_03] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) 64-Bit Server VM 1.7.0_11 (on Linux 2.6.32-279.9.1.el6.x86_64).
Please report this error on http://www.objectdb.com/database/issue/new                        
com.objectdb.o.InternalException: java.lang.ClassCastException: com.objectdb.o.NLV cannot be cast to com.objectdb.o.CMV                                                                                                    
java.lang.ClassCastException: com.objectdb.o.NLV cannot be cast to com.objectdb.o.CMV                        
        at com.objectdb.o.SLS.Uv(SLS.java:148)                                                               
        at com.objectdb.o.SBI.u(SBI.java:109)                                                                
        at com.objectdb.o.OBI.w(OBI.java:481)                                                                
        at com.objectdb.o.OBI.<init>(OBI.java:189)                                                           
        at com.objectdb.o.SBI.<init>(SBI.java:50)                                                            
        at com.objectdb.o.MST.aZ(MST.java:793)                                                               
        at com.objectdb.o.BQI.Uu(BQI.java:128)                                                               
        at com.objectdb.o.GQI.Uu(GQI.java:121)                                                               
        at com.objectdb.o.PRG.ag(PRG.java:679)                                                               
        at com.objectdb.o.PRG.af(PRG.java:553)                                                               
        at com.objectdb.o.QRM.Vb(QRM.java:285)                                                               
        at com.objectdb.o.MST.Vb(MST.java:949)
        at com.objectdb.o.WRA.Vb(WRA.java:311)
        at com.objectdb.o.WSM.Vb(WSM.java:115)
        at com.objectdb.o.QRR.g(QRR.java:244)
        at com.objectdb.o.QRR.f(QRR.java:153)
        at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:716)
        at com.objectdb.o.QRP.L(QRP.java:259)
        at com.objectdb.o.QRP.T(QRP.java:723)
        at com.objectdb.o.QRP.actionPerformed(QRP.java:686)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
        at java.awt.Component.processMouseEvent(Component.java:6505)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
        at java.awt.Component.processEvent(Component.java:6270)
        at java.awt.Container.processEvent(Container.java:2229)
        at java.awt.Component.dispatchEventImpl(Component.java:4861)
        at java.awt.Container.dispatchEventImpl(Container.java:2287)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
        at java.awt.Container.dispatchEventImpl(Container.java:2273)
        at java.awt.Window.dispatchEventImpl(Window.java:2719)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:682)
        at java.awt.EventQueue$3.run(EventQueue.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.awt.EventQueue$4.run(EventQueue.java:696)
        at java.awt.EventQueue$4.run(EventQueue.java:694)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
#5

It seems that the query is executed using a composite index on the mapFromCli field. Could you please provide details on composite indexes that include that field?

Unexpectedly, one of the values in that index is NULL rather than multiple values reflecting the indexed fields. This may indicate a missing value, maybe as a result of schema evolution or index definition changes Please provide relevant details, if any.

You may try repairing indexes by running the ObjectDB Doctor in repair mode.

If you can upload the database (possibly in a private support ticket) it will probably help understanding the exact cause.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#6

The mapFormCli filed is a member of a number of composite indices:

@Entity(name="RecordingMetaData")
@SequenceGenerator(
    name="RecordingMetaData_sequence",
    sequenceName="RecordingMetaData_sequence",
    allocationSize=1
)
@Indices({
    // Indices for popular searches
    @Index(members={"mapToCli", "mapFromCli"}),
    @Index(members={"mapToCli", "mapFromCli", "callDirection"}),
    @Index(members={"startDate", "mapToCli", "mapFromCli"}),
    @Index(members={"startDate", "startTime", "mapToCli", "mapFromCli"}),
   
})
public class RecordingMetaData {

    private Long id;
    private Long version;
   
    private Date startDate;         // Date: date part of startDateTime
    private Date startTime;         // Time: time part of startDateTime
   
    private String mapToCli;
    private String mapFromCli;
   
    private Integer callDirection;

And yes, null values are allowed for mapFormCli.

We tried fixing the indices with the Doctor tool and it did not help. Then we deleted the DB file, and re-created the Db from scratch. Again, it did not help - same problem.

Are you saying that only a non-NULL members can participate in an index?

BTW, we had the same indices and rules for the mapFromCli field in an SQL DB and had no problem with it.

Emil

#7

Thank you for the details. Please try build 2.5.4_04, which may solve this issue.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#8

I can confirm that 2.5.4_04 fixes the problem. Thank you.


Post Reply

To post a reply and/or subscribe to update notifications - please login