Using a JNDI datasource under ServiceMix JBI


These instructions will help you configure a JNDI DataSource for Apache ODE when running inside the ServiceMix JBI container.

1. Edit $SERVICEMIX/conf/jndi.xml

Declare a managed connection factory pointing to your database:

<bean id="odeManagedConnectionFactory" class="org.jencks.tranql.DataSourceMCF">
    <property name="driverName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://hostname/databaseName"/>
    <property name="user" value="username"/>
    <property name="password" value="myPassword"/>

And register the DataSource in the JNDI registry by adding an <entry> under the <util:map> element:

<util:map id="jndiEntries">

    <!-- ODE DataSource -->
    <entry key="java:comp/env/jdbc/ode">
        <bean id="odeDataSource" class="org.jencks.factory.ConnectionFactoryFactoryBean">
            <property name="managedConnectionFactory" ref="odeManagedConnectionFactory"/>
            <property name="connectionManager" ref="connectionManager"/>

    <!-- ... other entries follow... -->


2. Edit

In, set the following properties:


(Be sure to match the JNDI lookup name to the one defined in $SERVICEMIX/conf/jndi.xml)

3. Add jencks-2.0-all library

Copy jencks-2.0-all.jar under $SERVICEMIX/lib

4. Restart ServiceMix

And you're done! Don't forget to redeploy your service assemblies since they need to be re-synchronized with ODE.


Connection Pool Parameters

If you want to manually configure the connection pool parameters, edit $SERVICEMIX/conf/tx.xml and update the "poolingSupport" object. For example,

<jencks:poolingSupport id="poolingSupport"
    poolMinSize="20" />