JackrabbitOnJBoss

This document describes how to

Feel free to make changes to this document.

Security

A separate document for security is located under JackrabbitOnJbossSecurity

Custom access manager when using Jboss for security is referenced at SimpleJbossAccessManager

Deploy Jackrabbit with JCA

Now, jackrabbit is running and available through JNDI at java:jcr/local.

Expose the local repository through RMI

Now a JCR RMI server is running at jnp://localhost:1099/jcrServer

Expose the local repository through Webdav

Now the webdav server is running at [WWW] http://localhost:8080/jackrabbit-server

Access the repository from a session bean

EJB3 example

Container managed transactions
@Stateless
public class TestCMT implements TestCMTBean {
        
        public void test() throws Exception {
                InitialContext ctx = new InitialContext() ;
                Repository repo = (Repository) ctx.lookup("java:jcr/local") ;
                Credentials cred = new SimpleCredentials("user",new char[]{'´p','w','d'}) ;
                Session s = repo.login(cred) ;
                s.getRootNode().addNode("foo") ;
                s.save();
        }

}
Bean managed transactions
@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class TestBMT implements TestBMTBean {
        
        
        @Resource
        UserTransaction utx ;

        public void test() throws Exception {
                utx.begin() ;
                InitialContext ctx = new InitialContext();
                Repository repo = (Repository) ctx.lookup("java:jcr/local");
                Credentials cred = new SimpleCredentials("user",new char[]{'´p','w','d'}) ;
                Session s = repo.login(cred);
                s.getRootNode().addNode("foo");
                s.save();
                utx.commit() ;
        }

}

Access the repository remotely from the command line interface

Common problems faced while configuring jackrabbit on jboss

1. I get following exception when configured jca on jboss

2. I get following exception when trying to connect remote jackrabbit repository using jnp port

3. I am using jackrabbit on jboss 4.x and am getting following exception when jackrabbit-server.war gets deployed.

4. In JBoss 4.0.5, I've got the Jackrabbit 1.3 repository configured and I can look it up in the JNDI using a test app, but my WebDav app cannot find the repository eventhough I've followed the instructions and my configuration looks ok...

12:07:31,087 INFO  [AbstractConfig] Configuration of BootstrapConfig
12:07:31,087 INFO  [AbstractConfig] ----------------------------------------------
12:07:31,090 INFO  [AbstractConfig]   jndiConfig: org.apache.jackrabbit.j2ee.JNDIConfig@9d2834
12:07:31,090 INFO  [AbstractConfig]   rmiConfig: org.apache.jackrabbit.j2ee.RMIConfig@baae59
12:07:31,090 INFO  [AbstractConfig]   repositoryHome: null
12:07:31,090 INFO  [AbstractConfig]   repositoryConfig: null
12:07:31,091 INFO  [AbstractConfig]   class: class org.apache.jackrabbit.j2ee.BootstrapConfig
12:07:31,091 INFO  [AbstractConfig]   valid: true
12:07:31,091 INFO  [AbstractConfig]   repositoryName: java:jcr/local
12:07:31,091 INFO  [AbstractConfig] ----------------------------------------------
12:07:31,091 INFO  [AbstractConfig] Configuration of JNDIConfig
12:07:31,091 INFO  [AbstractConfig] ----------------------------------------------
12:07:31,091 INFO  [AbstractConfig]   jndiName: java:jcr/local
12:07:31,091 INFO  [AbstractConfig]   class: class org.apache.jackrabbit.j2ee.JNDIConfig
12:07:31,091 INFO  [AbstractConfig]   jndiEnv: {}
12:07:31,091 INFO  [AbstractConfig]   valid: true
12:07:31,091 INFO  [AbstractConfig]   jndiEnabled: false
12:07:31,091 INFO  [AbstractConfig] ----------------------------------------------
    <servlet>
        <servlet-name>Repository</servlet-name>
        <description>
            This servlet provides other servlets and jsps a common way to access
            the repository. The repository can be accessed via JNDI, RMI or Webdav.
        </description>
        <servlet-class>org.apache.jackrabbit.j2ee.RepositoryAccessServlet</servlet-class>
        <init-param>
            <param-name>repository-name</param-name>
            <param-value>java:jcr/local</param-value>
            <description>Repository Name that is used to retrieve it via JNDI</description>
        </init-param>
        <init-param>
            <param-name>java.naming.provider.url</param-name>
            <param-value>jnp://localhost:1099</param-value>
        </init-param>
        <init-param>
            <param-name>java.naming.factory.initial</param-name>
            <param-value>org.jnp.interfaces.NamingContextFactory</param-value>
        </init-param> 
        <load-on-startup>3</load-on-startup>
    </servlet>

last edited 2007-07-26 17:16:53 by MarkWaschkowski