Sun GlassFish Web Space Server 10.0 Administration Guide

ProcedureTo Configure Jackrabbit With MySQL

  1. Add the following properties to the portal-ext.properties file.

    jcr.initialize.on.startup=true
    jcr.jackrabbit.repository.root=/jackrabbit 
    jcr.jackrabbit.config.file.path=/jackrabbit/repository.xml
    dl.hook.impl=com.liferay.documentlibrary.util.JCRHook

    The Web Space Server evaluation bundle has a portal-ext.properties file in the GlassFish install-dir/domains/domain1/applications/j2ee-modules/webspace/WEB-INF/classes. When you are using a Web Space Server bundle not including samples, you have to create a portal-ext.properties file under ROOT-DIR/webspace-for-gfv2/var/webspace/war-workspace/customs/webspace/WEB-INF/classes.

  2. Make changes to the repository.xml file residing under GlassFish install-dir/webspace-gfv2-OS/var/webspace/data/jackrabbit.

    Most generally, when you are configuring Jackrabbit for MySQL, you will have to remove the commenting for all the markup related with MySQL. For other databases, For other databases, you will have to change the connection credentials and schema settings.

    Modified repository.xml may look like this:

    <?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.jdbc2.optional.MysqlDataSource"/>
    		<param name="url" value="jdbc:mysql://nicp239.india.sun.com:3306/lportal?useUnicode=true&#038;amp&#059;characterEncoding=UTF-8" />
    		<param name="user" value="root" />
    		<param name="password" value="password" />
    		<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="default" />
    	<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="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/>
    	                <param name="url" value="jdbc:mysql://nicp239.india.sun.com:3306/lportal?useUnicode=true&#038;amp&#059;characterEncoding=UTF-8" />
    			<param name="user" value="root" />
    			<param name="password" value="password" />
    			<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.jdbc2.optional.MysqlDataSource"/>
    	                <param name="url" value="jdbc:mysql://nicp239.india.sun.com:3306/lportal?useUnicode=true&#038;amp&#059;characterEncoding=UTF-8" />
    			<param name="user" value="root" />
    			<param name="password" value="password" />
    			<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.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="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/>
                            <param name="url" value="jdbc:mysql://nicp239.india.sun.com:3306/lportal?useUnicode=true&#038;amp&#059;characterEncoding=UTF-8" />
    			<param name="user" value="root" />
    			<param name="password" value="password" />
    			<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.jdbc2.optional.MysqlDataSource"/>
                            <param name="url" value="jdbc:mysql://nicp239.india.sun.com:3306/lportal?useUnicode=true&#038;amp&#059;characterEncoding=UTF-8" />
    			<param name="user" value="root" />
    			<param name="password" value="password" />
    			<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="jdbc:mysql://localhost/jcr"/>
    			<param name="user" value=""/>
    			<param name="password" value=""/>
    			<param name="schema" value="mysql"/>
    			<param name="schemaObjectPrefix" value="J_C_"/>
    		</Journal>
        </Cluster>-->
    </Repository>
  3. Deploy webspace.war.

    To deploy webspace.war, place it under GlassFish install-dir/domains/domain1/autodeploy and restart GlassFish.

  4. Add some documents through the Document Library portlet. If you see the lportal database, the Document Library data is stored in the following tables:

    • J_V_PM_BINVAL

    • J_V_PM_NODE

    • J_V_PM_PROP

    • J_V_PM_REFS