Hi,
we are using ObjectDB 2.5.4_04 on Linux. Our application, which uses ObjectDb as a DB, exposes a Java RMI interface which allows remote RMI clients to run JPQL queries on the DB.
The application internally runs SELECT NEW ... queries. For example:
SELECT NEW com.arunta.base.db.FileNameDTO(r.id, r.fileName) FROM RecordingMetaData AS r WHERE ...
A remote RMI client runs SELECT (but not SELECT NEW ...) and UPDATE JPQL queries on the DB via the RMI interface. What we noticed is that once we UPDATE a record from the client (via the RMI interface), all SELECT NEW ... queries, which the applications runs internally, start to fail with ClassCastException. The same exception is thrown by your DB Explorer tool when trying the same, or similar, SELECT NEW ... query:
Exception in thread "AWT-EventQueue-0" [ObjectDB 2.5.4_04] javax.persistence.PersistenceException Failed to build result of type 'NEW com.arunta.base.db.FileNameDTO(r.id, r.fileName)' (error 783) at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:330) at java.awt.Component.processMouseMotionEvent(Component.java:6550) at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339) at java.awt.Component.processEvent(Component.java:6274) 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:4505) 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) Caused by: com.objectdb.o.UserException: Failed to build result of type 'NEW com.arunta.base.db.FileNameDTO(r.id, r.fileName)' at com.objectdb.o.MSG.d(MSG.java:74) at com.objectdb.o.ORB.l(ORB.java:230) at com.objectdb.o.RSL.r(RSL.java:312) at com.objectdb.o.RSL.get(RSL.java:169) ... 44 more Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@13a7f4bd at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at com.objectdb.o.ORB.l(ORB.java:195) ... 46 more
For your information the FileNameDTO.java is (simple bean):
public class FileNameDTO { private Long id; private String fileName; public FileNameDTO(Long id, String fileName) { this.id = id; this.fileName = fileName; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } }
The attached DB file has 3 records which were updateted by a remote client (over RMI). They have IDs 9766, 9890 and 9897. These records cause all SELECT NEW ... type queries, which run internally, to fail with the ClassCastException.
Other SELECT queries (i.e. non SELECT NEW ... quereis) work fine inside the application and from remote clients via RMI after the update. For example SELECT COUNT(*) ..., or SELECT r FROM ... all work fine.
DB Doctor does not fix the problem.
We need guidance on how to debug and fix the problem.
Thank you
Emil