Version 5

    Postgres 8.1.2 Configuration Example

    (contributed by 'grfalk')



    As a newbie to both JBoss AS and JBoss Messaging, I had a somewhat difficult time configuring JBoss Messaging persistance to run against an "enterprise" database. This was primarily due to a lack of details in the "Getting Started with JBoss Messaging 1.0.1" document, which was my primary source of installation and initial configuration information. (This is not meant as a critique to the fine people at JBoss, as I understand Messaging is still somewhat a work-in-progress, and documentation updates often lag behind - especially between CR releases). After a lot of searches against the JBoss forums and Wiki pages, I was able to piece together a process that finally worked for me. I thought I'd post the steps of this process against this thread to hopefully save another newbie in my position the time is took me to figure it all out.




    My goal was to take the Hypersonic SQL database "out of the picture" and make a PostgreSQL 8.1.2 database instance my "default datasource". Additionally, let me also state that I am using JBoss Messaging as a "standalone" application and I am not utilizing JBoss AS for any other purpose but to support the JBoss Messaging functionality. This process was performed using JBoss AS 4.0.4-GA and JBoss Messaging 1.0.1-CR2.  In the following steps "$JBOSS_HOME" is the JBoss AS installation location and "$MESSAGING_HOME" is the directory where the JBoss Messaging release bundle was extracted.


    1. Performed an install of JBoss AS 4.0.4-GA using Web Install and selecting the "default" profile.

    2. Executed the Ant task $MESSAGING_HOME/util/release-admin.xml

    3. Copied file $JBOSS_HOME/docs/examples/jca/postgres-ds.xml to $JBOSS_HOME/server/messaging/deploy

    4. Edited $JBOSS_HOME/server/messaging/deploy/postgres-ds.xml as follows:

      1. Modified <connection-url>, <user-name> and <password> tag data per my taget database's configuration

      2. Set the <jndi-name> to "DefaultDS"

      3. Set the <type-mapping> to "PostgreSQL 8.1"

        1. Note that setting value this to "PostgreSQL 8.1.2" (my actual database version) caused errors; there must be set of <type-mapping> metadata values defined somewhere

        2. Note that a response (from a JBoss rep) on the forum where this information was originally posted stated that the <type-mapping> entry may no longer be needed

    5. Removed file $JBOSS_HOME/server/messaging/deploy/hsqldb-ds.xml

    6. Copied $MESSAGING_HOME/src/etc/server/default/deploy/postgresql-persistence-service.xml to $JBOSS_HOME/server/messaging/deploy/jboss-messaging.sar

    7. Removed file $JBOSS_HOME/server/messaging/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml

    8. Obtained the appropriate PostgreSQL JDBC3 driver jar file and copied it to $JBOSS_HOME/server/messaging/lib

    9. Edited the PostgreSQL pg_hba.conf configuration file to allow connections from by the JBoss database user from the localhost.

    I then started the server and saw no exceptions. Nine tables were also created in my database instance: hilosequences, jms_channel_mapping, jms_counter, jms_message, jms_message_reference, jms_role, jms_transaction, jms_user and timers.




    I was also able to successfully execute the following installation validation tests found in $MESSAGING_HOME/examples: mdb, queue, secure-socket, stateless and topic.




    Even though the details presented here are specific to PostgreSQL, I believe the same basic steps can be followed when configuring persistence using any of the databases currently supported by JBoss Messaging.





    Referenced by: