锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
聽
榪欐槸log4j榛樿鐨勯厤緗紝鎴戜滑鍏堢啛鎮(zhèn)変竴涓?span lang="EN-US">
聽聽聽 <layout class="org.apache.log4j.PatternLayout">
聽聽聽 <!-- Rollover at midnight each day -->
聽聽聽 <!-- Rollover at the top of each hour
聽聽聽 <layout class="org.apache.log4j.PatternLayout">
聽聽聽聽聽 <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n |
聽 <!-- A size based file rolling appender--> 聽聽聽 <layout class="org.apache.log4j.PatternLayout">
聽涓婇潰鏄痡boss涓媗og4j鐨勯粯璁ら厤緗紝瀵筳boss鐨剆erver榪涜鏃ュ織璁板綍錛屾帴涓嬫潵鎴戜滑娣誨姞web欏圭洰鐨勬棩蹇楋紝鍦╨og4j.xml
聽 鏂囦歡涓妸涓嬮潰鐨勯厤緗俊鎭姞涓婂幓灝卞彲浠ヤ簡
聽 <appender name="com.szypt.all" class="org.jboss.logging.appender.RollingFileAppender">
聽聽聽 <param name="File" value="${jboss.server.home.dir}/log/elathen.log"/>
聽聽聽 <param name="Append" value="true"/>
聽聽聽 <param name="MaxFileSize" value="500KB"/>
聽聽聽 <param name="MaxBackupIndex" value="1"/>
聽聽聽聽聽 <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
聽聽聽 </layout>聽聽聽聽
聽 </appender>
聽 <logger name="com.szypt">
聽聽聽 <level value="DEBUG" />
聽聽聽 <appender-ref ref="com.szypt.all"/>
聽 </logger>
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.
<property name="hibernate.cache.use_second_level_cache">false</property>This seems to work, however it disables all the cache which is not exactly what I want.
<property name="hibernate.cache.use_query_cache">false</property>
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: