﻿<?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-fantasyginge-文章分类-工作流之jBPM</title><link>http://www.blogjava.net/fantasyginge/category/6929.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 02 Mar 2007 03:32:52 GMT</lastBuildDate><pubDate>Fri, 02 Mar 2007 03:32:52 GMT</pubDate><ttl>60</ttl><item><title>jBPM 弃用jndi DataSource</title><link>http://www.blogjava.net/fantasyginge/articles/27674.html</link><dc:creator>fantasyginge</dc:creator><author>fantasyginge</author><pubDate>Thu, 12 Jan 2006 02:23:00 GMT</pubDate><guid>http://www.blogjava.net/fantasyginge/articles/27674.html</guid><wfw:comment>http://www.blogjava.net/fantasyginge/comments/27674.html</wfw:comment><comments>http://www.blogjava.net/fantasyginge/articles/27674.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fantasyginge/comments/commentRss/27674.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fantasyginge/services/trackbacks/27674.html</trackback:ping><description><![CDATA[jBPM 弃用jndi DataSource<BR><BR>&nbsp;&nbsp; 昨天胡搞了一天，虽然弄好了jBPM的数据库设置，但是经过昨晚回去查看Help 关于deployment的文档和相关的源码，终于弄出最简单的方法。<BR><BR><BR>Help Deployment中关于jbpm.properties
<DIV></DIV>
<P>Following properties can be specified in the jbpm.properties configuration file</P>
<DIV class=table><A name=jbpm.properties.table></A>
<P class=title><B>Table&nbsp;5.2.&nbsp;</B></P>
<TABLE border=1>
<COLGROUP>
<COL>
<COL>
<COL></COLGROUP>
<THEAD>
<TR>
<TH align=middle>Property</TH>
<TH align=middle>Default Value</TH>
<TH align=middle>Description</TH></TR></THEAD>
<TBODY>
<TR>
<TD>jbpm.session.factory.jndi.name</TD>
<TD>&nbsp;</TD>
<TD>if specified, the JbpmSessionFactory.getInstance() method will fetch the singleton instance from the given JNDI location. Otherwise a new JbpmSessionFactory will be created upon initialization of the singleton instance.</TD></TR></TBODY></TABLE></DIV><BR><BR>源码中的这个JbpmSessionFactory.java类中<BR>&nbsp;public static JbpmSessionFactory getInstance() {<BR>&nbsp;&nbsp;&nbsp; if (instance==null) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if there is a JNDI name configured<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (jndiName!=null) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // fetch the JbpmSessionFactory from JNDI<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.debug("fetching JbpmSessionFactory from '"+jndiName+"'");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitialContext initialContext = new InitialContext();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object o = initialContext.lookup(jndiName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; instance = (JbpmSessionFactory) PortableRemoteObject.narrow(o, JbpmSessionFactory.class);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception e) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException("couldn't fetch JbpmSessionFactory from jndi '"+jndiName+"'");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else { // else there is no JNDI name configured<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create a new default instance.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.debug("building singleton JbpmSessionFactory");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; instance = buildJbpmSessionFactory();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; return instance;<BR>&nbsp; }<BR><BR>可以看到只可以修改jbpm.properties文件就ok了。<BR><BR><BR>现在行动！编辑jbpm\deploy\jbpm.sar中的jbpm.sar.cfg.jar文件<BR><BR>将JbpmSessionFactory修改如下<BR>jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl<BR>jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance<BR>#jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory<BR>jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg.xml<BR>#jbpm.hibernate.properties=jbpm.hibernate.properties<BR><BR>因此jbpm.hibernate.properties也可以删除了，之后修改jbpm.hibernate.cfg.xml和另外一个文件的数据库配置，另外弄个数据库的driver就ok啦！！！<img src ="http://www.blogjava.net/fantasyginge/aggbug/27674.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fantasyginge/" target="_blank">fantasyginge</a> 2006-01-12 10:23 <a href="http://www.blogjava.net/fantasyginge/articles/27674.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM之WebSale换用MySQL DataSource</title><link>http://www.blogjava.net/fantasyginge/articles/27632.html</link><dc:creator>fantasyginge</dc:creator><author>fantasyginge</author><pubDate>Wed, 11 Jan 2006 11:07:00 GMT</pubDate><guid>http://www.blogjava.net/fantasyginge/articles/27632.html</guid><wfw:comment>http://www.blogjava.net/fantasyginge/comments/27632.html</wfw:comment><comments>http://www.blogjava.net/fantasyginge/articles/27632.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/fantasyginge/comments/commentRss/27632.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fantasyginge/services/trackbacks/27632.html</trackback:ping><description><![CDATA[<P>&nbsp;&nbsp;根据公司工作需要，这个元旦开始才选定用jBPM工作流引擎，什么东西都是一片空白，而jBPM的example WebSale程序是选用的技术却是jsf, hibernate，一时无所适从。<BR>&nbsp; 没办法只好硬着头皮啃下去，jsf，hibernate<BR>&nbsp; 这两天都快抓狂了！！！无论如何都不能使用自己创建的mysql数据库<IMG height=19 src="http://www.blogjava.net/Emoticons/cry_smile.gif" width=19 border=0><BR>&nbsp; 就快放弃的时候，老天终于眷顾我啦！！！<IMG height=19 src="http://www.blogjava.net/Emoticons/regular_smile.gif" width=19 border=0><BR><BR><BR>&nbsp;&nbsp; 根据一些前人的blog和工作流群上的人的指点，现总结以下两种配置用mysql数据库datasource的方法。<BR><BR>（一）需要改jBPM源码（这个方法不太好，但是可以读读源码，了解机制）<BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体"><FONT size=3>配置连接<SPAN lang=EN-US> MySQL 
<P></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">1. </SPAN><SPAN style="FONT-FAMILY: 宋体">在<SPAN lang=EN-US>jbpm-3.0\lib</SPAN>目录下 创建<SPAN lang=EN-US>mysql</SPAN>目录<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">2. </SPAN><SPAN style="FONT-FAMILY: 宋体">将<SPAN lang=EN-US> mysql</SPAN>数据库驱动<SPAN lang=EN-US> (mysql-connector-java-3.1.7-bin.jar) copy</SPAN>到<SPAN lang=EN-US>mysql </SPAN>目录<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">3. </SPAN><SPAN style="FONT-FAMILY: 宋体">在<SPAN lang=EN-US> mysql </SPAN>中创建一个数据库，数据库名字<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">4. </SPAN><SPAN style="FONT-FAMILY: 宋体">在<SPAN lang=EN-US>jbpm-3.0\src\resources</SPAN>目录下创建<SPAN lang=EN-US>mysql</SPAN>目录<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">5. </SPAN><SPAN style="FONT-FAMILY: 宋体">把两个配置文件<SPAN lang=EN-US> (create.db.hibernate.properties, identity.db.xml) </SPAN>从<SPAN lang=EN-US>hsqldb</SPAN>目录下 拷贝到<SPAN lang=EN-US>mysql</SPAN>目录<SPAN lang=EN-US> <BR>create.db.hibernate.properties文件中内容参考如下：<BR><BR># these properties are used by the build script to create <BR># a hypersonic database in the build/db directory that contains <BR># the jbpm tables and a process deployed in there</SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN style="FONT-FAMILY: 宋体"><SPAN lang=EN-US>hibernate.dialect=org.hibernate.dialect.MySQLDialect<BR>hibernate.connection.driver_class=com.mysql.jdbc.Driver<BR>hibernate.connection.url=jdbc:mysql://localhost:3306/jbpm<BR>hibernate.connection.username=jbpm<BR>hibernate.connection.password=jbpm<BR>hibernate.c3p0.min_size=1<BR>hibernate.c3p0.max_size=3<BR>hibernate.show_sql=true<BR><BR>6. 在jbpm\lib下创建mysql目录，放进mysql的jdbc&nbsp; driver<BR><BR>7.修改build.deploy.xml&nbsp; 文件中create.db task<BR><BR>&lt;target name="create.db" depends="declare.jbpm.tasks, db.clean" description="creates a hypersonic database with the jbpm tables and loads the processes in there"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;jbpmschema actions="create" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties"/&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;loadidentities file="${basedir}/src/resources/mysql/identity.db.xml" properties="${basedir}/src/resources/mysql/create.db.hibernate.properties"/&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;ant antfile="build.xml" target="build.processes" inheritall="false" /&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;deploypar properties="${basedir}/src/resources/mysql/create.db.hibernate.properties"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;fileset dir="build" includes="*.par" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/deploypar&gt;<BR>&nbsp;&nbsp; &lt;/target&gt;<BR><BR><BR><BR>&nbsp;<SPAN style="FONT-FAMILY: 宋体">因为<SPAN lang=EN-US> Hibernate </SPAN>不能将它的<SPAN lang=EN-US>SessionFactory</SPAN>与<SPAN lang=EN-US>tomcat</SPAN>的<SPAN lang=EN-US>jndi </SPAN>绑定<SPAN lang=EN-US> , </SPAN>我们直接在源码中修改<SPAN lang=EN-US> </P>
<P></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">9. </SPAN><SPAN style="FONT-FAMILY: 宋体">打开源文件<SPAN lang=EN-US> JbpmSessionFactory.java, </SPAN>在<SPAN lang=EN-US> getInstance() </SPAN>方法里<SPAN lang=EN-US>, </SPAN>删除下面代码<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>InitialContext initialContext = new InitialContext();<BR>&nbsp;Object o = initialContext.lookup(jndiName); 
<P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体"><FONT size=3>将下面这行<SPAN lang=EN-US> 
<P></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>instance = (JbpmSessionFactory) <BR>PortableRemoteObject.narrow(o, JbpmSessionFactory.class); 
<P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体"><FONT size=3>替换为<SPAN lang=EN-US> instance = (JbpmSessionFactory) <BR>PortableRemoteObject.narrow(<BR>new JbpmSessionFactory(createConfiguration()), JbpmSessionFactory.class); 
<P></SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">10.</SPAN><SPAN style="FONT-FAMILY: 宋体">在<SPAN lang=EN-US> createConfiguration(String configResource) </SPAN>方法里<SPAN lang=EN-US>, </SPAN>注释掉这段代码<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>String hibernatePropertiesResource = <BR>JbpmConfiguration.getString("jbpm.hibernate.properties"); 
<P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>if (hibernatePropertiesResource!=null) <BR>{ <BR>&nbsp;&nbsp; Properties hibernateProperties = new Properties(); <BR>
<P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>&nbsp;&nbsp; try <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hibernateProperties.load( <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClassLoaderUtil.getStream(hibernatePropertiesResource) );&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR></FONT></SPAN><FONT size=3><SPAN lang=EN-US style="FONT-FAMILY: 宋体">&nbsp;&nbsp; catch (IOException e) <BR>&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "couldn't load the hibernate properties" + <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " from resource '"hibernatePropertiesResource"'", e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; log.debug("overriding hibernate properties with "+ hibernateProperties); configuration.setProperties(hibernateProperties);&nbsp;<BR>&nbsp;} <BR></SPAN><SPAN style="FONT-FAMILY: 宋体"><BR>同时加入下面的代码<SPAN lang=EN-US> 
<P></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); configuration.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver"); configuration.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/";); configuration.setProperty("hibernate.connection.username", ""); 
<P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>configuration.setProperty("hibernate.connection.password", ""); 
<P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体"><FONT size=3>configuration.setProperty("hibernate.connection.pool_size", "15"); 
<P></FONT></SPAN>11.这种方法需要先开starter-kit中的jboss，然后build websale，最后deploy<BR><BR>参考文章：<BR><A href="http://mdvjiangbin.bokee.com/3185679.html">http://mdvjiangbin.bokee.com/3185679.html</A><BR><A href="/znjqolf/archive/2005/12/19/24654.html">http://www.blogjava.net/znjqolf/archive/2005/12/19/24654.html</A><BR>还有好多，查过之后都忘了链接了，谢谢前人的总结！<BR><BR><BR><BR>方法二：<BR>1，在starter-kit server中部署的jbpm应用里的deploy目录中创建mysql-ds.xml<BR><BR>文件内容参考如下：<BR>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</P>
<P>&lt;!-- The Hypersonic embedded database JCA connection factory config<BR>$Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ --&gt;</P>
<P>&lt;datasource&gt;<BR>&nbsp;&nbsp; &lt;local-tx-datasource&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The jndi name of the DataSource, it is prefixed with java:/ --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- Datasources are not available outside the virtual machine --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;jndi-name&gt;DefaultDS&lt;/jndi-name&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- for tcp connection, allowing other processes to use the hsqldb<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;connection-url&gt;jdbc:hsqldb:hsql://localhost:1701&lt;/connection-url&gt;<BR>--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- for totally in-memory db, not saved when jboss stops. <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The org.jboss.jdbc.HypersonicDatabase mbean necessary<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;connection-url&gt;jdbc:hsqldb:.&lt;/connection-url&gt;<BR>--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- for in-process persistent db, saved when jboss stops. The<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown<BR>--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;connection-url&gt;jdbc:mysql://localhost:3306/jbpm&lt;/connection-url&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The driver class --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The login and password --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;user-name&gt;jbpm&lt;/user-name&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;password&gt;jbpm&lt;/password&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--example of how to specify class that determines if exception means connection should be destroyed--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--exception-sorter-class-name&gt;org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter&lt;/exception-sorter-class-name--&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- this will be run before a managed connection is removed from the pool for use by a client--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--&lt;check-valid-connection-sql&gt;select * from something&lt;/check-valid-connection-sql&gt; --&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;min-pool-size&gt;5&lt;/min-pool-size&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The maximum connections in a pool/sub-pool --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;max-pool-size&gt;20&lt;/max-pool-size&gt;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The time before an unused connection is destroyed --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections --&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;idle-timeout-minutes&gt;0&lt;/idle-timeout-minutes&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;/local-tx-datasource&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;metadata&gt;<BR>&nbsp;&nbsp;&lt;type-mapping&gt;mySQL&lt;/type-mapping&gt;<BR>&nbsp;&nbsp;&lt;/metadata&gt;<BR>&nbsp;&lt;/datasource&gt;<BR><BR><BR>2，删除该目录有关hsqldb&nbsp; 设置datasource的两个xml文件。<BR><BR>3，edit 上一目录conf下的standardjaws.xml中的这段<BR>&lt;datasource&gt;java:/DefaultDS&lt;/datasource&gt;<BR>&nbsp;&nbsp; &lt;type-mapping&gt;mySQL&lt;/type-mapping&gt;<BR>让type-mapping对应mysql-ds.xml中的type-mapping<BR><BR>Step 4: JMS configuration descriptors <BR>a) Remove hsqldb-jdbc2-service.xml from folder deploy/jms. Save this file somewhere else. </P>
<P>b) Copy mysql-jdbc2-service.xml from folder docs/example/jms to deploy/jms. </P>
<P>c) Edit mysql-jdbc2-service.xml and change the datasource name if applicable. In my configuration I don't use HSQL at all so I configured the default datasource DefaultDS for MySQL. In this file, change mySQLDS to DefaultDS. Note that datasource names are case sensitive. </P>
<P>Step 5: Install MySQL Java Connector <BR>Download MySQL Connector/J and place the file mysql-connector-java-3.0.15-ga-bin.jar in the lib folder of the server. <BR><BR><BR><BR>！！！同时需要修改deploy中jbpm.sar文件夹里的jbpm.sar.cfg.jar文件，更新该文件里面的数据库配置<BR><BR><BR>参考文章：<BR><A href="http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAMysqlDatasource">http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAMysqlDatasource</A><BR><A href="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;p=3861605">http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;p=3861605</A><BR><BR></P></SPAN></SPAN></FONT><img src ="http://www.blogjava.net/fantasyginge/aggbug/27632.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fantasyginge/" target="_blank">fantasyginge</a> 2006-01-11 19:07 <a href="http://www.blogjava.net/fantasyginge/articles/27632.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>