JCR server and Funambol


Tue 27 June 2006 By nuxeo

In order to setup a test framework for the Funambol JCR connector, I had
to setup a JCR repository server. This blog entry, will guide you to set up
the test tools. To do this you need:



  1. to install and configure a tomcat server (I used the 5.5 version)

  2. to deploy the provided jackrabbit-server (see link below)

  3. to setup the jackrabbit-server servlet in order to use RMI access


Installing and configuring Tomcat


As Funambol Data Synchronization server already runs on a Tomcat server,
you will need to change the new Tomcat listening ports. You can do this by
editing the conf/server.xml file. To run and stop the server there are
bin/startup.sh and bin/shutdown.sh in tomcat. I will assume
here that the tomcat server containing the JCR servlet listens HTTP requests
on 8081 port and the funambol one listens on 8080 port.


In order to use the manager in the next section, you will need to add a
new user with manager role in conf/tomcat-users.xml



<user username="admin" password="admin" roles="manager"/>


Deploying jackrabbit-server


To easily deploy the jackrabbit server, you just have to download the
corresponding war file on the jackrabbit download page (see link below).
Then, open the following URL in your web browser:
http://localhost:8080/manager/html. There you will need to authenticate
using the login and password you added to tomcat-users.xml (see the previous
section).


From this page, select the downloaded war file and deploy it: it's done.
You can use this page to reload the web application after some configuration
changes.


Setting up jackrabbit-server for RMI


By default, the jackrabbit-server servlet only provide a WebDAV access to
the repository, but you will be able to configure the RMI support easily by
changing the WEB-INF/web.xml file to have the following lines:



<init-param>

<param-name>rmi-port</param-name>

<param-value>1099</param-value>

<description>

The RMI port for registering the repository in the RMI Registry.

If equals 0, the default port is used.

</description>

</init-param>

<init-param>

<param-name>rmi-host</param-name>

<param-value>jcrserver</param-value>

<description>

The RMI host for registering the repository in the RMI Registry.

If equals "" or missing, the default host is used.

</description>

</init-param>

<init-param>

<param-name>rmi-uri</param-name>

<param-value></param-value>

<description>

The RMI uri for registering the repository in the RMI Registry.

If missing, the uri is composed using the other rmi parameters

and will have the format: //{rmi-host}:{rmi-port}/{repository-name}

</description>

</init-param>

As you can see it, these values are defining the RMI



  • listening port (default is 1099: you can leave this field empty)

  • listening host: I put jcrserver because we have 2 tomcat servers
    on localhost: to avoid confusion, this one has to be named differently.
    Note that I don't know if the host name has to match the machine name:
    this has to be tested

  • url of the repository. If you leave this field blank, default will be
    //jcrserver:1099/jackrabbit.repository in our case.


You should uncomment the following lines too and change to the right RMI
url (see above for the url)



<!--

RMI url, if RMI remoting is needed

-->

<init-param>

<param-name>rmi-uri</param-name>

<param-value>//jcrserver:1099/jackrabbit.repository</param-value>

<description>The URI for the RMI connection.</description>

</init-param>

Testing with Funambol


Before considering to have a working tomcat repository server, please
check that the server has been launched as root. Otherwise you might
experience some end of file problems at runtime. To check if the RMI
registry is correctly launched, execute netstat -l: you should have
the following line:



tcp 0 0 jcrserver:rmiregistry : LISTEN


Then, you will have to download the latest Funambol JCR connector sources
on Nuxeo SVN (see links below). You will need to build both
org.nuxeo.sync.jcr and org.nuxeo.sync.jcr.extensions modules and deploy them
into Funambol (see the projects README files for detailled
instructions).


Then use funamboladmin program to create a new JCR source
instance. You will have to set



  • the handler class name to
    org.nuxeo.sync.jcr.jackrabbit.RmiHandler

  • the JCR repository source URL to
    //jcrserver:1099/jackrabbit.repository

  • the workspace can be left empty to use the default JCR workspace.


Now you should be able to test this connector using the Funambol
command-line client. There is nothing to synchronize as the methods aren't
implemented in the connector yet.


Thus stay tuned...


(Post originally written by Cedric Bosdonnat on the old Nuxeo blogs.)


Category: Product & Development