Matt: You're right. Correct the mistake, It runs very well. Qin
-----Original Message----- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 31, 2007 12:54 PM To: [email protected] Subject: Re: [appfuse-user] Turn on Ehcache in Appfuse It looks like you have a typo - should be EhCacheProvider instead of EHCacheProvider: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/cache/EhCacheProv ider.html Matt On 1/31/07, Ding, Qin <[EMAIL PROTECTED]> wrote: > > > > > Rob: Thank you for your reply. > > > > I have tried > > web-inf/ehcache.xml > > /web-inf/ehcache.xml > > /WEB-INF/ehcache.xml > > /WEB-INF/classes/ehcache.xml > > /ehcache.xml > > ehcache.xml > > > > seems it does not matter where I put it, it can't be found. > > > > The same error: > > org.springframework.beans.factory.BeanCreationException: > Error creating bean with name 'sessionFactory' defined in ServletContext > resource [/WEB-INF/applicationContext-hibernate.xml]: Invocation of init > method failed; nested exception is > org.hibernate.HibernateException: could not instantiate > CacheProvider: org.hibernate.cache.EHCacheProvider > > Caused by: > > org.hibernate.HibernateException: could not instantiate > CacheProvider: org.hibernate.cache.EHCacheProvider > > > > Once again, I use appfuse 1.9.4. since ehcache is integrated into appfule. > Does anyone have the same problem when using ehcache in appfuse? I don't > know what to do now. I need ideas or suggestions. > > > > Thanks. > > > > Qin > > ________________________________ > > > From: Rob van Oostrum [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 30, 2007 6:55 PM > > To: [email protected] > Subject: Re: [appfuse-user] Turn on Ehcache in Appfuse > > > > > Before you moved it, did you try referencing it as 'ehcache.xml' or > '/ehcache.xml'? The document mentions it's loaded as a classpath resource, > so it would need to be in WEB-INF/classes or in the root of a jar file > inside WEB-INF/lib. > > Just curious why you felt the need to move the file. > > R. > > > On 1/30/07, Ding, Qin <[EMAIL PROTECTED] > wrote: > > > > Rob: thank you for your reply. > > > > Currently in appfuse 1.9.4, the ehcache.xml is in web-inf/classes folder. I > moved it to be with all other configuration resources in web-inf folder. > > > > I added > > < prop key > ="hibernate.cache.provider_configuration_file_resource_path > ">/WEB-INF/ehcache.xml</ prop > > > > > Still got the same error: could not instantiate CacheProvider: > org.hibernate.cache.EHCacheProvider > > > > Qin > > > > > > > ________________________________ > > > From: Rob van Oostrum [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 30, 2007 12:09 PM > > > > To: [email protected] > Subject: Re: [appfuse-user] Turn on Ehcache in Appfuse > > > > > http://ehcache.sourceforge.net/documentation/hibernate.html > > Are you setting this one?: > hibernate.cache.provider_configuration_file_resource_path=/name_of_confi guration_resource > > > The error might be caused by a missing configuration item. > > R. > > > On 1/30/07, Ding, Qin <[EMAIL PROTECTED] > wrote: > > > > From hibernate site, I found I need to change this line > > from > > < prop key =" cache.provider_class "> > org.hibernate.cache.EhCacheProvider </ prop > > > To > > < prop key =" hibernate .cache.provider_class "> > org.hibernate.cache.EhCacheProvider </ prop > > > > > However, it still does not work. I got the different error: > > Invocation of init method failed; nested exception is > org.hibernate.HibernateException: could not instantiate > CacheProvider: org.hibernate.cache.EHCacheProvider > > Caused by: > > org.hibernate.HibernateException: could not instantiate > CacheProvider: org.hibernate.cache.EHCacheProvider > > at > org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.ja va:361) > > at > org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:232 ) > > at > org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933) > > at > org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1 216) > > at > org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFac tory > > > > > > Qin > > > > ________________________________ > > > From: Ding, Qin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 30, 2007 8:45 AM > To: [email protected] > Subject: RE: [appfuse-user] Turn on Ehcache in Appfuse > > > > > Mike: How do you turn the "second_level_cache" on? I've added that to the > applicationConext-hibernate.xml, but still got the same error. > > > > < property name =" hibernateProperties "> > > < props > > > < prop key =" hibernate.dialect "> > @HIBERNATE-DIALECT@ </ prop > > > < prop key =" hibernate.query.substitutions "> > true 'Y', false 'N' </ prop > > > > > < prop key =" > hibernate.cache.use_second_level_cache "> true </ prop > > > < prop key =" cache.provider_class "> > org.hibernate.cache.EhCacheProvider </ prop > > > < prop key =" hibernate.generate_statistics "> > true </ prop > > > > > </ props > > > </ property > > > > > Qin > > > > > > > ________________________________ > > > From: Michael Horwitz [mailto:[EMAIL PROTECTED] > Sent: Monday, January 29, 2007 9:12 AM > To: [email protected] > Subject: Re: [appfuse-user] Turn on Ehcache in Appfuse > > > > > You need to set the hibernate property > hibernate.cache.use_second_level_cache to true, and if you > want to use query caches you need to set hibernate.cache.use_query_cache > true as well. Note that for the query cache you will need to enable caching > on a query by query basis. > > > > > > Mike. > > > > > > > > On 1/29/07, Ding, Qin < [EMAIL PROTECTED]> wrote: > > > > I try to use ehcache in my appfuse 1.9.4 application. > > In applicatonContext-hibernate.xml, <property name="hibernateProperties"> > > I added following: > > <property name="hibernateProperties"> > > <props> > > <prop key="hibernate.dialect">@HIBERNATE-DIALECT@</prop> > > <prop key="hibernate.query.substitutions">true 'Y', false 'N'</prop> > > > > <prop > key="cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> > > <prop key="hibernate.generate_statistics">true</prop> > > </props> > > </property> > > > > In Status pojo, I added this xdoclet attribute: > > [EMAIL PROTECTED] table="status" > > [EMAIL PROTECTED] usage="read-write" > > > > In ehcache.xml, besides the defaultCache, I added > > <cache > > name="com.mycompany.model.Status" > > maxElementsInMemory="10" > > eternal="false" > > timeToIdleSeconds="0" > > timeToLiveSeconds="0" > > overflowToDisk="true" /> > > > > Then I compile and deploy to tomcat, the application failed to start with > very long error stack trace msg. It seems caused by: > > > > Caused by: org.hibernate.cache.NoCachingEnabledException: > Second-level cache is not enabled for usage > [hibernate.cache.use_second_level_cache | > hibernate.cache.use_query_cache ] > > at > org.hibernate.cache.NoCacheProvider.buildCache(NoCacheProvider.java:21) > > at > org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:61) > > ... 142 more > > > > My question: besides what I have done, what else should I add in order to > enable second-level cache? > > > > > > -- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
