History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: COR-662
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Dheeraj Guntupalli
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
db4o Core

ClassCastException on Objectcontainer.set() for db4o adapter for gigaspaces

Created: 29/May/07 01:38 PM   Updated: 18/Jul/08 02:57 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Original Estimate: Not Specified
Remaining Estimate: Not Specified
Time Spent - 3.42h
Time Spent: 3.42h
Time Spent - 3.42h

File Attachments: 1. Zip Archive gigaspace.zip (14 kb)

Environment: db4o 6.0, jdk5, gigaspaces 5.2 Enterprise edition
Issue Links:
Related
 

Resolution Date: 02/Jun/07 02:18 PM
First Response Date: 30/May/07 01:44 PM
Labels:
Participants: Dheeraj Guntupalli, Richard Liang and Rodrigo B. de Oliveira
Number of Attachments: 1
Number of Comments: 7


 Description  « Hide

 ObjectContainer#set() throws a ClassCastException( for LOG_POSITION ) when we are trying to integrate and test the db4o adapter for gigaspaces.
 
The problem unfortunately cannot be reproduced with a simple test case. It shows up only when we run the gigaspace server with the adapter.

Following are the instructions for reproducing the behaviour.

Using db4o 6.0 and jdk 1.5.
 
You can download the gigaspaces 5.2 EE at: http://www.gigaspaces.com/tempfiles/5.2.2_1765_patch4/
 
1.) created a proj in eclipse and copying the .java files in the zip file
 
2.) add the .jar to the Class-Path : under GigaSpacesEE5.2\lib\

jini/jsk-platform.jar
jini/jsk-lib.jar
jini/start.jar
rio/boot.jar
Jspaces.jar
db4o-6.0-java5.jar
 
3.) Copy db4opersistent-space-schema.xml to folder GigaSpacesEE5.2\config\schemas
 
Now run this class(in the Jspaces.jar)
com.j_spaces.core.client.SpaceFinder
 
VM arguments ---> -server -showversion -Xmx512m
Program args(it's the space URL) ---> /./myCache?schema=db4opersistent&properties=gs&groups="gigaspaces-5.2EE"
 


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Richard Liang - 30/May/07 01:44 PM
Assist Persistent with Greg

Rodrigo B. de Oliveira - 31/May/07 03:22 PM
I cant repro the the issue, I'm getting the following output after I do everything as described above:

java version "1.6.0_02-ea"
Java(TM) SE Runtime Environment (build 1.6.0_02-ea-b01)
Java HotSpot(TM) Server VM (build 1.6.0_02-ea-b01, mixed mode)
31/05/2007 12:19:38
CONFIG [com.gigaspaces.kernel]: Loading properties file from: file:/C:/java/GigaSpacesEE5.2/config/gs.properties

31/05/2007 12:19:38
WARNING [com.gigaspaces.kernel]: Could not find the container schema: config/schemas/db4opersistent-container-schema.xml.
Instead, loaded the default container schema < config/schemas/default-container-schema.xml > for the container configuration.

CONFIG: Sets the system property ${com.gs.home} with value: C:\java\GigaSpacesEE5.2\
31/05/2007 12:19:39
SEVERE [com.gigaspaces.container]:
java.lang.SecurityException: License Key was expired -
May 25, 2007~GigaSpaces-Eval@75Vqa4RdpQQSNSr5PWMW#EE^5.0EE%UNBOUND

Exception in thread "main" com.j_spaces.core.client.FinderException: Failed to find: /./myCache?schema=db4opersistent&properties=gs&groups=gigaspaces-5.2EE
at com.j_spaces.core.client.SpaceFinder._find(SourceFile:505)
at com.j_spaces.core.client.SpaceFinder.internalFind(SourceFile:313)
at com.j_spaces.core.client.SpaceFinder.internalFind(SourceFile:303)
at com.j_spaces.core.client.SpaceFinder.find(SourceFile:374)
at com.j_spaces.core.client.SpaceFinder.main(SourceFile:1112)
Caused by: java.lang.SecurityException: java.lang.SecurityException: License Key was expired -
May 25, 2007~GigaSpaces-Eval@75Vqa4RdpQQSNSr5PWMW#EE^5.0EE%UNBOUND
at com.j_spaces.core.JSpaceContainerImpl.i(SourceFile:1169)
at com.j_spaces.core.JSpaceContainerImpl.<init>(SourceFile:537)
at com.j_spaces.core.client.SpaceFinder.a(SourceFile:625)
at com.j_spaces.core.client.SpaceFinder.a(SourceFile:743)
at com.j_spaces.core.client.SpaceFinder._find(SourceFile:476)
... 4 more


Dheeraj Guntupalli - 01/Jun/07 04:45 AM
Please use the Gigaspaces 5.2 EE trial version at http://www.gigaspaces.com/downloads.html#f

Dheeraj Guntupalli - 01/Jun/07 05:31 AM
Sorry the link given above too has the same problem. We contacted the gigaspaces, will let you know once we get their response.

Rodrigo B. de Oliveira - 02/Jun/07 02:35 AM
I was able to a license. Thanks!

Rodrigo B. de Oliveira - 02/Jun/07 03:15 AM
Hi,

I found a few issues in the provided code:

1) Db4oPersistentAdapter.createClassTable and dropClassTable are calling updateAndCommitFieldNames which will try to open a second db4o container to the same file, that's not advisable. I refactored the code to have a updateAndCommitFieldNames method taking an ObjectContainer reference and I then pass the one I got from getImplementationUserContext

2) PEReflector.fieldTypeFor is returning different field types for the same class during a single session which is currently not supported by db4o. One workaround you can use is to always "return parent.forClass(Object.class);" from fieldTypeFor

With the changes above the I get "GigaSpaces Platform(TM) 5.2EE Build: 1765 Server started successfully !"

Rodrigo B. de Oliveira - 02/Jun/07 02:18 PM
I've found the actual issue there. It's an identity concept mismatch.

The thing is that Gigaspaces reuses PersistentEntry instances. It doesn't keep a one-to-one mapping between physical PersistentEntry objects and the *logical* entries stored to the database.

In other words, the same PersistentEntry object is used to represent many different *logical* objects in the same session. The first insert call receives a PersistentEntry representing a SA_DIRECTORY logical object, the second call receives the same PersistentEntry object but now representing a LOG_POSITION logical object, although from the db4o point of view which is the VM point of view it still is the same object. This identity mismatch eventually leads to an internal error when db4o tries to use a ReflectClass that no longer matches the original schema.

The solution is to not store PersistentEntry objects directly. They were not designed for that. Db4oPersistentAdapter must map PersistentEntry instances to different let's say Db4oPersistentEntry instances based on their m_UID before passing them to db4o.

Please let me know how I can be of further assistance.