Derby Installation

  • Derby in Embedded mode is a very simple database to configure as you don't need to install nor to start it before being able to use it. It comes as a single JAR file named derby*.jar. If your XWiki WAR doesn't have it in WEB-INF/lib you'll need to download it and copy it there. You can download it from the Derby web site or directly from the Maven Central Repository.
  • Once this is done, you need to tell XWiki to use Derby and to tell it where the database files will be created. To do this, edit the WEB-INF/hibernate.cfg.xml file where you have expanded the XWiki WAR file and replace the matching properties with the following ones:
<property name="connection.url">jdbc:derby:[DATABASE_LOCATION];create=true</property>
<property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>

where [DATABASE_LOCATION] is where you wish to put the Derby database. For example /apps/xwikidb.

You don't need to specify a username/password property as by default Derby doesn't require them.

Now Derby doesn't support VARCHAR larger than 32K and Hibernate doesn't map large fields to correct Derby types (it should use BLOB and CLOB instead of VARCHAR). Thus we need to provide a modified HBM mapping file. Follow the instructions below.

For XWiki 1.1M2 and above

Use the following mapping definition in WEB-INF/hibernate.cfg.xml:

<mapping resource="xwiki.derby.hbm.xml"/>

This definition should replace any other similar definition (except for the "feeds.hbm.xml" definition which is used for something else).

For XWiki 1.1M1

Place this xwiki.hbm-1.1.xml file in your WEB-INF/classes directory, rename it to "xwiki.derby.hbm.xml" and add the following mapping definition in WEB-INF/hibernate.cfg.xml:

<mapping resource="xwiki.derby.hbm.xml"/>

This definition should replace any other similar definition (except for the "feeds.hbm.xml" definition which is used for something else).

For XWiki 1.0 and lower

Place this xwiki.hbm-1.0.xml file in your WEB-INF/classes directory, rename it to "xwiki.derby.hbm.xml" and add the following mapping definition in WEB-INF/hibernate.cfg.xml:

<mapping resource="xwiki.derby.hbm.xml"/>

This definition should replace any other similar definition (except for the "feeds.hbm.xml" definition which is used for something else).

Version 3.2 last modified by VincentMassol on 04/01/2008 at 00:36

Comments 3

fabsta | 24.10.2007 at 12:17 PM
Hello Everybody, I am trying to install xwiki for a demo, running on Websphere Application Server Community Edition, which is built on Apache Geronimo. I have followed the instructions posted but since I am new to this I am not sure what I am doing wrong. Is the posted filename "derby*.jar" a synonym for all derby files ending with .jar which can be found in the downloadable derby file http://www.eng.lsu.edu/mirrors/apache/db/derby/db-derby-10.3.1.4/db-derby-10.3.1.4-lib.zip ? or is the star the substitute for the Version, as in your Maven Central link (derby-10.3.1.4.jar)? I have changed the artifact id and the context root in geronimo-web.xml to "xwiki" without the versioning but I am still getting an error when I click on "XWiki Home Page" on localhost:8080/xwiki : error: Could not initialize main XWiki context

any hints?


fabsta | 24.10.2007 at 04:02 PM
I have now put the derby-10.3.1.4.jar file in the WEB-INF/lib folder. in addition I downloaded xwiki.hbm-1.0.xml and put it in web-inf/classes which is in %WASCE%/repository/default/xwiki/1.0/xwiki-1.0.car/WEB-INF/classes, changed DATABASE_LOCATION? to "/xwikidb", created an empty xwikidb folder in this location and tried accessing the wiki. Now I get a different error: WARN [action?] Servlet action is currently unavailable

Did anyone succeed in running XWiki on WASCE using Derby DB?


Trinition | 04.01.2008 at 12:36 AM
I've not used XWiki and Derby on WebSphere, but I've done it with Tomcat. I've had problems, but not that problem. I'm using Derby in embedded mode and while it works at first, the Derby DB does not survive a restart of Tomcat (it's wiped out each time).

Attachments 2

XML
xwiki.hbm-1.0.xml 1.2
PostedBy: VincentMassol on 06/12/2007 (31kb )
XML
xwiki.hbm-1.1.xml 1.2
PostedBy: VincentMassol on 06/12/2007 (31kb )

Creator: VincentMassol on 2007/06/01 21:28
This wiki is licensed under a Creative Commons license
1.3.2.9174