I am trying to configure Second level caching using EhCache. I get HibernateException: Could not instantiate cache implementation
I have a SUPPLEMENT_LOOKUP table which has one-to-many relationship with SUPPLEMENT table. I have given the mapping file info for the both the tables.
Hibernate version:
3.0 alpha
Mapping documents:
SUPPLEMENT_LOOKUP Mapping
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class
name="com.mycompany.SupplementLookup"
table="SUPPLEMENT_LOOKUP"
mutable="false">
<cache usage="read-only" />
<id
name="suppLkpId"
type="long">
<column name="SUPP_LKP_ID" />
<generator class="assigned" />
</id>
<property
name="lkpType"
type="string">
<column
name="LKP_TYPE"
length="20"
not-null="true" />
</property>
<property
name="lkpCode"
type="string">
<column
name="LKP_CODE"
length="20"
not-null="true" />
</property>
<property
name="lkpDesc"
type="string">
<column
name="LKP_DESC"
not-null="true" />
</property>
<property
name="lkpStatus"
type="string">
<column
name="LKP_STATUS"
length="1"
not-null="true" />
</property>
<set
name="opiatesTested"
inverse="true"
lazy="true">
<cache usage="read-only" />
<key>
<column name="OPIATES_TESTED" />
</key>
<one-to-many class="com.mycompany.Supplement" />
</set>
</class>
</hibernate-mapping>
SUPPLEMENT MappingCode:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class
name="com.mycompany.Supplement"
table="SUPPLEMENT">
<id
name="suppId"
type="long">
<column name="SUPP_ID" />
<generator class="assigned" />
</id>
<many-to-one
name="opiatesTested"
class="com.mycompany.SupplementLookup">
<column name="OPIATES_TESTED" />
</many-to-one>
</class>
</hibernate-mapping>
EhCache XMLCode:
<ehcache>
<diskStore path="java.io.tmpdir" />
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="1800"
memoryStoreEvictionPolicy="LRU" />
<cache
name="com.mycompany.SupplementLookup"
maxElementsInMemory="300"
eternal="true"
overflowToDisk="true" />
<cache
name="com.mycompany.Supplement"
maxElementsInMemory="300"
eternal="false"
overflowToDisk="true" />
</ehcache>
Full stack trace of any exception that occurs:Code:
[DEBUG][CacheFactory.createCache()39]-instantiating cache region: com.mycompany.SupplementLookup usage strategy: read-only
[DEBUG][CacheManager.create()177]-Creating new CacheManager with default config
[DEBUG][CacheManager.configure()151]-Configuring ehcache from classpath.
[DEBUG][Configurator.configure()118]-Configuring ehcache from ehcache.xml found in the classpath: zip:C:/bea81/weblogic81/common/nodemanager/edrs_managed811/stage/edrs-local/edrs.jar!/ehcache.xml
[DEBUG][Configuration$DiskStore.setPath()181]-Disk Store Path: C:\WINDOWS\TEMP\
[ERROR][HibernateUtils.<clinit>()74]-org.hibernate.HibernateException: Could not instantiate cache implementation
Name and version of the database:
Oracle 9.2.1.0
Please let me know if above provided information is insufficient.
Thanks,
Abhijat