• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Exception Could not instantiate CacheProvider

 
Vikram Takkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while compiling my code i am getting this error

"could not instantiate CacheProvider: org.hibernate.cache.EHCacheProvider"

what is the reason.....? suggest me
[ June 27, 2007: Message edited by: Mark Spritzler ]
 
Peter Laurinec
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of such as error you should post whole error message otherwise it is hard to suggest.
I think this might be that you dont have the Hibernate3 classes in classpath.
 
Vikram Takkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my compilation message :

check last few lines of it :-------

0 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.1 rc1
71 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
101 [main] INFO org.hibernate.cfg.Environment - using CGLIB reflection optimizer
131 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
601 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
611 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
2184 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource: contact.hbm.xml
2804 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: package1.Contact -> CONTACT
3005 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
3035 [main] INFO org.hibernate.cfg.Configuration - processing extends queue
3035 [main] INFO org.hibernate.cfg.Configuration - processing collection mappings
3035 [main] INFO org.hibernate.cfg.Configuration - processing association property references
3035 [main] INFO org.hibernate.cfg.Configuration - processing foreign key constraints
3445 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
3455 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
3455 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
3536 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.sybase.jdbc2.jdbc.SybDriver at URL: jdbc:sybase:Tds:10.15.1.28:2638/TOS"?JCONNECT_VERSION=5
3566 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=DBA, password=****}
6580 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: Adaptive Server Anywhere, version: 7.0.4.3538
6580 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: jConnect (TM) for JDBC (TM), version: jConnect (TM) for JDBC(TM)/5.5(Build 25137)/P/EBF10000/JDK12/Sun Jan 6 21:57:04 2002
6700 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.SybaseAnywhereDialect
6740 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
6750 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
6750 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
6750 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
6750 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
6760 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
6760 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: null
6760 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
6760 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
6760 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
6770 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
6810 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
6810 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
6810 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
6810 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
6810 [main] INFO org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.EHCacheProvider
could not instantiate CacheProvider: org.hibernate.cache.EHCacheProvider

Exception in thread "main" java.lang.NullPointerException
at package1.SecondExample.main(SecondExample.java:47)



what i think is that it is not able to find "ehcache.xml" ... thats why gving this error.. please suggest me
 
Peter Laurinec
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes sure.
When you want to use a second-level cache (in your case EHCache), there need to be additional configuration file present according to concrete cache implementation.
In this case you should place ehcache.xml to the same location as your hibernate.cfg.xml.
After this everything should be working. If you have more difficulties on using second-level cache with hibernate try to read this article.

Peter
 
Vikram Takkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i have already made "ehcache.xml" and placed it in the same directory as the "hibernate.cfg.xml"... but i am getting the same error... even i have placed my ehcache.xml file in ecache.jar file.. but the error persists... is there any way that we can insert our ehcache.xml programatically ...please help me...
 
Vikram Takkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am not able to solve the Above problem.... please Help me... how do i remove above Error ... i am stuck at this point .... any help wll be welcomed...
 
Paul Clapham
Sheriff
Posts: 21113
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception in thread "main" java.lang.NullPointerException
at package1.SecondExample.main(SecondExample.java:47)
If this is your problem then I think your diagnosis of the problem is wrong. You're dereferencing a null reference at line 47 of your SecondExample class, in the main() method. Look there.
 
Vikram Takkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right but what i think is that it is not able to find "EHCACHE.XML" file this is why it is giving this error (Null Pointer Exception).. as i change the name of "EHCACHE.XML" to anyname still ,giving the same error so it is not able to find this file .... moreover when i run my program without caching it runs without any error... so i think problem is just of EHCACHE.XML ... if u have any solution i shall b very thankful
[ November 24, 2005: Message edited by: Vikram Takkar ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Weird, we are using ehcache, but we don't have a ehcache.xml file.

Where is your ehcache.jar file. Is it in the same location as the Hibernate jar files?

Mark
 
William Pennell
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try org.hibernate.cache.EhCacheProvider instead of org.hibernate.cache.EHCacheProvider.
 
Ken Ganong
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot.
I ran into this same problem and stared at it for an hour without noticing the EH capitalization.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic