風(fēng)人園

          弱水三千,只取一瓢,便能解渴;佛法無邊,奉行一法,便能得益。
          隨筆 - 99, 文章 - 181, 評論 - 56, 引用 - 0
          數(shù)據(jù)加載中……

          JBPM Hibernate cache

          JBPM Hibernatecache

          Applies to: JBPM 3.1.2, JBoss 4.0.5-GA

          Everything starts with a beautiful concept but has to pass past those nasty errors. The same applies to this JBPM project, everything was nice, I have seen it running and then I was supposed to take the sources, clean, organize and enhance. Everything ok until now. The only problem is that when deploying the JBPM (sar) service there was this error:

          16:09:17,402 ERROR [CommandExecutorThread] org.hibernate.HibernateException: Could not instantiatecacheimplementation

          The first idea was to enable DEBUG logging but the result was not much cleared:

          org.hibernate.HibernateException: Could not instantiatecacheimplementation
          at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:64)
          at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:214)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
          at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90)
          at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:74)
          at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:78)
          at org.jbpm.persistence.db.DbPersistenceService.getMessagingSession(DbPersistenceService.java:235)
          at org.jbpm.JbpmContext.getMessagingSession(JbpmContext.java:521)
          at org.jbpm.msg.db.DbMessageService.<init>(DbMessageService.java:49)
          at org.jbpm.msg.db.DbMessageServiceFactory.openService(DbMessageServiceFactory.java:32)
          at org.jbpm.svc.Services.getService(Services.java:136)
          at org.jbpm.svc.Services.getMessageService(Services.java:172)
          at org.jbpm.msg.command.CommandExecutorThread.executeCommand(CommandExecutorThread.java:112)
          at org.jbpm.msg.command.CommandExecutorThread.run(CommandExecutorThread.java:79)
          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)
          ... 13 more
          16:09:17,402 DEBUG [JbpmContext] closing JbpmContext
          16:09:17,402 DEBUG [Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@71dfd7
          16:09:17,402 ERROR [CommandExecutorThread] org.hibernate.HibernateException: Could not instantiatecacheimplementation

          Apparently the cacheimplementationcould not been found or it was expecting some configuration properties which where not set. I checked in my deploy/lib directory and the ehcache.jar was there. I started to modify the hibernate.hbm.xml which was basically the one from the jbpm examples and which was not working.

          First successful try:
          <property name="hibernate.cache.use_second_level_cache">false</property>
          <property name="hibernate.cache.use_query_cache">false</property>
          This seems to work, however it disables all the cache which is not exactly what I want.

          Second successful try:

          <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
          <!--
          <property name="hibernate.cache.use_second_level_cache">false</property>
          <property name="hibernate.cache.use_query_cache">false</property>
          -->

          In the mean time I also tried:

          <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
          <!--
          <property name="hibernate.cache.use_second_level_cache">false</property>
          <property name="hibernate.cache.use_query_cache">false</property>
          -->

          which also worked.
          Apparently all was related to this in hibernate documentation, as it seems EhCache is no longer a default implementation and this was what JPBM was complaing about:

          "You have the option to tell Hibernate which caching implementation to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider? using the property hibernate.cache.provider_class. ... Note that versions prior to 3.2 defaulted to use EhCache as the default cache provider; that is no longer the case as of 3.2."

          Warning: just undeploying/deploying the sar gave me very unreplicable results. The only way I could verify the configuration correctly each way was to restart the container :((

          Links with helped me with this:

          posted on 2007-01-16 08:58 風(fēng)人園 閱讀(1905) 評論(0)  編輯  收藏 所屬分類: JBoss

          主站蜘蛛池模板: 铜陵市| 阿拉善盟| 北辰区| 乐山市| 庄河市| 红安县| 嘉禾县| 宁都县| 永康市| 平定县| 山西省| 平乐县| 榆林市| 故城县| 会理县| 青神县| 皋兰县| 湟源县| 张家口市| 竹溪县| 雅安市| 固镇县| 大宁县| 闻喜县| 喀什市| 临海市| 洞头县| 阿拉善右旗| 沽源县| 万载县| 屏山县| 湛江市| 怀远县| 晋宁县| 鸡泽县| 西乌珠穆沁旗| 通州区| 定边县| 广元市| 永泰县| 克东县|