Tuesday, May 13, 2014

Installing JBoss EAP 6.2 on RedHat Linux

In this tutorial, I will be installing JBoss EAP 6.2 that will be using Oracle JDK 1.6 Update 45 on Red Hat Linux.

1.   Download Oracle jdk-6u45-linux-x64.bin
2.   Download JBoss EAP 6.2 (jboss-eap-6.2.0.zip) from JBoss download page.
3.   Create jboss user which will install and manage JBoss using:

     # adduser jboss 
     # su - jboss

4.   Copy the downloaded JDK and JBoss to the jboss home /home/jboss
5.   Install the JDK this extract the JBoss using:

      [jboss@lab04 ~]$ ./jdk-6u45-linux-x64.bin
      [jboss@lab04 ~]$ unzip jboss-eap-6.2.0.zip

6.   To setup JBoss as OS service and make it start automatically, use:

      [root@lab04 ~]# mkdir /etc/jboss-as
      [root@lab04 ~]# cp /home/jboss/jboss-eap-6.2/bin/init.d/jboss-as.conf /etc/jboss-as/.
      [root@lab04 ~]# cp /home/jboss/jboss-eap-6.2/bin/init.d/jboss-as-domain.sh /etc/init.d/.
      [root@lab04 ~]# cd /etc/init.d/
      [root@lab04 init.d]# chkconfig --add jboss-as-domain.sh
      [root@lab04 init.d]# chkconfig jboss-as-domain.sh on

7.   Edit the following parameters in /etc/jboss-as/jboss-as.conf

      JBOSS_USER=jboss
      JBOSS_HOME=/home/jboss/jboss-eap-6.2
      JAVA_HOME=/home/jboss/jdk1.6.0_45 

8. Now, you can start the domain using:

      [root@lab04 init.d]# service jboss-as-domain.sh start

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]