In this post I going to explain how to switch JBossESB and JBossAS persistence from the default HSQL embedded database to a “real” database like MySQL, the persistence configuration of JMS, jUDDI, ESB MessageStore, jBPM, Drools and EJB needs updating. It is not necessary to change Drools and EJB config but we will get some imcomplete deployment warnings during the startup of the server so we will change all config to obtain an all-configured server.

Note: I will use two notations to refer two different path and I suppose that you have deployed JBossESB into JBossAS with an ant task.

/server/default/deploy = $deploy
/docs/examples= $example

JMS

We should update and remove some files to get the right configuration. Let’s go:

1.- rm $deploy/jms/hsqldb-jdbc2-service.xml
2.- cp $example/jms/mysql–jdbc2-service.xml to $deploy/jms/
3.- mv $deploy/jms/hsqldb-jdbc-state-service.xml to $deploy/jms/mysql-jdbc-state-service.xml
4.- cp $example/jca/mysql-ds.xml to $deploy/jms/
5.-
Update the “Secutiry domain for JBossMQ” in /server/default/conf/login-config.xml to java:/MySqlDS

Once you got it, update mysql-jdbc-state-service.xml to point to thw MySQL datasource and put personal MySQL connection config in mysql-ds.xml file.

1.- <depends optional-attribute-name=”ConnectionManager”>jboss.jca:service=DataSourceBinding,name=MySqlDS</depends>

jBPM

Although jBPM v4.1 is newer and better, JBossESb 4.5 have been tested with jBPM 3.2.5. We should update three files in $deploy/jbpm.esb directory.

1.- cp $example/jca/mysql-ds.xml to $deploy/jbpm.esb/jbpm-ds.xml and change MySQL connection properties. However, you must change jndi-name, make sure the <jndi-name>JbpmDS</jndi-name>
2.- Update hibernate.cfg.xml dialect: <property name=”hibernate.dialect”>org.hibernate.dialect.MySQLDialect</property>
3.- Update the $deploy/jbpm.esb/jbpm-service.xml so it points to the mysql sql file:
<attribute name=”SqlFiles”>jbpm-sql/jbpm.jpdl.mysql.sql,jbpm-sql/import.sql</attribute>

MessageStore

We will do the same here:

1.- cp $example/jca/mysql-ds.xml to $deploy/jbossesb.esb/message-store-ds.xml and change MySQL connection properties. However, you must change jndi-name, make sure the <jndi-name>JBossESBDS</jndi-name>
2.- Update the $deploy/jbossesb.esb/jbossesb.service.xml
to point to the mysql sql for creating the message table: <attribute name=”SqlFiles”>message-store-sql/mysql/create_database.sql</attribute>

jUDDI

To obtain jUDDI tables:

1.- cp $example/jca/mysql-ds.xml to $deploy/jbossesb.sar/juddi-ds.xml and change MySQL connection properties. However, you must change jndi-name, make sure the <jndi-name>juddiDB</jndi-name>
2.- Update the $deploy/jbossesb.sar/esb.juddi.xml
to point to the mysql sql for creating the juddi table: <entry key=”juddi.sqlFiles”>juddi-sql/mysql/create_database.sql,juddi-sql/mysql/import.sql</entry>

EJB persistence

The Timer and The HiLo service are not used by JBossMQ although by removing any datasource with jndi name “DefaultDS” it will fail to deploy.

1.- The Timer Service, in $deploy/ejb-deployer.xml please update the optional attribute “Datasource” on the EJBTimerService MBean to “MySqlDS”
2.- The HiLo Service, in $deploy/uuid-key-generator/META-INF please update the optional attribute “Datasource” on the EJBTimerService MBean to “MySqlDS”

Drools

Although it is not necessary, if we not change some properties server will throw some “errors” during the startup.

1.- Change inside drools-process-enterprise-5.0.0.M4.jar and drools-process-task-5.0.0.M4.jar META-INF/persistence.xml “Datasource” attribute to point to “MySqlDS” instead of “DefaultDS”

To finish up, make sure MySQL connection (properties) user has table create rights, so that when you start up JBoss it can create the tables. Make sure too you add the mysql jdbc driver jar to the server/default/lib directory. You shoul obtain 76 tables, if you not include the last two configurations (EJB+Drools) you will have 69 tables.

What’s next? Next post will be in Spanish called “Principales factores impulsores de la adopción de tecnologías de servicios y SOA en empresas“.

Anuncios