-->
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.  [ 7 posts ] 
Author Message
 Post subject: could not instantiate CacheProvider
PostPosted: Mon Dec 01, 2003 5:45 am 
Newbie

Joined: Wed Oct 08, 2003 11:27 am
Posts: 18
Hi,

I'm trying to use hibernate 2.1 beta 5 and I get the following error while it's starting. What could be the problem?


11:25:05,633 INFO [net.sf.hibernate.cfg.Environment:432] Hibernate 2.1 beta 5 11:25:05,679 INFO [net.sf.hibernate.cfg.Environment:466] loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=onix, hibernate.connection.url=jdbc:mysql://localhost/booky3, hibernate.connection.password=********, hibernate.statement_cache.size=25, hibernate.connection.pool_size=1} 11:25:05,679 INFO [net.sf.hibernate.cfg.Environment:480] using java.io streams to persist binary types 11:25:05,679 INFO [net.sf.hibernate.cfg.Environment:481] using CGLIB reflection optimizer 11:25:05,695 INFO [net.sf.hibernate.cfg.Configuration:303] Mapping resource: ro/level7/booky3/beans/Client.hbm.xml
11:25:06,099 INFO [net.sf.hibernate.cfg.Binder:197] Mapping class: ro.level7.booky3.beans.Client -> clients 11:25:06,471 INFO [net.sf.hibernate.cfg.Configuration:303] Mapping resource: ro/level7/booky3/beans/Clientp1.hbm.xml
11:25:06,549 INFO [net.sf.hibernate.cfg.Binder:197] Mapping class: ro.level7.booky3.beans.Clientp1 -> clientp1 11:25:06,549 INFO [net.sf.hibernate.cfg.Configuration:303] Mapping resource: ro/level7/booky3/beans/Country.hbm.xml
11:25:06,595 INFO [net.sf.hibernate.cfg.Binder:197] Mapping class: ro.level7.booky3.beans.Country -> country 11:25:06,642 INFO [net.sf.hibernate.cfg.Configuration:563] processing one-to-many association mappings 11:25:06,642 INFO [net.sf.hibernate.cfg.Binder:1077] Mapping collection: ro.level7.booky3.beans.Country.clients -> clients 11:25:06,657 INFO [net.sf.hibernate.cfg.Configuration:572] processing one-to-one association property references 11:25:06,657 INFO [net.sf.hibernate.cfg.Configuration:597] processing foreign key constraints 11:25:06,797 INFO [net.sf.hibernate.dialect.Dialect:82] Using dialect: net.sf.hibernate.dialect.MySQLDialect
11:25:06,828 WARN [net.sf.hibernate.cfg.SettingsFactory:50] No dialect set - using GenericDialect: Could not instantiate dialect class 11:25:06,828 INFO [net.sf.hibernate.dialect.Dialect:82] Using dialect: net.sf.hibernate.dialect.GenericDialect
11:25:06,828 INFO [net.sf.hibernate.cfg.SettingsFactory:58] Maximim outer join fetch depth: 1 11:25:06,828 INFO [net.sf.hibernate.cfg.SettingsFactory:62] Use outer join fetching: false 11:25:06,844 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider:41] Using Hibernate built-in connection pool (not for production use!) 11:25:06,844 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider:42] Hibernate connection pool size: 1 11:25:06,859 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider:71] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/booky3 11:25:06,859 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider:72] connection properties: {user=onix, password=abracadabra} 11:25:06,875 INFO [net.sf.hibernate.transaction.TransactionManagerLookupFactory:33] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 11:25:07,356 INFO [net.sf.hibernate.cfg.SettingsFactory:89] Use scrollable result sets: true 11:25:07,356 INFO [net.sf.hibernate.cfg.SettingsFactory:99] Query language substitutions: {no='N', true=1, yes='Y', false=0} 11:25:07,371 INFO [net.sf.hibernate.cfg.SettingsFactory:110] cache provider: net.sf.hibernate.cache.JCSCacheProvider
net.sf.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.hibernate.cache.JCSCacheProvider
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:115)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1023)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:716)
at ro.level7.common.db.directimpl.ManagerImpl.configure(ManagerImpl.java:85)
at ro.level7.booky3.plugins.core.CorePlugin.initDB(CorePlugin.java:135)
at ro.level7.booky3.plugins.core.CorePlugin.handleMessage(CorePlugin.java:167)
at ro.level7.bootstrap.BootstrapPanel.messageCommon(BootstrapPanel.java:317)
at ro.level7.bootstrap.BootstrapPanel.sendMessage(BootstrapPanel.java:345)
at ro.level7.bootstrap.BootstrapUtils.sendMessage(BootstrapUtils.java:58)
at ro.level7.bootstrap.BootstrapPanel.run(BootstrapPanel.java:65)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.ClassCastException
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:112)
... 10 more


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 6:04 am 
Beginner
Beginner

Joined: Fri Nov 28, 2003 3:45 am
Posts: 23
Location: malaysia
Hello,


pls look into the following settings in the hibernate.properties. I believe it got something to do with your hibernate.properties setting.

#################################
### Plugin ConnectionProvider ###
#################################

## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)

hibernate.connection.provider_class net.sf.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.ProxoolConnectionProvider



#######################
### Transaction API ###
#######################

## the Transaction API abstracts application code from the underlying JTA or JDBC transactions

#hibernate.transaction.factory_class net.sf.hibernate.transaction.JTATransactionFactory
hibernate.transaction.factory_class net.sf.hibernate.transaction.JDBCTransactionFactory


## choose a cache implementation

hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider
#hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider
#hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.SwarmCacheProvider



## MySQL

hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class org.gjt.mm.mysql.Driver
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost/booky3,
hibernate.connection.username onix
hibernate.connection.password abracadabra





-------------------------------------------------------------------------

normal output would look something like this

Dec 1, 2003 5:56:29 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=Administrator, password=}
Dec 1, 2003 5:56:29 PM net.sf.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
Dec 1, 2003 5:56:29 PM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Dec 1, 2003 5:56:29 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
Dec 1, 2003 5:56:29 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
Dec 1, 2003 5:56:29 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {no='N', yes='Y'}
Dec 1, 2003 5:56:29 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.HashtableCacheProvider
Dec 1, 2003 5:56:29 PM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
Dec 1, 2003 5:56:30 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Dec 1, 2003 5:56:30 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 6:13 am 
Newbie

Joined: Wed Oct 08, 2003 11:27 am
Posts: 18
Same error. :(


12:08:03,510 INFO [net.sf.hibernate.cfg.SettingsFactory:110] cache provider: net.sf.hibernate.cache.HashtableCacheProvider
net.sf.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.hibernate.cache.HashtableCacheProvider
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:115)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1023)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:716)
at ro.level7.common.db.directimpl.ManagerImpl.configure(ManagerImpl.java:85)
at ro.level7.booky3.plugins.core.CorePlugin.initDB(CorePlugin.java:135)
at ro.level7.booky3.plugins.core.CorePlugin.handleMessage(CorePlugin.java:167)
at ro.level7.bootstrap.BootstrapPanel.messageCommon(BootstrapPanel.java:317)
at ro.level7.bootstrap.BootstrapPanel.sendMessage(BootstrapPanel.java:345)
at ro.level7.bootstrap.BootstrapUtils.sendMessage(BootstrapUtils.java:58)
at ro.level7.bootstrap.BootstrapPanel.run(BootstrapPanel.java:65)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.ClassCastException
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:112)
... 10 more
Process terminated with exit code 1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 12:54 pm 
Newbie

Joined: Fri Sep 19, 2003 1:19 pm
Posts: 18
Be sure that the file:

%orion_home%\lib\ehcache.jar

is in your classpath.


Top
 Profile  
 
 Post subject: what cache provider do you use?
PostPosted: Mon Dec 01, 2003 5:37 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
Are you using ehcache? JCS caching? The errors keep changing. :)

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 6:17 pm 
Newbie

Joined: Fri Sep 19, 2003 1:19 pm
Posts: 18
Sorry, I jumped the gun a bit.

I am actually not using caching.

I had just downloaded 2.1rc1, installed and executed app and received:

net.sf.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.ehcache.hibernate.Provider

Searched for net.sf.ehcache.hibernate.Provider in the jar files and discovered that ehcache.jar was needed in my classpath for app to execute.

I am guessing that Hibernate pulls in net.sf.ehcache.hibernate.Provider by default.

I did not read the error messages deep enough to distinguish the differences in cache provider classes.

Anyway,

I searched for JcsCacheProvider and HashTableCacheProvider and found that they are both in Hibernate2.jar - at least in 2.1rc1.

Just a hunch, in your properties file, do you have the proper end-of-line charaters at the end of each record. Sometimes between unix and dos they can get botched up and have a hidden control code at the end of each line.


Top
 Profile  
 
 Post subject: suggestion: turn off caching
PostPosted: Mon Dec 01, 2003 6:38 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
If the problem is the caching system, as it appears to be, you should try turning it off, initially. Does your hibernate.properties or hibernate.cfg.xml file contain an entry:

hibernate.cache.provider_class ?

If so, you should start that line with a pound sign to disable it (for now). That should take the errored section out of the loop so you can continue and get it working.

Regards,
David


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