Monday, May 12, 2014

How to add PostgreSQL JDBC driver to JBoss as core module?

1.   Check the support version of the PostgreSQL JDBC driver that is supported with JBoss version that you are using in "JBoss Enterprise Application Platform (EAP) 6 Supported Configurations"

For example, JBoss 6.2 is supported with PostgreSQL 9.2 JDBC4 Postgresql Driver.

2.   Download the PostgreSQL JDBC Driver from PostgreSQL JDBC Drivers download page.

3.  Place the download jar file postgresql-9.2-1004.jdbc4.jar under

     $EAP_HOME/modules/org/postgresql/main/

4.   Create XML file $EAP_HOME/modules/org/postgresql/main/module.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
   <resources>
     <resource-root path="postgresql-9.2-1004.jdbc4.jar"/>
   </resources>
   <dependencies>
     <module name="javax.api"/>
     <module name="javax.transaction.api"/>
   </dependencies>
</module>

5.   Restart JBoss domain/standalone servers to get the new module loaded using:

     # service jboss-as-domain.sh restart

6. Start the jboss-cli in connected mode:

     $EAP_HOME/bin/jboss-cli.sh --connect

7.   Execute the below command in CLI:

     /profile=full/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

NOTE:
Use the above bold values in all steps because this caused some pain while configuring this by myself :) any inconsistency in names, paths, parameters will cause this error:


JBAS010441: Failed to load module for driver [org.postgres]





4 comments:

  1. I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.
    Java Courses in chennai

    ReplyDelete
  2. Hey!

    DigiPeek is the best SEO & Link Building Service Provider In The World. I have 7+ Years Experience To Build SEO, Backlinks & Improve Website Ranking.

    If you need Profile Backlinks, Forum Backlinks, Dofollow Backlinks, Manual Backlinks, Trusted SEO Backlinks, Increase Domain Rating Then You Will Contact Me.

    I am glad to help You!

    Let's TRY!

    ReplyDelete