Wednesday 11 December 2013

Liferay6.1 + Jboss 7.1 + Oracle as datasource

Hi guys,

I have realized that many of us find difficulties while configuring oracle as data source with liferay bundle.

So Today we gonna see that lets get started...

1) Take Liferay+jboss bundle and extract it you will get below folder structure after extraction.

2) create file portal-ext.properties and add below property in that and put this file in liferay-portal home means in the extracted folder.
                    jdbc.default.jndi.name=java:/stclportal
3)Now download oracle jar (etc ojdbc6.jar)
4) Goto liferay-portal\jboss-7.1.1\modules\com and create one folder named "oracle" in that folder create one folder named "ojdbc6" and in that folder create one another folder named "main" at last you have folder structure like shown below:
5) In folder named "main" put downloaded ojdbc6.jar file.
6)In the same folder named "main" create another file called module.xml as shown in figure and put below content in it.

 <?xml version="1.0" encoding="UTF-8"?>  
         <module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">  
              <resources>  
                   <resource-root path="ojdbc6.jar"/>  
              </resources>  
              <dependencies>  
                   <module name="javax.api"/>  
                   <module name="javax.transaction.api"/>  
              </dependencies>  
         </module>  

7) Now goto liferay-portal\jboss-7.1.1\standalone\configuration and open standalone.xml and replace the <datasources> element with below code:


  <datasources>  
         <datasource jndi-name="java:/stclportal" pool-name="OracleDS" enabled="true" use-java-context="true">  
           <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>  
           <driver>h1</driver>  
           <security>  
             <user-name>liferay</user-name>  
             <password>XXXXXX</password>  
           </security>  
         </datasource>  
         <drivers>  
           <driver name="h1" module="com.oracle.ojdbc6">  
             <xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>  
           </driver>  
         </drivers>  
       </datasources>  

Here please note that the database name is similar to username if you are providing "liferay" as username then create "liferay" named database in oracle.
And itsss done...:)
Other things are same for deployment and all that...
Thanks