Open up "Resources/JNDI/Custom Resources" in the GlassFish administration console
- Put in a JNDI name "jcr/repository"
 - Put in a resource type "javax.jcr.Repository"
 - Put in the factory class "org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
 - Create the property configFilePath, pointing to a configuration XML file with an absolute path on the server, e.g. "c:/repository/repository.xml"
 - Create the property repHomeDir pointing to the absolute filesystem path for the repository, e.g. "c:/repository"
 
commons-collections-3.2.1.jar commons-io-1.4.jar commons-lang-2.4.jar concurrent-1.3.4.jar derby-10.2.1.6.jar jackrabbit-api-1.6.2.jar jackrabbit-core-1.6.2.jar jackrabbit-jcr-commons-1.6.2.jar jackrabbit-spi-1.6.2.jar jackrabbit-spi-commons-1.6.2.jar jackrabbit-text-extractors-1.6.2.jar jcr-1.0.jar log4j-1.2.15.jar lucene-core-2.4.1.jar mysql-connector-java-5.1.12-bin.jar (if datastore is MySQL) pdfbox-0.7.3.jar poi-3.2-FINAL.jar poi-scratchpad-3.2-FINAL.jarTo configure resource factory in Tomcat, add a <Resource> element to the <Context> in the file context.xml (global) or in the server.xml (for specific web app)
<Context ...>
  ...
  <Resource name="jcr/repository" auth="Container"
            type="javax.jcr.Repository"
            factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
            configFilePath="c:/repository/repository.xml"
            repHomeDir="c:/repository"/>
  ...
</Context>
Jackrabbit dependencies have to be copied  to TOMCAT_HOME/lib. Now you can set up JNDI reference to jcr/repository and use JCR to manage content in the application server. The configured resource needs to be declared in the web.xml file:<web-app>
    ...
    <resource-ref>  
    <description>JCR Repository</description>  
    <res-ref-name>jcr/repository</res-ref-name>  
    <res-type>javax.jcr.Repository</res-type>  
    <res-auth>Container</res-auth>  
    </resource-ref>
</web-app>
After all steps the repository will be created automatically by the registered above factory class.
HI Oleg,
ReplyDeleteI have implemented JackRabbit DMS.
My only probelm is that when i deploy it linux, it fails every time. But when i manually delete repo home directory, it works. Note that I haven't mentioned jackrabbit dependency in web.xml. Could this be the problem?
Sorry, I don't know. I don't develop DMS anymore :-)
DeleteNo problem. Thanks anyway :)
ReplyDelete