6 Replies Latest reply on Jun 28, 2006 5:51 PM by grfalk

    JDBC persistence configuration examples?

    Richard Dunn Newbie

      I am trying to change the persistence store to PostgreSQL according to 5.2 in the JBossMessagingGettingStarted.pdf.

      JBoss Messaging is shipped with several pm configuration files for the most commonly used
      database servers such as Oracle, mySQL or MSSQL. These files are located in /docs/examples/config


      It specifies:

      To change the pm configuration, navigate to /server/$SERVER_CONF/deploy/jboss-messaging.sar/META-INF
      and edit jboss-service.xml From the example folder, copy the mbean definition that is appropriate for your data-
      base server e.g. mysql-jdbcpersistencemanager-service.xml Paste it in place of the existing one then restart the
      server.


      However, in the jboss-messaging-1.0.0.Beta1.zip I find no such collection of examples, other than MySQL. I assume this is an oversight. Is there anywhere I can download an example PostgreSQL? I will attempt to roll my own in the meantime, but would prefer one already tested by someone more familiar with JBoss Messaging.

      I have everything apparently working according to the example test cases, but I found a few glitches (like the above), and the apparent omission (or mis-configuration by me) of the file note at the beginning of Chapter 5:

      Note: In JBoss Messaging 1.0 most of those services are configurable via mbean definitions which are all located
      in jboss-messaging.sar/META-INF/jboss-service.xml. In the next release, configurations will be broken down
      into separate xml files.


      The closest thing I see to it is:
      $JBOSS_HOME/server/messaging/tmp/deploy/tmp26612jboss-messaging-scoped.sar


      From the path, I assume this is a dynamically deployed/created instance and not one I would edit (and it does not have a file system entry that corresponds to jboss-messaging.sar/META-INF/jboss-service.xml anyway).

      Any corrections, comments, pointers, URL's, etc. greatly appreciated.

      I apologize if I should have separated this post into two, but it all falls into trying to change the JDBC persistence to PostgreSQL and I assume most or all is a mis-configuration problem on my end.

        • 1. Re: JDBC persistence configuration examples?
          Richard Dunn Newbie

          In case this may influence analysis of the problem I am running this on Mac OS X 10.4.6, java version "1.5.0_05", jboss-4.0.4.CR2.zip, and setup the messaging environment using the create-messaging-config.xml in the jboss-messaging-1.0.0.Beta1.zip.

          • 2. Re: JDBC persistence configuration examples?
            Ovidiu Feodorov Master

             

            However, in the jboss-messaging-1.0.0.Beta1.zip I find no such collection of examples, other than MySQL. I assume this is an oversight. Is there anywhere I can download an example PostgreSQL? I will attempt to roll my own in the meantime, but would prefer one already tested by someone more familiar with JBoss Messaging.


            There is an 1.0.0.GA out already. However, it doesn't come with a bundled Postgresql example. If you wait a few days, the example will be available in 1.0.1: http://jira.jboss.org/jira/browse/JBMESSAGING-350

            Or, if you need it right now, check out this http://www.jboss.org/index.html?module=bb&op=viewtopic&t=81151.

            • 3. Re: JDBC persistence configuration examples?
              grfalk Newbie

              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:
              4a) Modified <connection-url>, <user-name> and < password > tag data per my taget database's configuration
              4b) Set the <jndi-name> to "DefaultDS"
              4c) Set the <type-mapping> to "PostgreSQL 8.1" [note that setting this to "PostgreSQL 8.1.2" (my actual database version) caused errors - so there is a limited set of <type-mapping> metadata values defined somewhere]
              5) Removed file $JBOSS_HOME/server/messaging/deploy/hsqldb-ds.xml
              6) Copied $MESSAGING_HOME/examples/config/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 currently databases currently supported by JBoss Messaging.

              JBoss experts... if I violated any "safe practices" or have llisted any redundant/unneeded steps, please critique and/or correct any information I presented.

              Thank you.

              • 4. Re: JDBC persistence configuration examples?
                Tim Fox Master

                Sounds reasonable.

                Although the type mapping step is probably not necessary.

                We should probably create a wiki page on this....

                • 5. Re: JDBC persistence configuration examples?
                  Ovidiu Feodorov Master

                  Thanks a lot. Please feel free to post your document here http://www.jboss.com/wiki/Wiki.jsp?page=JBossMessaging