Before you can deploy the cms.war file a PostgresQL database must be created. Hippo demands a database encoding of Latin1. If your PostgresQL database server is installed with a different encoding, excluding C or POSIX, you may not be able to create a Latin1 encoded database. If this is the case you can do one of the following:
- Re-install the database server with a Latin1, C or POSIX locale. By using the C or POSIX locale you can create a database with any encoding you like, including Latin1.
- Create a database with an encoding the current database server supports, for example UTF-8, and change the encoding of the database with the following SQL statement: ALTER DATABASE dbX SET client_encoding TO latin1; Make sure you restart the database server.
3. Create a datasource
Create a datasource in Jboss by creating a postgres-ds.xml in the
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/repositoryDS</jndi-name>
<connection-url>jdbc:postgresql://localhost:5432/hippo</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>postgres</user-name>
<password>postgres</password>-->
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
<prepared-statement-cache-size>50</prepared-statement-cache-size>
</local-tx-datasource>
</datasources>
4. Add a resource-ref to the cms.war web.xml
Add the following resource-ref to the web.xml of the cms.war file:
<resource-ref>
<res-ref-name>jdbc/repositoryDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
You can add this element just before the closing </web-app> element.
The jboss-web.xml defines the mapping between the datasource and the resource-ref. This file should have the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/repositoryDS</res-ref-name>
<jndi-name>java:/jdbc/repositoryDS</jndi-name>
</resource-ref>
</jboss-web>
6. Modify the location of the repository.xml in the web.xml of the cms.war
We have to create a custom repository.xml file which configures Hippo for using PostgresQL. The location of the repository path should be modified so that it can find out repository.xml file. Change the location of the repository.xml file in de web.xml file to the following:
<servlet>
<servlet-name>Repository</servlet-name>
<servlet-class>org.hippoecm.repository.RepositoryServlet</servlet-class>
<init-param>
<param-name>repository-config</param-name>
<param-value>repository.xml</param-value>
<description>The location of the repository configuration file.
Unless the location
starts with file://, the location is retrieved from within the application
package as
resource.</description>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
7. Add the customized repository.xml file to the cms.war file
The following repository.xml file should be added to the the cms.war file in the directory: WEB-INF/classes/org/hippoecm/repository. The bundle-cache is enabled in the following repository.xml which greatly improves the performance of the Hippo cms system. The cache size is set to 256MB but can be altered when needed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN"
"http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="url" value="java:comp/env/jdbc/repositoryDS" />
<param name="driver" value="javax.naming.InitialContext" />
<param name="schemaObjectPrefix" value="repository_" />
<param name="schema" value="postgresql" />
</FileSystem>
<Security appName="Jackrabbit">
<SecurityManager class="org.hippoecm.repository.security.SecurityManager" />
<AccessManager class="org.hippoecm.repository.security.HippoAccessManager" />
<LoginModule class="org.hippoecm.repository.security.HippoLoginModule" />
</Security>
<Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default" />
<Workspace name="${wsp.name}">
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="url" value="java:comp/env/jdbc/repositoryDS" />
<param name="driver" value="javax.naming.InitialContext" />
<param name="schemaObjectPrefix" value="${wsp.name}_" />
<param name="schema" value="postgresql" />
</FileSystem>
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
<param name="driver" value="javax.naming.InitialContext" />
<param name="url" value="java:comp/env/jdbc/repositoryDS" />
<param name="schemaObjectPrefix" value="${wsp.name}_" />
<param name="externalBLOBs" value="true" />
<param name="consistencyCheck" value="true" />
<param name="consistencyFix" value="true" />
<param name="bundleCacheSize" value="256"/>
</PersistenceManager>
<SearchIndex
class="org.hippoecm.repository.FacetedNavigationEngineThirdImpl">
<param name="indexingConfiguration" value="indexing_configuration.xml" />
<param name="indexingConfigurationClass"
value="org.hippoecm.repository.query.lucene.ServicingIndexingConfigurationImpl" />
<param name="path" value="${wsp.home}/index" />
<param name="useCompoundFile" value="true" />
<param name="minMergeDocs" value="1000" />
<param name="volatileIdleTime" value="10" />
<param name="maxMergeDocs" value="1000000000" />
<param name="mergeFactor" value="5" />
<param name="maxFieldLength" value="10000" />
<param name="bufferSize" value="1000" />
<param name="cacheSize" value="1000" />
<param name="forceConsistencyCheck" value="true" />
<param name="enableConsistencyCheck" value="true" />
<param name="autoRepair" value="true" />
<param name="analyzer"
value="org.apache.lucene.analysis.standard.StandardAnalyzer" />
<param name="queryClass" value="org.apache.jackrabbit.core.query.QueryImpl" />
<param name="respectDocumentOrder" value="false" />
<param name="resultFetchSize" value="2147483647" />
<param name="extractorPoolSize" value="0" />
<param name="extractorTimeout" value="100" />
<param name="extractorBackLogSize" value="100" />
<param name="textFilterClasses"
value="org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor" />
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="url" value="java:comp/env/jdbc/repositoryDS" />
<param name="driver" value="javax.naming.InitialContext" />
<param name="schemaObjectPrefix" value="version_" />
<param name="schema" value="postgresql" />
</FileSystem>
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
<param name="driver" value="javax.naming.InitialContext" />
<param name="url" value="java:comp/env/jdbc/repositoryDS" />
<param name="schemaObjectPrefix" value="version_" />
<param name="externalBLOBs" value="true" />
<param name="consistencyCheck" value="true" />
<param name="consistencyFix" value="true" />
<param name="bundleCacheSize" value="256"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index" />
<param name="forceConsistencyCheck" value="true" />
<param name="enableConsistencyCheck" value="true" />
</SearchIndex>
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
<param name="url" value="java:comp/env/jdbc/repositoryDS" />
<param name="driver" value="javax.naming.InitialContext" />
<param name="databaseType" value="postgresql" />
<param name="minRecordLength" value="1024" />
<param name="maxConnections" value="5" />
<param name="copyWhenReading" value="true" />
</DataStore>
</Repository>
8. Optionally: change the heap and permsize settings of JBoss.
I use the following memory settings for my configuration. Modify this in the run.bat startup script: set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx768m -XX:MaxPermSize=256m
Thats it!