Skip to main content

Liferay Jackrabbit Oracle integration

Follow these steps to integrate Liferay, Jackrabbit, and Oracle.

Step 1 :

Copy the below lines into portal-ext.properties

dl.hook.impl=com.liferay.documentlibrary.util.JCRHook
jcr.initialize.on.startup=true
jcr.workspace.name=liferay
jcr.node.documentlibrary=documentlibrary
jcr.jackrabbit.repository.root=${liferay.home}/data/jackrabbit
jcr.jackrabbit.config.file.path=${jcr.jackrabbit.repository.root}/repository.xml
jcr.jackrabbit.repository.home=${jcr.jackrabbit.repository.root}/home
jcr.jackrabbit.credentials.username=none
jcr.jackrabbit.credentials.password=none



Step 2 :

Replace the content of liferay-installation/data/jackrabbit/repository.xml with below xml text and then restart

<?xml version="1.0"?> <Repository> <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${rep.home}/repository" /> </FileSystem>--> <!-- Database File System (Cluster Configuration) This is sample configuration for oracle persistence that can be used for clustering Jackrabbit. For other databases, change the connection, credentials, and schema settings. --> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="" /> <param name="user" value="" /> <param name="password" value="" /> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_R_FS_"/> </FileSystem> <Security appName="Jackrabbit"> <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager" /> <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule"> <param name="anonymousId" value="anonymous" /> </LoginModule> </Security> <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="liferay" /> <Workspace name="${wsp.name}"> <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${wsp.home}" /> </FileSystem> <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager" />--> <!-- Database File System and Persistence (Cluster Configuration) This is sample configuration for mysql persistence that can be used for clustering Jackrabbit. For other databases, change the connection, credentials, and schema settings. --> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="" /> <param name="user" value="" /> <param name="password" value="" /> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_PM_${wsp.name}_" /> <param name="externalBLOBs" value="false" /> </PersistenceManager> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="" /> <param name="user" value="" /> <param name="password" value="" /> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_FS_${wsp.name}_"/> </FileSystem> </Workspace> <Versioning rootPath="${rep.home}/version"> <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${rep.home}/version" /> </FileSystem> <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager" />--> <!-- Database File System and Persistence (Cluster Configuration) This is sample configuration for mysql persistence that can be used for clustering Jackrabbit. For other databases, change the connection, credentials, and schema settings. --> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="" /> <param name="user" value="" /> <param name="password" value="" /> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_V_FS_"/> </FileSystem> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="" /> <param name="user" value="" /> <param name="password" value="" /> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_V_PM_" /> <param name="externalBLOBs" value="false" /> </PersistenceManager> </Versioning> <!-- Cluster Configuration This is sample configuration for mysql persistence that can be used for clustering Jackrabbit. For other databases, change the connection, credentials, and schema settings. --> <!--<Cluster id="node_1" syncDelay="5"> <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal"> <param name="revision" value="${rep.home}/revision"/> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="" /> <param name="user" value="" /> <param name="password" value="" /> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_C_"/> </Journal> </Cluster>--> </Repository>

Comments

Anonymous said…
Did you find that after configuring Jackrabbit to use Oracle, Lucene stopped indexing files? I wondered if that was the reason for you using Solr in your next post.
We never had issues with Lucene after doing this. SOLR was necessary since we had a Cluster environment.
Anonymous said…
This comment has been removed by a blog administrator.
Luca said…
I have a cluster environment, but I have some issue regarding JackRabbit. I have quite your configuration (in repository.xml I uncommented also the Cluster TAG), but I see that the binary data is written to the file system. The problem is that binary file is written only in the cluster node where I uploaded it. Did you use a shared folder for JackRabbit workspaces?
Anonymous said…
This comment has been removed by a blog administrator.
Anonymous said…
Hi Mohammed,

Have you done clustering on jackrabbit with MS SQL server 2008 for storing documents and images?

I am getting row lock error.

Your help is appreciated.
Tnaks
Sorry, never used MS SQL Server,
BTW you can checkout this thread http://www.liferay.com/community/forums/-/message_boards/view_message/10315622
tuba falopi said…
This is information nice, and very detail, Useful for me and all, thank you so much :)

Popular posts from this blog

Access multiple Databases in JPA

According to JPA specification we can define multiple "persistence-unit" elements (i.e. like below) in persistence.xml file and can easily refer them inside Dao layers as this. public class PolarDaoImpl {     @PersistenceContext(unitName="PolarPU")     protected EntityManager entityManager; -- } public class BearDaoImpl {     @PersistenceContext(unitName="BearPU")     protected EntityManager entityManager; -- } Checkout sample persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">     <!-- Database 1 -->     <persistence-unit name="PolarPU" transaction-type="RESOURCE_LOCAL">         <

JPA 2 new feature @ElementCollection explained

@ElementCollection is new annotation introduced in JPA 2.0, This will help us get rid of One-Many and Many-One shitty syntax. Example 1: Stores list of Strings in an Entity @Entity public class Users implements Serializable {     private static final long serialVersionUID = 1L;     @Id     @GeneratedValue(strategy = GenerationType.AUTO)     private Long id;     @ElementCollection     private List<String> certifications = new ArrayList <String> ();     public Long getId() {         return id;     }     public void setId(Long id) {         this.id = id;     }     public List <String> getCertifications() {         return certifications;     }     public void setCertifications(List <String> certifications) {         this.certifications = certifications;     } .. }         Users u = new Users();         u.getCertifications().add("Sun Certified Java Programmer");         em.persist(u); Generated Tables    Users    Co

Reuse JPA Entities as DTO

Note : Major design advantages of JPA Entities are they can detached and used across tiers and networks and later can by merged. Checkout this new way of querying entities in JPA 2.0 String ql = " SELECT new prepclass2.Employee (e.firstname, e.lastname) FROM Employee e "; List<Employee> dtos = em.createQuery(ql).getResultList(); The above query loads all Employee entities but with subset of data i.e. firstname, lastname. Employee entity looks like this. @Entity @Table(name="emp") public class Employee implements Serializable {     private static final long serialVersionUID = 1L;     @Id     @GeneratedValue(strategy = GenerationType.AUTO)     private Long id;     @Column     private String firstname;     @Column     private String lastname;     @Column     private String username;     @Column     private String street;     @Column     private String city;     @Column     private String state;     @Column     private String zipc