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:

<local-tx-datasource>
<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.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Gary Gilbert's Gravatar I am guessing both nodes point to the same mySQL instance for the JMS or?
# Posted By Gary Gilbert | 9/22/09 2:53 AM
coldshen's Gravatar ja, I think the idea is to get that data someplace where a node going down doesn't take out the db. On the data tier vs. the app server tier, so to speak.
# Posted By coldshen | 9/22/09 9:52 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.3.000. Contact Blog Owner