[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3776) ClassCastException when second level cache (ehcache) is activated with caches replication

Stephane Nicoll (JIRA) noreply at atlassian.com
Wed Feb 18 06:37:38 EST 2009


ClassCastException when second level cache (ehcache) is activated with caches replication
-----------------------------------------------------------------------------------------

                 Key: HHH-3776
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3776
             Project: Hibernate Core
          Issue Type: Bug
          Components: caching (L2)
    Affects Versions: 3.2.6
         Environment: Annotations 3.3.1 GA, ehcache 1.3
            Reporter: Stephane Nicoll
            Priority: Critical


I have an application with ehcache as second-level cache which is working fine. Because we have another app that may access the database as well, we have started to activate the caches replication. Since then, we see ClassCastException for basically any request that is issued on the system.

I've isolated two main cases

Case 1: ClassCastException in DefaultInitializeCollectionEventListener, line 129

CollectionCacheEntry cacheEntry = (CollectionCacheEntry) persister.getCacheEntryStructure()
						.destructure(ce, factory);

the persister returns a UnstructuredCacheEntry instead of a CollectionCacheEntry. I have checked with the debugger and the metadata are fine. For the record, here's the metadata about this cached relations

    @OneToMany(
            mappedBy = "catalogItem",
            fetch = FetchType.LAZY,
            targetEntity = MetadataItemEntity.class)
    @Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.erdas.rsp.babel.DefaultCollectionCache")
    private Set<MetadataItemEntity> metadata = new TreeSet<MetadataItemEntity>();

Case 2: ClassCastException in StructuredMapCacheEntry,line 27

Map map = (Map) item; 

where item is a CollectionCacheEntry array (empty in this case). It relates to another relation that is working perfectly fine if cache replication is disabled

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list