2012-01-29

Glassfish 3.1 with Jackrabbit


This article will describe how to add the Jackrabbit content repository (JSR JSR 170 and 283) to Glassfish 3.1.

Download the following packages:
·         jcr-2.0.jar
·         jackrabbit-jca-2.2.4.rar

Follow the steps to install Jackrabbit:
1.       Copy jcr-2.0.jar to $GLASSFISH/lib
2.       Start Glassfish
3.       In the glassfish admin-console go to "Configuration/server-config/Thread Pools". Add a new Thread Pool called "jackrabbit-pool" and leave all parameters untouched
4.       In the glassfish admin-console go to "Applications" Click the button "Deploy" and browse to the jackrabbit-jca-2.2.4.rar file.
5.       In the glassfish admin-console go to "Resources/Connector/Connector Connection Pools Add a new Connection Pool called "jackrabbit-connection-pool" and select the Resource Adapter called "jackrabbit-jca-2.2.4". Scroll to the bottom of the page and add:
a.       configFilePath="full path to repository.xml"
b.      repHomeDir="full path to the repository home folder"
6.       In the glassfish admin-console go to "Resources/Connector/Connector Resources". Add a new Resource with the JNDI Name "jcr/repository". Select the "jackrabbit-connection-pool" as Pool Name and click the OK button.
7.       Restart your application server (because of the newly created thread-pool).

Now is the repository available via JNDI and can be injected with the @Resource annotation.

@Resource(mappedName="jcr/repository", type=javax.jcr.Repository.class)
private Repository rep;

0 reacties:

Post a Comment