Version 7

    How to configure PostgreSQL for JBoss Mail Server 1.0M3


    versions: 1.0M3


    Easy way


    The easy way to configure PostgreSQL for JBMS 1.0M3 is to use the graphical installer and select "generate datasource", put in your server/user information then download the PostgreSQL JDBC driver and copy it into your $JBOSS_HOME/server/$CONFIG/lib directory.  Do a full restart and you're ready to start. 


    Hard way


    The harder way to configure MySQL for JBMS 1.0M3 is to copy the datasource descriptor example from $JBOSS_HOME/docs/examples/jca/postgresql-ds.xml to the $JBOSS_HOME/server/$CONFIG/deploy directory.  Edit this replacing the user and server information with the information related to your database.  Following this you need to ensure that some additional information is in the JBMS jboss-service.xml descriptor.




    Adding PostgreSQL specific parts to the descriptor


    In the jboss-service.xml you need to ensure that the following is defined.  (You may also want to remove

    any alternatively defined "Store" implementations.)


                    PostgreSQL base store that uses the LargeObjectAPI
                    in order to store data.
            <mbean code=""
                    <attribute name="Disconnected">true</attribute>
                    <attribute name="DataSource">java:/YOUR_DATASOURCE_NAME</attribute>
                    <attribute name="PageSize">131072</attribute>
            <!-- Mail Body Manager -->
            <mbean code="org.jboss.mail.message.MailBodyManager"
                    <attribute name="UseStore">true</attribute>
                    <depends optional-attribute-name="Store"


    There is also an addition descriptor that you must change called $JBOSS_HOME/server/$CONFIG/deploy/mail.ear/mail.har/META-INF/hibernate-service.xml.  Ensure it reads as follows:


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
            <mbean code="org.jboss.hibernate.jmx.Hibernate"
                            <attribute name="DatasourceName">java:/YOUR_DATASOURCE_NAME</attribute>
                            <attribute name="SessionFactoryName">java:/jbossmail.HibernateSessionFactory</attribute>
    <!-- IMPORTANT -->
                            <attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
                            <attribute name="Hbm2ddlAuto">update</attribute>
                            <attribute name="ShowSqlEnabled">false</attribute>
                   <!--attribute name="CacheProviderClass">
                            <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>


    Be sure and replace all of the YOUR_DATASOURCE_NAME strings above with the name you defined in your postrgesql-ds.xml.


    That's basically it.  You will need to restart the underlying JBAS instance after making this change.