jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jackrabbit Wiki] Update of "JackRabbitOnTomcat6withJndiAndPostgresql" by BearGiles
Date Wed, 06 May 2009 17:56:30 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki" for change notification.

The following page has been changed by BearGiles:
http://wiki.apache.org/jackrabbit/JackRabbitOnTomcat6withJndiAndPostgresql

------------------------------------------------------------------------------
  (Sidenote: it is a considered good practice to use a separate partition for each service's
data, e.g., for /var/lib/postgresql/8.3 and /var/lib/tomcat6.  This makes it easier to perform
specialized backups, migrate the data from one server to another, etc.  There's little cost
to this is you use Linux Logical Virtual Modules (lvm))
  
  Install the jackrabbit .war file.  If the system will be a dedicated jackrabbit server you
can rename the jackrabbit-1.5.4.war file to ROOT.war and have it unpacked as ROOT.  This means
you can access the jackrabbit instance as http://example.com:8080/ instead of http://example.com:8080/jackrabbit-1.5.4/.
+ 
+ Create a '''${catalina.home}/common''' directory and copy ''jcr-1.0.jar'' to it.  Edit '''${catalina.home}/conf/catalina.properties'''
and add ''${catalina.home/common,${catalina.home}/common/*.jar'' to the ''common.loader''
entry.  This allows us to add libraries to the server without mixing them into the standard
tomcat libraries - something that's extremely helpful when things stop working and you aren't
sure which library is the culprit!
  
  Finally, edit ''/etc/default/tomcat6'' to add "-Djava.rmi.server.hostname=hostname" to the
CATALINA_OPTS, where you have changed 'hostname' to a public network interface.  If you don't
the RMI library will probably pick something weird like 127.0.1.1 (NOT 127.0.0.1) and you'll
spend hours knocking head-shaped holes in the wall.  You will need to use a public network
interface to allow others to connect to the RMI server.
  
@@ -24, +26 @@

  
  * Edit '''/srv/jackrabbit/bootstrap.properties''' so ''repository.home=/srv/jackrabbit''
and ''repository.conf=/srv/jackrabbit/repository.xml''.
  
- * Edit '''/srv/jackrabbit/repository.xml''' so all FileSystem stanzas use ''org.apache.jackrabbit.core.fs.db.DbFileSystem''
and all PersistenceManager stanzas use ''org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager''.
 Also set ''schema'' to ''postgresql'' in the PersistenceManager configuration.  Finally the
DataStore stanza should use ''org.apache.jackrabbit.core.data.db.DbDataStore'' with a ''databaseType''
(not ''schema'') of ''postgresql''.  Set ''schemaObjectPrefix'' as described in other wiki
entries.  (I use '''FS_''',
+ * Edit '''/srv/jackrabbit/repository.xml''' so all FileSystem stanzas use ''org.apache.jackrabbit.core.fs.db.DbFileSystem''
and all PersistenceManager stanzas use ''org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager''.
 Set ''schema'' to ''postgresql'' in each stanza's configuration.
+ 
+ * The DataStore stanza should use ''org.apache.jackrabbit.core.data.db.DbDataStore'' with
a ''databaseType'' (not ''schema'') of ''postgresql''.
+ 
+ * Set all ''schemaObjectPrefix'' as described in other wiki entries.  (I use '''FS_''',
  '''FS_WSP_${wsp.name}''', '''PM_WSP_${wsp.name}''', etc.)
  
  * In all of these stanzas set the ''driver'' to ''org.postgresql.Driver'', the ''url'' to
''jdbc:postgresql://host:5432/dbname'', and the ''user'' and ''password'' as appropriate.
  
  Restart tomcat.  The database should now contain about 20 tables, and more importantly we
know that the basic infrastructure is in place and we just need to refine it to use JNDI.
  
+ == JNDI Configuration ==
+ 
+ * Copy your postgresql jdbc jar, ''postgresql-xxx.jar'', to ${catalina.home}/common.
+ 
+ * If you unpacked the jackrabbit .war file as ROOT, edit '''${catalina.home}/conf/Catalina/localhost/ROOT.xml'''.
 If not, edit '''conf/Catalina/localhost/jackrabbit-1.5.4.xml''' or whatever you named the
webapp.  This file may not yet exist.  You want ''root'' to own this file, not the tomcat
user, so prevent it from being overridden when redeploying the jackrabbit webapp.
+ 
+ * Add the following Resource stanza to the Context stanza:
+ 
+ <Resource name="jdbc/jcr"
+    auth="container"
+    type="javax.sql.DataSource"
+    driverClassName="org.postgresql.Driver"
+    maxActive="20"
+    maxIdle="10"
+    maxWait="-1"
+    url="jdbc:postgresql://localhost:5432/jcr"
+    username="jcr"
+    password="jackrabbit"
+    validationQuery="select 1"/>
+ 
+ * Add the following stanza to the bottom of your '''web.xml''' file:
+ 
+ <resource-ref>
+    <description>JCR database connection</description>
+    <res-ref-name>jdbc/jcr</res-ref-name>
+    <res-type>javax.sql.DataSource</res-type>
+    <res-auth>Container</res-auth>
+ </resource-ref>
+ 
+ * Edit the '''repository.xml''' file so that all ''driver'' are set to ''javax.naming.InitialContext'',
+ all ''url'' are set to ''java:comp/env/jdbc/jcr'', and all ''user'' and ''password'' entries
are dropped.
+ 
+ * Restart tomcat.  Check the logs for errors.  Jackrabbit should now be running using the
JNDI-specified database.
+ 
+ == Changing Databases ==
+ 
+ At this point it should be trivial to change the database: edit '''ROOT.xml''' and restart
tomcat.  You'll want to back up and restore the jackrabbit instance as you do this.
+ 

Mime
View raw message