Catching the Jackrabbit


Last two three weeks have been very hectic, but very exciting and highly productive.
I was asking my boss “What’s next?”. Then we had a meeting and I was explained the road ahead and then they gave me an assignment.

My boss explained me the problem statement in few sentences and asked me to implement that.This was a special assignment for me where I had to evaluate the most suitable technology, come up with interactive UI and most importantly it should be multi-tenant.

We were looking for a way to manage documents in our applications. Where user can have several documents which he would like to upload in our application,associate them with other entities , retrieve them at a later stage and attach them with newly created documents.This functionality already existed in our application, but it was very unmanageable and we were looking for a better way to do it.

Though our requirements were very basic, generally termed as CRUD, create, retrieve, update and delete; we were looking for a solution which allows more than CRUD.It was a plus if the system supported advanced features like checkin-checkout, versioning, security, locking, transactions etc. etc.

I started googling for my requirement and first thing that I came to know was I was looking for a “Document Management System” and not “Content Management System”.There is huge difference between these two. Most of the sites that allow creation of web pages and likes are known as content management systems. Wiki is a very typical CMS.

CMS generally has a DMS in-built in it, but with minimum features.When googled for “open source document management system”, the first and most important link appears in Google search is this page .And I would say this page had all the info that I wanted, I stopped googling anymore and started clicking the links this page had.

This page has listed several open source document repository systems, most of them support JSR170, all of them have what I was looking for, but also what I was not looking for.All of these products came up with a UI and lot of other stuff which was junk for me. So finally I chose Apache Jackrabbit, a reference implementation of JSR170, Content Repository for Java technology.

It has just released its 1.1 version. It is fairly new; it doesn’t have its own UI and is basically more of an API.I started running after Jackrabbit to know more about it and see if it’s the best fit for my requirement. Since its fairly new kid on the block, I couldn’t get much info on the net. All I could get was a 5 page wiki, and few pages of apache’s own site.

That was enough to start and I could immediately do my first Jackrabbit tutorials, named as FirtHop, SecondHop, ThirdHop and so on.These were standalone java main classes which needed no setup and run seamlessly, it was very easy to get a hack of JCR APIs through Jackrabbit.

But the real life implementation demanded a lot more than just a main class.Jackrabbit repository supports three different deployment models.

1. Embedded in a single web application.2. Shared by multiple web applications running in same app server.3. Running as standalone repository which can be accessed remotely by multiple applications running in different app servers.

We needed a document repository which would be available as a server and would serve multiple customers at same time. The third deployment model was the solution for our problem.JackrabbitOnJboss a wiki page, has all the info on how to run Jackrabbit on Jboss. I started following there instructions and was disappointed to see nothing works.

After wasting my precious weekend I realized that the readymade binaries that I downloaded are quite old and I need to download latest source code and build the binaries my own.I used ‘subversion’ and ‘maven’ for the first time to download and build these binaries. With fresh binaries the jboss configuration went well and I could see something running.

I faced few problems and Google helped me to solve them, I immediately posted them on jackrabbit wiki, that was my first contribution to apache community, and it was exciting. I also posted a standalone jackrabbit repository installer for jboss on wiki, it showed up there for few days but was removed later because of their policy issues.In jboss the jackrabbit repository is deployed with JCA as resource adapted and then exposed thru RMI and webdav.

A session bean or servlet can locate it using standard lookup mechanism. The repository content can be accessed using webdav URL.

Coming to some basics of JCR, there is a Repository and it can have one or more Workspaces.A workspace always has a root Node, root node can have nodes and nodes can child nodes. A node can have Properties and properties can have values.

There are inbuilt node types and you can register your own node type along with its namespace. Registering a custom node type is a bit tricky.Inbuilt nodes are treated specially by repository.When you lookup, you lookup for a repository but you login into a workspace.Logging into workspace gives you handle to a Session. Using session you can CRUD nodes and their properties. Lucene is integrated with Jackrabbit, so that documents can be searched quickly.

A node can be found using its UUID or Xpath or by traversal. SQL is also supported to find nodes.I had to create custom-nodes so that additional metadata can be stored with the documents as their properties. It took me a lot of time since registering custom node types remotely is not supported.I had to make that process as part of repository installer so that on repository startup a servlet registers my custom nodes along with namespace.

Most of my work is completed, but I still have to test its multi-tenant feature and see how I can enforce the security. Within last 3 years I have learned a lots of new tools and technologies on my own including ejb,struts,hibernate,lucene. In all these cases a lot of work was already done and plenty of help was available on net.

But Jackrabbit is a different case. Overall, catching the jackrabbit was an exciting experience after so many days.

This entry was posted in Geek's World. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted November 29, 2007 at 8:19 am | Permalink

    I am currently working with jackrabbit
    I have deployed jackrabbit-jca-1.3.1.rar in jboss 4.0.5.GA. Now I need to register custom node types in my jackrabbit repository during jboss startup but I cannot find any good example how to do this.
    Can you help me with this issue?

    regards Adrian

  2. Goutham
    Posted November 8, 2011 at 5:55 am | Permalink


    I’m working on the similar project where my implementation need to use multiple repositories. My doubt is If I use a standalone server for jackrabbit is it possible for single standalone server to have multiple repositories. Is there any better approach to implement.


Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>