Configuring JBoss AS 5 JMS for MySQL
To round-out the JBoss AS 5 clustering stuff, I figured I'd add a little how-to for configuring JMS to use MySQL.
This is covered in the docs, but what the hell (the example DS config files leaves out transaction stuffs, which produces an warning like this: DataSource connection transaction isolation should be READ_COMMITTED, but it is currently REPEATABLE_READ.).
{jbossdir} = your jboss dir {serverdir} = your server dir {jbossdir}/server/{serverdir}
Firstly, create a mysql datasource file:{serverdir}/deploy/mysql-ds.xml
Fill it with something along these lines:
<jndi-name> DefaultDS</jndi-name>
<connection-url> jdbc:mysql://yourMySQLhost:3306/jbossjms</connection-url>
<driver-class> com.mysql.jdbc.Driver</driver-class>
<user-name> yourUsername</user-name>
<password> yourUserPassword</password>
<exception-sorter-class-name> org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<transaction-isolation> TRANSACTION_READ_COMMITTED</transaction-isolation>
<min-pool-size> 5</min-pool-size>
<max-pool-size> 20</max-pool-size>
<idle-timeout-minutes> 0</idle-timeout-minutes>
<metadata>
<type-mapping> mySQL</type-mapping>
</metadata>
</local-tx-datasource>
Delete the {serverdir}/deploy/hsqldb-ds.xml file.
Then delete the {serverdir}/deploy/messaging/hsqldb-persistence-service.xml file.
Copy {jbossdir}/docs/examples/jms/mysql-persistence-service.xml file to {serverdir}/deploy/messaging/mysql-persistence-service.xml.
If you're using clustering, be sure to set Clustered to true in mysql-persistence-service.xml.
Um, guess that's it.
轉自:http://coldshen.com/blog/index.cfm/2009/3/8/Configuring-JBoss5-JMS-for-MySQL