Hibernate version:2.1.7c
Hi, I have deployed some applications that use the exact same classes in Jboss 3.2.6 and they work fine using the HashTableCache (which I understand shouldnt be used). However, when I switched to EhCache, a strange behavior happens:
1. I log into my first app, everything's fine.
2. I log out, then I try logging into the other one, an error occurs:
Debug level Hibernate log excerpt:
Code:
2004-12-13 12:57:07,000 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache lookup: 152
2004-12-13 12:57:07,000 DEBUG [net.sf.hibernate.cache.EhCache] key: 152
2004-12-13 12:57:07,000 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache hit: 152
2004-12-13 12:57:07,000 DEBUG [net.sf.hibernate.impl.SessionImpl] resolved object in second-level cache [com.app.User#152]
2004-12-13 12:57:07,187 INFO [STDOUT] net.sf.hibernate.MappingException: Unknown entity class: com.app.User
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2710)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2142)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:204)
at net.sf.hibernate.type.ComponentType.resolveIdentifier(ComponentType.java:405)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2218)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:315)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:305)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3648)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
at net.sf.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:385)
at com.app.DAO.UserDAO.getByLogin(UserDAO.java:130)
(more...)
As you can see, the cache classes arent isolated, since at first use the new application has a cache hit when it shouldnt (The cache is the same for both apps). Maybe hibernate can't find the mapped class, since when there are isolation problems in Jboss the most common symptom are ClassCastExceptions. If I get back to HashtableCache it works fine.
The solution, I thought, was including the ehcache jar in the ear an especifying it a module in application.xml, but it doesnt even get to deploy the hibernate har..
Has anyone been here before? Thanks in advance..