﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-风人园-文章分类-JBoss</title><link>http://www.blogjava.net/wuxufeng8080/category/19251.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 09 Mar 2007 13:49:05 GMT</lastBuildDate><pubDate>Fri, 09 Mar 2007 13:49:05 GMT</pubDate><ttl>60</ttl><item><title>JBoss下配置log4j</title><link>http://www.blogjava.net/wuxufeng8080/articles/102610.html</link><dc:creator>风人园</dc:creator><author>风人园</author><pubDate>Thu, 08 Mar 2007 07:55:00 GMT</pubDate><guid>http://www.blogjava.net/wuxufeng8080/articles/102610.html</guid><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 12pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<font color="#000080">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">log4j</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">是一个优秀的开源的<span lang="EN-US">java</span>日志系统，<span lang="EN-US">jboss</span>内部也集成了它，在<span lang="EN-US">jboss</span>下默认的只是对<span lang="EN-US">server</span>做了每日日志，并没有对你部署的项目进行每日的日志构建，但我们可以通过修改<span lang="EN-US">log4j.xml</span>文件来实现。<span lang="EN-US">log4j.xml</span>文件在<span lang="EN-US">jboss</span>安装目录下的<span lang="EN-US">server\default\conf</span>下，打开<span lang="EN-US">log4j.xml</span>文件<span lang="EN-US"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span></span>
				</font>
		</p>
		<table class="MsoNormalTable" style="BACKGROUND: burlywood; WIDTH: 760px; HEIGHT: 1069px; mso-cellspacing: 0cm; mso-padding-alt: 0cm 0cm 0cm 0cm" cellspacing="0" cellpadding="0" width="760" border="1">
				<tbody>
						<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
								<td style="BORDER-RIGHT: #d4d0c8; PADDING-RIGHT: 0cm; BORDER-TOP: #d4d0c8; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">  </span>
												<span style="FONT-SIZE: 12pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">这是<span lang="EN-US">log4j</span>默认的配置，我们先熟悉一下<span lang="EN-US"><br /></span></span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">  &lt;!-- ============================== --&gt;<br />  &lt;!-- Append messages to the console --&gt;<br />  &lt;!-- ============================== --&gt;<br />    <span style="COLOR: navy">&lt;!--</span></span>
												<span style="FONT-SIZE: 12pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">输出方式：输出到控制台<span lang="EN-US">--&gt;</span></span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<br />    &lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&gt;<br /></span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">    <span style="COLOR: navy">&lt;!-- </span></span>
												<span style="FONT-SIZE: 12pt; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">设置通道名称：<span lang="EN-US">console</span>和输出方式：<span lang="EN-US">org.apache.log4j.RollingFileAppender <span style="BACKGROUND: burlywood"><br /></span>           </span>其中输出方式<span lang="EN-US" style="BACKGROUND: burlywood">appender</span><span style="BACKGROUND: burlywood">有<span lang="EN-US">5</span>种<span lang="EN-US">,</span>分别为<span lang="EN-US"><br />           org.apache.log4j.ConsoleAppender (</span>控制台<span lang="EN-US">)  <br />           org.apache.log4j.FileAppender (</span>文件<span lang="EN-US">)<br />           org.apache.log4j.DailyRollingFileAppender (</span>每天产生一个日志文件<span lang="EN-US">)<br />           org.apache.log4j.WriterAppender (</span>将日志信息以流格式发送到任意指定的地方<span lang="EN-US">)--&gt;</span></span></span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<br />    &lt;param name="Target" value="System.out"/&gt;<br />    &lt;param name="Threshold" value="INFO"/&gt;<br />      <span style="COLOR: navy">&lt;!--Threshold</span></span>
												<span style="FONT-SIZE: 12pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">是个全局的过滤器，它将把低于所设置的<span lang="EN-US">level</span>的信息过滤不显示出来<span lang="EN-US">--&gt;<br />      &lt;!--level:</span>是日记记录的优先级，优先级由高到低分为<span lang="EN-US"> <br />          OFF ,FATAL ,ERROR ,WARN ,INFO ,DEBUG ,ALL</span>。<span lang="EN-US"><br />          Log4j</span>建议只使用<span lang="EN-US">FATAL ,ERROR ,WARN ,INFO ,DEBUG</span>这四个级别。<span lang="EN-US">--&gt;</span></span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">    &lt;layout class="org.apache.log4j.PatternLayout"&gt;<br /><span style="COLOR: navy">       &lt;!-- </span></span>
												<span style="FONT-SIZE: 12pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">配置日志输出的格式<span lang="EN-US">--&gt;<br /></span></span>
												<span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">              </span>
												<span style="FONT-SIZE: 10pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">参数都以<span lang="EN-US">%</span>开始后面不同的参数代表不同的格式化信息（参数按字母表顺序列出）：</span>
												<span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: burlywood; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<br /> </span>
												<span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">             %c     </span>
												<span style="FONT-SIZE: 10pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">输出所属类的全名，可在修改为<span lang="EN-US"> %d{Num} ,Num</span>类名输出的围<span lang="EN-US">  </span>如：<span lang="EN-US">"org.apache.elathen.ClassName",<br />                                                                               %C{2}</span>将输出elathen.ClassName<span lang="EN-US"> <br />                                                                                            <br />              %d     </span>输出日志时间其格式为<span lang="EN-US"> %d{yyyy-MM-dd HH:mm:ss,SSS}</span>，可指定格式 如<span lang="EN-US"> %d{HH:mm:ss}<br />              %l     </span>输出日志事件发生位置，包括类目名、发生线程，在代码中的行数<span lang="EN-US"><br />              %n     </span>换行符<span lang="EN-US"><br />              %m     </span>输出代码指定信息，如<span lang="EN-US">info(“message”),</span>输出<span lang="EN-US">message<br />              %p     </span>输出优先级，即<span lang="EN-US"> FATAL ,ERROR </span>等<span lang="EN-US"><br />              %r     </span>输出从启动到显示该<span lang="EN-US">log</span>信息所耗费的毫秒数<span lang="EN-US"><br />              %t     </span>输出产生该日志事件的线程名</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; COLOR: navy; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<br />
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">      &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;<br />      &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/&gt;<br />    &lt;/layout&gt;<br />  &lt;/appender&gt;<br /><br /> <font color="#000080"> &lt;!输出方式是：每天一个日志文件&gt;</font><br />  &lt;!-- A time/date based rolling appender --&gt;<br />  &lt;appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender"&gt;<br /><font color="#000080">    &lt;!--设置通道名称是：file，输出方式DailyRollingFileAppender--&gt;</font><br />    &lt;param name="File" value="${jboss.server.home.dir}/log/server.log"/&gt;<br /><font color="#000080">    &lt;!--日志文件路径和文件名称 --&gt;<br /></font>    &lt;param name="Append" value="false"/&gt;<br />   <font color="#000080"> <span class="style1">&lt;!-- 设置是否在重新启动服务时，在原有日志的基础添加新日志 --&gt;</span><br /></font></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">    &lt;!-- Rollover at midnight each day --&gt;<br />    &lt;param name="DatePattern" value="'.'yyyy-MM-dd"/&gt;<br /><br /></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">    &lt;!-- Rollover at the top of each hour<br />    &lt;param name="DatePattern" value="'.'yyyy-MM-dd-HH"/&gt;<br />    --&gt;<br /><br /></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">    &lt;layout class="org.apache.log4j.PatternLayout"&gt;<br />      &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;<br />      &lt;param name="ConversionPattern" value="%d %-5p [%c] %m%n"/&gt;</span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; BACKGROUND: burlywood; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">      &lt;!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n<br />      &lt;param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/&gt;<br />       --&gt;<br />    &lt;/layout&gt;     <br />  &lt;/appender&gt;<br /></span>
										</p>
								</td>
						</tr>
				</tbody>
		</table>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p>
								<br />
								<font color="#000080"> 上面是jboss下log4j的默认配置，对jboss的server进行日志记录，接下来我们添加web项目的日志，在log4j.xml<br />  文件中把下面的配置信息加上去就可以了</font>
								<br />
								<br />
								<table style="BACKGROUND: burlywood; WIDTH: 751px; HEIGHT: 100px" height="100" cellspacing="0" cellpadding="0" width="751" border="1">
										<tbody>
												<tr>
														<td>
																<p>  &lt;!-- A size based file rolling appender--&gt;<br />  &lt;appender name="com.szypt.all" class="org.jboss.logging.appender.RollingFileAppender"&gt;<br />    &lt;param name="File" value="${jboss.server.home.dir}/log/elathen.log"/&gt;<br />    &lt;param name="Append" value="true"/&gt;<br />    &lt;param name="MaxFileSize" value="500KB"/&gt;<br />    &lt;param name="MaxBackupIndex" value="1"/&gt;</p>
																<p>    &lt;layout class="org.apache.log4j.PatternLayout"&gt;<br />      &lt;param name="ConversionPattern" value="%d %-5p [%c] %m%n"/&gt;<br />    &lt;/layout&gt;     <br />  &lt;/appender&gt;<br /><br />  &lt;logger name="com.szypt"&gt; <br />    &lt;level value="DEBUG" /&gt;<br />    &lt;appender-ref ref="com.szypt.all"/&gt;<br />  &lt;/logger&gt;</p>
														</td>
												</tr>
										</tbody>
								</table>
						</o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/wuxufeng8080/aggbug/102610.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wuxufeng8080/" target="_blank">风人园</a> 2007-03-08 15:55 <a href="http://www.blogjava.net/wuxufeng8080/articles/102610.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBPM Hibernate cache</title><link>http://www.blogjava.net/wuxufeng8080/articles/94081.html</link><dc:creator>风人园</dc:creator><author>风人园</author><pubDate>Tue, 16 Jan 2007 00:58:00 GMT</pubDate><guid>http://www.blogjava.net/wuxufeng8080/articles/94081.html</guid><description><![CDATA[
		<p class="documentDescription">JBPM <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Hibernate</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span></p>
		<div class="plain">
				<p>Applies to: JBPM 3.1.2, JBoss 4.0.5-GA</p>
				<p>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:<br /></p>
				<pre>16:09:17,402 ERROR [CommandExecutorThread] org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Hibernate</font></span>Exception: <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Could</font></span> not <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">instantiate</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">implementation</font></span></pre>
				<p>The first idea was to enable DEBUG logging but the result was not much cleared:</p>
				<pre>org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Hibernate</font></span>Exception: <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Could</font></span> not <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">instantiate</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span><font style="BACKGROUND-COLOR: #feff82"><span class="highlightedSearchTerm">implementation</span><br /></font>        at org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Factory.create<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>(<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Factory.java:64)<br />        at org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:214)<br />        at org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.cfg.Configuration.buildSessionFactory(Configuration.java:1218)<br />        at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90)<br />        at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:74)<br />        at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:78)<br />        at org.jbpm.persistence.db.DbPersistenceService.getMessagingSession(DbPersistenceService.java:235)<br />        at org.jbpm.JbpmContext.getMessagingSession(JbpmContext.java:521)<br />        at org.jbpm.msg.db.DbMessageService.&lt;init&gt;(DbMessageService.java:49)<br />        at org.jbpm.msg.db.DbMessageServiceFactory.openService(DbMessageServiceFactory.java:32)<br />        at org.jbpm.svc.Services.getService(Services.java:136)<br />        at org.jbpm.svc.Services.getMessageService(Services.java:172)<br />        at org.jbpm.msg.command.CommandExecutorThread.executeCommand(CommandExecutorThread.java:112)<br />        at org.jbpm.msg.command.CommandExecutorThread.run(CommandExecutorThread.java:79)<br />Caused by: org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.NoCachingEnabledException: Second-level <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span> is not enabled for usage [<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_second_level_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span> | <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_query_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>]<br />        at org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.No<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Provider.build<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>(No<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Provider.java:21)<br />        at org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Factory.create<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>(<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Factory.java:61)<br />        ... 13 more<br />16:09:17,402 DEBUG [JbpmContext] closing JbpmContext<br />16:09:17,402 DEBUG [Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@71dfd7<br />16:09:17,402 ERROR [CommandExecutorThread] org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Hibernate</font></span>Exception: <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Could</font></span> not <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">instantiate</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span><font style="BACKGROUND-COLOR: #feff82"><span class="highlightedSearchTerm">implementation</span><br /></font></pre>
				<p>Apparently the <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">implementation</font></span><span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">could</font></span> not been found or it was expecting some configuration properties which where not set. I checked in my deploy/lib directory and the eh<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.jar was there. I started to modify the <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.hbm.xml which was basically the one from the jbpm examples and which was not working.<br /></p>First successful try:<br /><pre>&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_second_level_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>"&gt;false&lt;/property&gt;<br />&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_query_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>"&gt;false&lt;/property&gt; <br /></pre>This seems to work, however it disables all the <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span> which is not exactly what I want.<br /><br /><p>Second successful try:</p><pre>&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.provider_class"&gt;org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.Eh<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Provider&lt;/property&gt;<br />&lt;!-- <br />&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_second_level_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>"&gt;false&lt;/property&gt;<br />&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_query_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>"&gt;false&lt;/property&gt; <br />--&gt;<br /></pre><br /><p>In the mean time I also tried:<br /></p><pre>&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.provider_class"&gt;org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.Hashtable<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Provider&lt;/property&gt;<br />&lt;!-- <br />&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_second_level_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>"&gt;false&lt;/property&gt;<br />&lt;property name="<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.use_query_<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>"&gt;false&lt;/property&gt;  <br />--&gt;<br /></pre><p>which also worked. <br />Apparently all was related to <span class="link-external"><a href="http://http://www.hibernate.org/hib_docs/v3/reference/en/html/performance.html#performance-cache"><font color="#436976">this in <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span> documentation</font></a></span>, as it seems Eh<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span> is no longer a default <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">implementation</font></span> and this was what JPBM was complaing about:</p><p>"You have the option to tell <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Hibernate</font></span> which caching <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">implementation</font></span> to use by specifying the name of a class that implements org.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span>Provider  using the property <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span>.provider_class. ... Note that versions prior to 3.2 defaulted to use Eh<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">Cache</font></span> as the default <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span> provider; that is no longer the case as of 3.2."</p><p>Warning: just undeploying/deploying the sar gave me very unreplicable results. The only way I <span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">could</font></span> verify the configuration correctly each way was to restart the container :((</p><p>Links with helped me with this:</p><ul><li><span class="link-external"><a class="generated" href="http://www.hibernate.org/hib_docs/v3/reference/en/html/performance.html#performance-cache"><font color="#436976">http://www.<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">hibernate</font></span>.org/hib_docs/v3/reference/en/html/performance.html#performance-<span class="highlightedSearchTerm"><font style="BACKGROUND-COLOR: #feff82">cache</font></span></font></a></span></li><li><span class="link-external"><a class="generated" href="http://jboss.org/index.html?module=bb&amp;op=viewtopic&amp;t=93522&amp;postdays=0&amp;postorder=asc&amp;start=10"><font color="#436976">http://jboss.org/index.html?module=bb&amp;op=viewtopic&amp;t=93522&amp;postdays=0&amp;postorder=asc&amp;start=10</font></a></span><br /></li></ul></div>
<img src ="http://www.blogjava.net/wuxufeng8080/aggbug/94081.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wuxufeng8080/" target="_blank">风人园</a> 2007-01-16 08:58 <a href="http://www.blogjava.net/wuxufeng8080/articles/94081.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>