Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Deploying Jackrabbit to JBoss AS 7



Here are step by step directions on how to configure Jackrabbit to JBoss AS 7.

1. Create directory for the jcr deployment

$ cd $JBOSS_HOME/modules
$ mkdir -p javax/jcr/main
$ vi module.xml

Add the following snippet to the newly created module.xml file
<module xmlns="urn:jboss:module:1.0" name="javax.jcr">
  <dependencies>
  <module name="javax.transaction.api" export="true"/>
  </dependencies>
  <resources>
    <resource-root path="jcr-2.0.jar"/>
    <!-- Insert resources here -->
  </resources>
</module>

Copy the jcr-2.0.jar to
$JBOSS_HOME/modules/javax/jcr/main

Download jackrabbit-jca-x.x.x.rar and un-package rar file and change
META-INF/MANIFEST.MF file by adding the following code snippet for dependency at the end of the file.

Dependencies: javax.jcr export,org.slf4

Delete logback-classic-xxx.jar and logback-core-xxx.jar file from jackrabbit-jca-x.x.x.rar

Copy the rar file to deployment folder and start the JBoss [it should start without any error]

If JBoss starts without any error then Stop the JBoss and add the resource adapter in

$ vi $JBOSS_HOME/standalone/configuration/standalone.xml

Look for
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

this is where the resource adapter configuration will go. Add the following inside the above tag:
<resource-adapters>
                <resource-adapter>
                    <archive>
                        jackrabbit-jca-x.x.x.rar
                    </archive>
                    <transaction-support>
                        XATransaction
                    </transaction-support>
                    <connection-definitions>
                        <connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="jcrJCA" enabled="true" use-java-context="true" pool-name="jackrabbit-jca-x.x.x_rar-Pool" use-ccm="true">
                            <config-property name="configFile">
                                /configuration/repository.xml
                            </config-property>
                            <config-property name="bindSessionToTransaction">
                                true
                            </config-property>
                            <config-property name="homeDir">
                                /configuration/repository
                            </config-property>
                        </connection-definition>
                    </connection-definitions>
                </resource-adapter>
            </resource-adapters>

config-property values for configFile, homeDir, bindSessionToTransaction has to be set according to your wish. According to the above configFile value, your respository.xml file should comes under
$JBOSS_HOME/standalone/configuration/repository.xml

Restart JBoss and see rar deployment got succeeded.

Your rating: None Average: 4.3 (4 votes)