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.
|