-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Could not instantiate cache implementation
PostPosted: Sun Feb 19, 2006 5:40 am 
Newbie

Joined: Sun Feb 19, 2006 5:04 am
Posts: 3
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 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.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 XML
Code:
<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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 19, 2006 8:23 am 
Regular
Regular

Joined: Wed Jun 29, 2005 11:14 pm
Posts: 119
Location: København
Daft question but have you got ehcache and the other required jars (dom4j I think is the only one for ehcache) on the classpath?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 19, 2006 8:18 pm 
Newbie

Joined: Sun Feb 19, 2006 5:04 am
Posts: 3
timrobertson100 wrote:
Daft question but have you got ehcache and the other required jars (dom4j I think is the only one for ehcache) on the classpath?


Yes I already have all the required jars in path, namely, I have ehcache-0.7.jar and dom4j-1.3.jar already in the classpath.


Top
 Profile  
 
 Post subject: Could not instantiate cache implementation
PostPosted: Sun Feb 19, 2006 9:19 pm 
Newbie

Joined: Sun Feb 19, 2006 5:04 am
Posts: 3
I have been able to find solution for the issue.

I had incorrectly used tag attributes in ehcache.xml that are not supported by version 0.7 of EHCache.

After I removed those tag attributes I no longer any exception while instantiating cache.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.