
« Zurück zu Custom Deployments
Using Jackrabbit with Database
Steps to hooking up Jackrabbit to Oracle#
- Your install should already be connecting to Oracle through JDBC. Just in case you have not... (assume OCI to connect to Oracle.) Install the Oracle client on your server. Copy the ojdbc5.jar into \liferay-portal-5.2.3\tomcat-6.0.18\lib\. Then edit portal-ext.properties to include Database related properties.
- Edit the portal-ext.properties to include the following Jackrabbit related properties
5.2.3
##### Document Library Portlet ##### # # Set the name of a class that implements # com.liferay.documentlibrary.util.Hook. The # document library server will use this persist documents. # # Available hooks are: # com.liferay.documentlibrary.util.FileSystemHook # com.liferay.documentlibrary.util.JCRHook # com.liferay.documentlibrary.util.S3Hook # #dl.hook.impl=com.liferay.documentlibrary.util.AdvancedFileSystemHook #dl.hook.impl=com.liferay.documentlibrary.util.FileSystemHook dl.hook.impl=com.liferay.documentlibrary.util.JCRHook #dl.hook.impl=com.liferay.documentlibrary.util.S3Hook # # FileSystemHook # dl.hook.file.system.root.dir=${liferay.home}/data/document_library # # S3Hook # dl.hook.s3.access.key= dl.hook.s3.secret.key= dl.hook.s3.bucket.name= # # S3Hook # dl.hook.s3.access.key= dl.hook.s3.secret.key= dl.hook.s3.bucket.name= # # Set the maximum file size and valid file extensions for documents. A value # of 0 for the maximum file size can be used to indicate unlimited file # size. However, the maximum file size allowed is set in the property # "com.liferay.portal.upload.UploadServletRequestImpl.max.size". # #dl.file.max.size=307200 #dl.file.max.size=1024000 dl.file.max.size=3072000 # # A file extension of * will permit all file extensions. # # You can map a GIF for the extension by adding the image to the theme's # image display and document library folder. The wildcard extension of * # will be ignored. For example, the default image for the DOC extension # would be found in: /html/themes/_unstyled/images/document_library/doc.gif. # dl.file.extensions=\ mp,.css,.doc,.docx,.dot,.gif,.gz,.htm,.html,.jpg,.js,.lar,.odb,.odf,\ dg,.odp,.ods,.odt,.pdf,.png,.ppt,.pptx,.rtf,.swf,.sxc,.sxi,.sxw,.tar,\ iff,.tgz,.txt,.vsd,.xls,.xlsx,.xml,.zip,.jrxml # # Set which files extensions are comparable by the diff tool. If OpenOffice # integration is enabled, then it is also possible to compare some binary # files that are convertable to text. # dl.comparable.file.extensions=.css,.js,.htm,.html,.txt,.xml #dl.comparable.file.extensions=.css,.doc,.js,.htm,.html,.odt,.rtf,.sxw,.txt,.xml # # Set folder names that will be used to synchronize with a community's set # of private and public layouts. This will allow users to manage layouts # using the Document Library portlet, and ultimately, via WebDAV. This # feature is experimental. # dl.layouts.sync.enabled=false dl.layouts.sync.private.folder=Pages - Private dl.layouts.sync.public.folder=Pages - Public # # Set this to true to enable comments for document library files. # dl.file.entry.comments.enabled=true # # Set this to true to enable file rank for document library files. # dl.file.rank.enabled=true
**5.2.3** ##### JCR ##### jcr.initialize.on.startup=false 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
- Edit the /jackrabbit/repository.xml
5.2.3
<?xml version="1.0"?> <Repository> <!-- Commented out to move to DB <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 mysql persistence that can be used for clustering Jackrabbit. For other databases, change the connection, credentials, and schema settings. --> <!--Uncomment to move to DB --> <!-- Change to Oracle Class <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> --> <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="jdbc:oracle:oci:@portal" /> <param name="user" value="user" /> <param name="password" value="password" /> <!-- The following value must oracle for oracle server this is not the same as the database schema --> <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}"> <!-- Commented out to move to DB <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. --> <!-- Uncommented to move to DB--> <!-- Change to Oracle Class <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> --> <PersistenceManager class="org.apache.jackrabbit.core.state.db.OraclePersistenceManager"> <param name="driver" value="oracle.jdbc.driver.OracleDriver" /> <param name="url" value="jdbc:oracle:oci:@portal" /> <param name="user" value="user" /> <param name="password" value="password" /> <param name="tableSpace" value="" /> <!-- The following value must oracle for oracle server this is not the same as the database schema --> <param name="schema" value="oracle" /> <param name="schemaObjectPrefix" value="J_PM_${wsp.name}_" /> <param name="externalBLOBs" value="false" /> </PersistenceManager> <!-- Change to Oracle Class <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> --> <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="jdbc:oracle:oci:@portal" /> <param name="user" value="user" /> <param name="password" value="password" /> <!-- The following value must oracle for oracle server this is not the same as the database schema --> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_FS_${wsp.name}_"/> </FileSystem> <!-- --> </Workspace> <Versioning rootPath="${rep.home}/version"> <!-- Comment to move to DB <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. --> <!-- Uncomment to move to DB --> <!-- Change to Oracle Class <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> --> <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="jdbc:oracle:oci:@portal" /> <param name="user" value="user" /> <param name="password" value="password" /> <!-- The following value must oracle for oracle server this is not the same as the database schema --> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_V_FS_"/> </FileSystem> <!-- Change to Oracle Class <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> --> <PersistenceManager class="org.apache.jackrabbit.core.state.db.OraclePersistenceManager"> <param name="driver" value="oracle.jdbc.driver.OracleDriver" /> <param name="url" value="jdbc:oracle:oci:@portal" /> <param name="user" value="user" /> <param name="password" value="password" /> <param name="tableSpace" value="" /> <!-- The following value must oracle for oracle server this is not the same as the database schema --> <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. --> <!-- Uncomment to move to database --> <Cluster id="node_1" syncDelay="2000"> <!-- Change to Oracle Class <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal"> --> <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal"> <!-- <param name="revision" value="${rep.home}/revision"/> --> <param name="revision" value="${rep.home}/revision.log"/> <param name="driver" value="oracle.jdbc.driver.OracleDriver"/> <param name="url" value="jdbc:oracle:oci:@portal"/> <param name="user" value="user"/> <param name="password" value="password"/> <!-- The following value must oracle for oracle server this is not the same as the database schema --> <param name="schema" value="oracle"/> <param name="schemaObjectPrefix" value="J_C_"/> </Journal> </Cluster> <!-- --> </Repository>
6.0.11
The configuration for Liferay 6.0.11 is the same as with 5.2.3 with one difference. The persistence manager in this version should be org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager instead of org.apache.jackrabbit.core.persistence.db.OraclePersistenceManager
Steps to hooking up Jackrabbit to MySQL#
- Edit the portal-ext.properties to include jcr.jackrabbit.repository.root=/directory/to/jackrabbit/root
- Modify the jcr.jackrabbit.repository.root=/directory/to/jackrabbit/root/repository.xml to look like
4.3.X - 4.4.X
<?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 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="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="asdf" /> <param name="schema" value="mysql"/> <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.state.xml.XMLPersistenceManager" /> --> <!-- 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="com.mysql.jdbc.Driver"/> <param name="url" value="jjdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="asdf" /> <param name="schema" value="mysql"/> <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="com.mysql.jdbc.Driver"/> <param name="url" value="jjdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="asdf" /> <param name="schema" value="mysql"/> <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.state.xml.XMLPersistenceManager" /> --> <!-- 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="com.mysql.jdbc.Driver"/> <param name="url" value="jjdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="asdf" /> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="J_V_FS_"/> </FileSystem> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jjdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="asdf" /> <param name="schema" value="mysql"/> <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="com.mysql.jdbc.Driver"/> <param name="url" value="jjdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="asdf" /> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="J_C_"/> </Journal> </Cluster> --> </Repository>
4.0-4.2
<?xml version="1.0"?> <Repository> <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${rep.home}/repository" /> </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> <!-- MySQL Server --> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver" /> <param name="url" value="jdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="password" /> <param name="schema" value="mysql" /> <param name="schemaObjectPrefix" value="JACKRABBIT_${wsp.name}_" /> <param name="externalBLOBs" value="false" /> </PersistenceManager> </Workspace> <Versioning rootPath="${rep.home}/version"> <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${rep.home}/version" /> </FileSystem> <!-- MySQL Server --> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver" /> <param name="url" value="jdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8" /> <param name="user" value="username" /> <param name="password" value="password" /> <param name="schema" value="mysql" /> <param name="schemaObjectPrefix" value="JACKRABBIT_VERSION_" /> <param name="externalBLOBs" value="false" /> </PersistenceManager> </Versioning> </Repository>
Restart Liferay, for MySQL the table lportal should automatically be created
- If you are using HSQLDB, set schema to "default" like below:
<?xml version="1.0"?> <Repository> <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> <param name="path" value="${rep.home}/repository" /> </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.state.db.SimpleDbPersistenceManager"> <param name="driver" value="org.hsqldb.jdbcDriver" /> <param name="url" value="jdbc:hsqldb:hsql://127.0.0.1:9001/lportal" /> <param name="user" value="sa" /> <param name="password" value="" /> <param name="schema" value="default" /> <param name="schemaObjectPrefix" value="JACKRABBIT_${wsp.name}_" /> <param name="externalBLOBs" value="true" /> </PersistenceManager> </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.state.db.SimpleDbPersistenceManager"> <param name="driver" value="org.hsqldb.jdbcDriver" /> <param name="url" value="jdbc:hsqldb:hsql://127.0.0.1:9001/lportal" /> <param name="user" value="sa" /> <param name="password" value="" /> <param name="schema" value="default" /> <param name="schemaObjectPrefix" value="JACKRABBIT_VERSION_" /> <param name="externalBLOBs" value="true" /> </PersistenceManager> </Versioning> </Repository>
Things to note#
- Make sure that the user/password has the correct permissions on the DB (in this case lportal)
- If you wish to use a separate DB than the one Liferay portal uses, just create it, give user correct permissions and change the url in the sample above.
- Note that there is an LEP on having to rename jackrabbit dir to jackrabbit.bak, then restart, and a new jackrabbit dir will be created - have to then modify that repository.xml file.
- TBD: is there a way to do this if you have already been using the file system as the repository (a clean way to 'move' over to DB system)?
- When pointing Jackrabbit to the database, Liferay will create a file called workspaces.xml, in /home/workspaces/liferay/workspaces.xml. This will contain a portion of the repository.xml file. If you make changes to repository.xml, make sure you also make the changes to this workspaces.xml file.
- A specific 'Bundle Database PM' like 'org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager' should be faster.
- If you want to use the same database that liferay is already using, set the driver to "javax.naming.InitialContext" and the url to "java:comp/env/jdbc/LiferayPool"
External documentation#
96217 Angesehen