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.  [ 5 posts ] 
Author Message
 Post subject: Problem in Implementing OSCache with Hibernate
PostPosted: Wed Dec 19, 2007 10:12 am 
Newbie

Joined: Thu Jun 28, 2007 9:39 am
Posts: 9
Hi,
I am implementing OSCache 2.4 with Hibernate 3.1

I have copied oscache.jar and commons-logging.jar files in WEB_INF/lib directory and oscache.properties file in WEB-INF/classes directory.
i have also placed provider_class in hibernate config file.


After running my hibernate method, i am getting following exception

java.lang.ClassNotFoundException: com.opensymphony.oscache.hibernate.OSCacheProvider

If anybody has implemented OSCache with hibernate, then it will be a great help for us.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 10:41 am 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
post more details about the environment.
it seems it is just a config issue in the environment.

_________________
Dinesh Mahadevan

Visit me at http://www.yelani.com/


Top
 Profile  
 
 Post subject: please get more details
PostPosted: Wed Dec 19, 2007 11:05 am 
Newbie

Joined: Thu Jun 28, 2007 9:39 am
Posts: 9
Hi,
I am using Hibernate 3.1, OSCache 2.4 and Eclipse 3.3

As per the installation guidelines, i have copied the oscache.jar file at WEB-INF/lib and oscache.properties file at WEB-INF/classes

I have also included the oscache.jar file in the build path of eclipse.

I have put few lines in hibernate config file as below:
<property name="hibernate.cache.provider_class">
com.opensymphony.oscache.hibernate.OSCacheProvider
</property>
<property name="com.opensymphony.oscache.configurationResourceName">oscache.properties</property>
<property name="hibernate.cache.use_second_level_cache">true</property>

Now when i am running the java method through eclipse, the class loader is not able to find the class OSCacheProvider.class but this class is present in the com/opensymphony/oscache/hibernate directory.


We are getting this exception

Initial SessionFactory creation failed.org.hibernate.HibernateException: could not instantiate CacheProvider: com.opensymphony.oscache.hibernate.OSCacheProvider
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.ms.epr.db.dao.HibernateUtil.<clinit>(HibernateUtil.java:22)
at com.ms.epr.util.EPRUtils.getDataByQuery(EPRUtils.java:203)
at com.ms.epr.core.TestCode.getLeftOuterJoinData(TestCode.java:26)
at com.ms.epr.core.TestCode.main(TestCode.java:41)
Caused by: org.hibernate.HibernateException: could not instantiate CacheProvider: com.opensymphony.oscache.hibernate.OSCacheProvider
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:378)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:245)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at com.ms.epr.db.dao.HibernateUtil.<clinit>(HibernateUtil.java:18)
... 3 more
Caused by: java.lang.ClassNotFoundException: com.opensymphony.oscache.hibernate.OSCacheProvider
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:375)
... 7 more

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 12:04 pm 
Beginner
Beginner

Joined: Fri May 18, 2007 10:28 am
Posts: 48
Location: Madison, WI
Looks like a classpath issue. It is not finding the jar properly.

_________________
Please rate if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 21, 2007 12:47 pm 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
post the environment settings you are running on, not application settings.
also detail, how you are compiling and publishing

_________________
Dinesh Mahadevan

Visit me at http://www.yelani.com/


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