This post gives instructions on the deployment of Jackrabbit JCA Resource Adapter on Glassfish application server. I describe deployment steps in this post, since I wasn't able to find any decent description to do the above and, thus had to figure it out myself. Even though, it isn't a painfull process at all, it took a little bit of time.
I have used the following products:
In order to set up Jackrabbit JCA Resource Adapter on Glassfish you will have to do the following:
- Make JCR API known to Glassfish;
- Install Jackrabbit JCA Resource Adapter on Glassfish;
- Configure Connector Connection Pools on Glassfish;
- Configure Connector Resources on Glassfish;
Make JCR API known to Glassfish
By making JCR API known to Glassfish I mean dropping jcr-2.0.jar library under the <glassfish-install-dir>/glassfish/domains/<your-domain>/lib/ directory. You may need to restart your Glassfish instance.
Install Jackrabbit JCA Resource Adapter on Glassfish
Assuming you have downloaded the required artifacts and started up the Glassfish instance, through the Glassfish web admin UI deploy jackrabbit-jca-2.2.7.rar file using the Applications menu on the Commons Task tree.
Configure Connector Connection Pools on Glassfish
Create new Connector Connection Pools by selecting previously installed jackrabbit-jca-2.2.7.rar in the Resource Adapter field and give name in the Pool Name field, e.g. my-pool.
After clicking Next you will be redirected to the second page. On this page you will have to configure two properties, namely ConfigFile and HomeDir.
- ConfigFile property points to the Jackrabbit repository.xml file, e.g. ~/repo/repository.xml
- HomeDir property points to the location of the Jackrabbit repository on you file system, e.g. ~/repo;
Configure Connector Resources on Glassfish
Finally, create Connector Resource by selecting previously created Connector Connection Pool. You will be able to select you my-pool from the drop down Pool Name menu. Give JNDI Name to you connector resource, e.g. jcr/resource and click OK button. You are done!
Now, you should be able to access JCR repository from you class by injecting as follows:
@Resource ( name = "jcr/repository" )
private Repository repository;