-->
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.  [ 15 posts ] 
Author Message
 Post subject: Problem with cache
PostPosted: Tue Dec 09, 2003 11:14 am 
Beginner
Beginner

Joined: Thu Oct 02, 2003 8:02 am
Posts: 45
I was using Hibernate 2.0.3 and all was OK.
Now i use hibernate 2.1rc1. So i replace hibernate.jar (2.0.3) by hibernate.jar(2.1rc1) and when i execute the application to access BD, i have the following error message :

INFO: cache provider: net.sf.ehcache.hibernate.Provider
net.sf.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.ehcache.hibernate.Provider at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:115)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1072)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:718

What does it means? Are there others files specially needed for 2.1rc excepting hibernate.jar

THANKS


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 11:25 am 
Regular
Regular

Joined: Wed Nov 05, 2003 10:57 pm
Posts: 96
You need to include ehcache.jar in your classpath.

mota


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 11:36 am 
Beginner
Beginner

Joined: Thu Oct 02, 2003 8:02 am
Posts: 45
OK. But now, in TOMCAT, i have the message :

java.lang.NoClassDefFoundError: net/sf/cglib/core/KeyFactory


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 11:40 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read the TXT file in the lib/ subdirectory of the distribution. Copy all "required" files to your WEB-INF/lib.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 12:11 pm 
Beginner
Beginner

Joined: Thu Oct 02, 2003 8:02 am
Posts: 45
I copy all required files but it still doesn't work.

java.lang.IllegalAccessError
net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:87)
net.sf.cglib.core.ClassEmitter.(ClassEmitter.java:79)
net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:197)
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:186)
net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:177)
net.sf.cglib.core.KeyFactory.create(KeyFactory.java:149)
net.sf.cglib.core.KeyFactory.create(KeyFactory.java:142)
net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:229)
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:720)
com.cfort.dao.HibernateSession.currentSession(HibernateSession.java:33)
com.cfort.dao.HibernateDAOFactory.creerConnection(HibernateDAOFactory.java:30)
com.cfort.dao.HibernateUtilisateurDAO.existe(HibernateUtilisateurDAO.java:77)
com.cfort.service.UtilisateurService.existeUtilisateur(UtilisateurService.java:71)
com.cfort.struts.action.InscrireAction.execute(InscrireAction.java:83)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

I don't understand this message. Here is my hibernate.cfg.xml file

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/portail</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>

<mapping resource="utilisateur.hbm.xml"/>
</session-factory>
</hibernate-configuration>

THANKS


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 12:13 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Make sure you remove all old libraries before. This is a FAQ:

http://www.hibernate.org/?cmd=srchdoc&q=java.lang.IllegalAccessError

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 4:46 am 
Newbie

Joined: Wed Aug 27, 2003 3:09 am
Posts: 17
If i don't want to use any cache, how can i omit the ehcache.jar?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 7:30 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can't

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 2:11 pm 
Newbie

Joined: Wed Aug 27, 2003 3:09 am
Posts: 17
so the ehcache is merely instantiated without being used, if i don't configure it?

I don't know why i am forced to include a not used jar in 2.1.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 2:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Shouldn't you be able to drop ehcache.jar if you set hibernate.cache.provider_class = net.sf.hibernate.cache.HashtableCacheProvider ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 7:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Shouldn't you be able to drop ehcache.jar if you set hibernate.cache.provider_class = net.sf.hibernate.cache.HashtableCacheProvider


Yes.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 11:18 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
So if I set the cache provider to be HastableCacheProvider and none of my class mappings include the "cache" element, then I've effectivle switched the 2nd-level cache off?

I ask because the HashTableCacheProvider is marked "not for production use".

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 6:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Exactly - If you have no cache elements configured, no caching will be done


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 11:46 am 
Beginner
Beginner

Joined: Thu Oct 09, 2003 3:42 pm
Posts: 22
gavin wrote:
Quote:
Shouldn't you be able to drop ehcache.jar if you set hibernate.cache.provider_class = net.sf.hibernate.cache.HashtableCacheProvider


Yes.


I've set my cache provider as shown above and none of my mapping files contain "cache" elements but I still need to include ehcache.jar to get things running.

Any ideas?

-marc


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 11:58 am 
Beginner
Beginner

Joined: Thu Oct 09, 2003 3:42 pm
Posts: 22
I take that back... Everything's working as expected


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 15 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.