Notes on Jackrabbit JCR

Occasionally i decide to play with JCR a bit. Every time i do, i have to start from scratch figuring it out.

Currently using 2.2.5.

Which distribution?

You have three choices, none of which are exactly normal:

What i ended up doing was unpacking the RAR and using that as my Jackrabbit installation. I can use the jars inside to compile code against, and i can symlink the whole thing into a JBoss server to use it as a resource adaptor (because JBoss will use exploded RARS - right?). I then fiddled with the unpack: i replaced the 1.2 version of commons-codec with 1.4, and added the JCR-RMI and JCR-Server jars (in an 'extra' subdirectory). These will never be a meaningful part of the RAR, but i'm making the RAR do double duty as a jar container.

I also downloaded the JSR 283 spec, which contains the JCR API jar. The API isn't included with Jackrabbit (oddly).


Jackrabbit loves to log. It uses SLF4J, which is a good thing. It does mean you need to supply and configure an SLF4J backend, which is a bit of a pain. The options are Apache (aka Jakarta) Commons Logging, which is an obsolete disaster, JDK java.util.logging, which is an abortion, log4j, which is good, but is another big thing to configure, the built-in simple logger, which just writes everything to the console, and Logback, which is like a do-over of log4j. I went for Logback. I'd never used it before; i've learnt that it's quirky, and has terrible documentation. Using version 0.9.18 (the current one in Fedora 13), this logback.xml pretty much worked for me:

<?xml version="1.0" encoding="UTF-8" ?>
	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
	<appender name="FILE" class="ch.qos.logback.core.FileAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
	<root level="debug">
		<appender-ref ref="STDOUT" />
		<appender-ref ref="FILE" />