Detailed Development Software Installation Instructions

This chapter is provided to help you install the software needed to work on your Nuxeo projects.

[TODO: refactor this chapter as in many cases, the packages may be installed using some package management system (for instance on Mac OS: port install apache-ant maven2).]

B.1. Installing Java 5

Nuxeo EP uses the latest generation of Java technologies and thus requires a Java 5 VM such as the reference implementation by Sun.

You may already have the right Java development kit install can enter in the command line:

javac -version

. This should return something like:

javac "1.5.0_10"

If the java version is 1.5.x, you can skip the "Installing java 5" section.

Warning

Nuxeo EP doesn't currently compile under Java 6 (the 1.6.0 JDK from Sun). Even if it did, it is not clear that JBoss, the application server we are targeting, works under Java 6.

Note

Java 5 is also sometimes called Java 1.5 or 1.5.0.

B.1.1. Using the Sun Java Development Kit (Windows and linux)

Sun Microsystems provides freely downloadable version of the Java Development Kit (JDK), that is needed to compile the Nuxeo platform.

For the purpose of Nuxeo development, you should download the latest release of the JDK 5.0 (JDK 5.0 Update 11 at the time of this writing) from http://java.sun.com/javase/downloads/index_jdk5.jsp

B.1.2. Using a package management systems (Linux)

Some Linux distributions now include Java 5 in their official repositories.

For instance with Ubuntu (Edgy and later):

  • enable "multiverse" (2 lines to uncomment) in your /etc/apt/sources.list

  • update your package indexes:

    $ sudo apt-get update
  • install the full Java 5 stack (probably not all is necessary):

    $ sudo apt-get install "sun-java5-*"
  • ensure Java 5 is now the default JVM on your system (instead of gcj and friends by default):

    $ sudo update-alternatives --set java /usr/lib/jvm/java-1.5.0-sun/jre/bin/java

(TODO: add similar instructions for Fedora Core and Debian)

B.1.3. Manual installation (Linux)

You can also manually install Java by following the instructions of this page: http://www.java.com/en/download/linux_manual.jsp

B.1.4. Setting up JAVA_HOME (Windows, Linux, Mac OS)

This will be required by tools such as Maven (see later).

B.1.4.1. Windows

Follow these instructions:

  • type 'windows' +'pause'

  • click on advanced tab

  • click on "environment variables" (at the bottom)

  • click on new and enter "JAVA_HOME" for variable name and "C:\Program Files\Java\jdk1.5.0_10" (adapt to your own JDK install)

  • don't forget to click on ok to close the environment variables window.

B.1.4.2. Linux

In your .bashrc (or .zshrc, ...) add something like:

export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

B.1.4.3. Mac OS

Under Mac OS X, if you have properly installed a JDK (XXX: check how), you will need to put in your your .bashrc (or .zshrc, ...) add something like:

export JAVA_HOME=/Library/Java/Home

B.2. Installing Ant

Ant will be used for building process. If you didn't set it up already on your computer, you can download it here.

Then need to have Ant setup and on your PATH environment variable.

For linux:

Add something like the following in your .bashrc:

export PATH=/opt/apache-ant-1.7.1/bin:$PATH

For Windows:

  • type 'windows' +'pause'

  • click on advanced tab

  • click on "environment variables" (at the bottom)

  • click on path variable and click modify

  • add something like this at the end of the PATH definition: ;c:\program files\apache-ant-1.7.1\bin

  • don't forget to click on OK to close the environment variables window.

You can then check that your installation is correct by typing:

ant -version

B.3. Installing Maven

B.3.1. What is Maven?

Quoting the Wikipedia entry for Maven:

Maven is a software tool for Java programming language project management and automated software build. It is similar in functionality to the Apache Ant tool, but has a simpler build configuration model, based on an XML format. Maven is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

Maven uses a construct known as a Project Object Model (POM) to describe the software project being built, its dependencies on other external modules and components, and the build order. It comes with pre-defined targets for performing certain well defined tasks such as compilation of code and its packaging.

A key feature of Maven is that it is network-ready. The core engine can dynamically download plugins from a repository, the same repository that provides access to many versions of different Open Source Java projects, from Apache and other organizations and developers. This repository and its reorganized successor the Maven 2 repository are the de facto distribution mechanism for Java applications. Maven provides built in support not just for retrieving files from this repository, but to upload artifacts at the end of the build. A local cache of downloaded artifacts acts as the primary means of synchronizing the output of projects on a local system.

Nuxeo is now fully "maven managed".

Nuxeo holds a Maven repository here: http://maven.nuxeo.org/.

B.3.2. Installing Maven

You should then install Maven 2 on your development box by downloading the latest tarball from http://maven.apache.org/download.html and then untar the archive in /opt (for instance).

We recommend that you use the latest version of Maven (2.0.9 at the time of this writing).

As usual, you have to put the mvn executable into the path of your environment (cf. Ant)

Then add the bin/ subdir in your PATH by adding something like the following in your .bashrc:

export PATH=/opt/maven-2.0.9/bin:$PATH

In a new shell you can then test:

$ mvn --version
Maven version: 2.0.9

B.3.3. Generate a new project with the nuxeo-archetype-start archetype

The goal of the nuxeo-archetype-start template is to setup a development environment to work on a Nuxeo EP plugin.

The default code provides: a maven layout for sources, tests and dependencies, a Ant target for deployment. It also customizes the web application a litte bit.

To create a project named my-project in the com.company.sandbox.myproject package:

mvn
 org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
 -DartifactId=my-project \
 -DgroupId=com.company.sandbox.myproject \
 -DarchetypeArtifactId=nuxeo-archetype-start \
 -DarchetypeGroupId=org.nuxeo.archetypes \
 -DarchetypeVersion=5.1.6 \
 -DremoteRepositories=http://maven.nuxeo.org/nuxeo-release

You can see that you need to supply six arguments:

  • artifactId : the name of your project, usually with '-' to separate the words if there are many.

  • groupId : the domain name of your project. Usually it is the package parent name of your classes, you should use '.' to separate the words ('-' is not supported here).

  • archetypeArtifactId : the maven archetype artifact id. To generate a new project, Nuxeo provides you with nuxeo-archetype-start

  • archetypeGroupId : unique for all nuxeo maven archetypes : org.nuxeo.archetypes

  • archetypeVersion : the version of the archetype which is equivalent to the version of Nuxeo EP without the GA or RC part. (5.1.6, 5.1.5 ...).

  • remoteRepositories : the repository location to download the archetype.

B.4. Installing JBoss AS

Nuxeo EP default target is the JBoss application server with EJB3 support enabled. To enable the EJB3 support, you should install JBoss with the latest version of the JEMS installer:

$ sudo java -jar jems-installer-1.2.0.GA.jar

While executing the installation wizard, you must select ejb3 install. You can leave all other parameters to their default values.

You would get PermGenSpace errors if you run JBoss without this configuration:

  • Linux:

    Edit /opt/jboss/bin/run.conf and add the following line at the end of the file

    JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=128m"

    Restart JBoss.

  • Windows:

    Edit $JBOSS/bin/run.bat and add the following line after the line : set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%

    set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=128m

    Restart JBoss.

B.4.1. JBoss AS listening ports customization

The common task for JBoss users is making it to communicate over a single HTTP server. This is quite useful for network administration, making it easier to go through firewalls. This section describes the necessary steps to make JBoss communicate primarily over HTTP

B.4.1.1. Tomcat Web server

JBoss is shipped with built-in Tomcat web server. This server is configured in 'deploy/jbossweb-tomcat55.sar/server.xml' By default only two connectors are enabled: HTTP connector (port 8080) and AJP connector (port 8009). Generally speaking you need only one of them. The former connector is needed if standalone HTTP server built in JBoss is used. You may want to configure it to listen the default HTTP port 80. The latter connector is needed only if you want to couple JBoss server with external web server like Apache, in this case it is reasonable, for security issues to change the binding address to 'localhost' (of course if Apache runs on the same host).

B.4.1.2. HTTP invoker web application

The JBoss default configuration deploys a special service that can be used to expose different JBoss services in the HTTP server. It is located in 'deploy/http-invoker.sar'. The configuration file 'deploy/http-invoker.sar/META-INF/jboss-service.xml' may be tweaked to tune the AS to specific needs. By default the service provides HTTP invoker MBean for EJB ('jboss:service=invoker,type=http') and two HTTP proxy MBeans that marshal the requests to the Naming service MBean ('jboss:service=invoker,type=http,target=Naming' and 'jboss:service=invoker,type=http,target=Naming,readonly=true'). If you need to provide HTTP interface to another MBeans, you also may specify the proxy services in 'deploy\http-invoker.sar\META-INF\jboss-service.xml'. For instance the SRP service for JBoss authentication may be exposed here.

The service also deploys web application 'deploy/http-invoker.sar/invoker.war', that configures the servlets that convert HTTP requests into invocation of MBeans/EJB methods. If you add HTTP proxies to MBeans, you may need to add servlets that handle the corresponding URI.

Important note. If HTTPS protocol is used the configuration should not use the default host name because the virtual host name used in the URL (say 'www.nuxeo.org') and exposed in SSL certificates usually differs from the computer name where JBoss is running. To accomplish this get rid of the following attributes: InvokerURLPrefix, InvokerURLSuffix, UseHostName, replacing them with a single InvokerURL attribute, like this:

<mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
   name="jboss:service=invoker,type=https,target=Naming">
   <!-- Compose the invoker URL from the cluster node address -->
   <attribute name="InvokerURL">
      https://www.nuxeo.org/invoker/JMXInvokerServlet
   </attribute>
   <attribute name="ExportedInterface">
      org.jnp.interfaces.Naming
   </attribute>
   <attribute name="JndiName"></attribute>
   <attribute name="ClientInterceptors">
   <interceptors>
      <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
      <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
      <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor>
      <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
   </interceptors>
   </attribute>
   <depends>jboss:service=invoker,type=https</depends>
</mbean>
<!-- The rest MBeans should also use InvokerURL attribute only,
   make sure you specify the right host name
-->

B.4.1.3. JNDI service

This is the core service of JBoss and should never be disabled. Nevertheless this service does not need own listening port (1099,1098), so just change the '1099' to '-1':

<mbean code="org.jboss.naming.NamingService"
   name="jboss:service=Naming"
   xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
   <!-- The call by value mode. true if all lookups are unmarshalled using
   the caller's TCL, false if in VM lookups return the value by reference.
   -->
   <attribute name="CallByValue">false</attribute>
   <!-- The listening port for the bootstrap JNP service. Set this to -1
     to run the NamingService without the JNP invoker listening port.
   -->
   <attribute name="Port">-1</attribute>
   <!-- The bootstrap JNP server bind address. This also sets the default
   RMI service bind address. Empty == all addresses, use localhost to hide this from 
   network
    -->
   <attribute name="BindAddress">localhost</attribute>
   <!-- The port of the RMI naming service, 0 == anonymous, you cannot use -1 here -->
   <attribute name="RmiPort">1098</attribute>
   <!-- The RMI service bind address. Empty == all addresses, use localhost to hide this from 
   network
    -->
   <attribute name="RmiBindAddress">localhost</attribute>
   <!-- The thread pool service used to control the bootstrap lookups -->
   <depends optional-attribute-name="LookupPool"
      proxy-type="attribute">jboss.system:service=ThreadPool</depends>
</mbean>

B.4.1.4. Default JBoss EJB invokers

You may deinstall the JRMP and Pooled invokers completely. Just comment out the MBeans that provide the corresponding services in 'conf/jboss-service.xml'.

Important note. The JBoss specifies the invokers for EJB in 'conf/standardjboss.xml' file. The default is 'jboss:service=invoker,type=jrmp' invoker. To change it to HTTP invoker you need to add invoker bindings for all EJB types deployed in your applications. Generally it means you need to copy all "*-rmi-invoker" bindings into "*-http-invoker" bindings, replacing "<invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>" with "<invoker-mbean>jboss:service=invoker,type=http</invoker-mbean>" for the new bindings. Also you will need to make the HTTP invoker default for all EJB container configurations replacing "<invoker-proxy-binding-name>*-rmi-invoker</invoker-proxy-binding-name>" with "<invoker-proxy-binding-name>*-http-invoker</invoker-proxy-binding-name>" correspondingly.

The easiest (but probably not the right) way for JBoss 4.0.x is to replace the string 'jboss:service=invoker,type=jrmp' with 'jboss:service=invoker,type=http' in this file by any text editor. It may be not correct if you want to mix both invokers for your EJBs.

B.4.1.5. JBoss EJB3 invoker

The EJB3 invoker which is specified in 'deploy/ejb3.deployer/META-INF/jboss-service.xml' uses JBoss remoting mechanism. By default it is bound to socket with a connector listening TCP/IP port 3873. This should be changed to the servlet locator:

<mbean code="org.jboss.remoting.transport.Connector"
       name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
   <depends>jboss.aop:service=AspectDeployer</depends>
   <attribute name="InvokerLocator">
      servlet://${jboss.bind.address}/invoker/Ejb3InvokerServlet
   </attribute>
   <attribute name="Configuration">
      <handlers>
         <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
      </handlers>
   </attribute>
</mbean>

The corresponding servlet should be added to invoker web application descriptor ('http-invoker.sar/invoker.war/WEB-INF/web.xml'):

<servlet>
   <servlet-name>Ejb3InvokerServlet</servlet-name>
   <description>
      The ServerInvokerServlet receives requests via HTTP protocol
      from within a web container and passes it onto the
      ServletServerInvoker for processing.
   </description>
   <servlet-class>
      org.jboss.remoting.transport.servlet.web.ServerInvokerServlet
   </servlet-class>
   <init-param>
      <param-name>locatorUrl</param-name>
      <param-value>
         servlet://${jboss.bind.address}/invoker/Ejb3InvokerServlet
      </param-value>
      <description>
         The servlet server invoker locator url
      </description>
   </init-param>
   <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
   <servlet-name>Ejb3InvokerServlet</servlet-name>
   <url-pattern>/Ejb3InvokerServlet/*</url-pattern>
</servlet-mapping>

B.4.2. Affected JBoss services

As JRMP invoker is used in many other JBoss services, so it should be replaced. The affected MBeans are "jboss:service=ClientUserTransaction" (conf/jboss-service.xml), "jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory".

B.4.2.1. Client User Transaction

The Client User Transaction service depends on two JRMP Proxy Factories described in the nested MBeans. Every JRMP proxy factory should be replaced with HTTP proxy factory:

<mbean
   code="org.jboss.tm.usertx.server.ClientUserTransactionService"
   name="jboss:service=ClientUserTransaction"
   xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">
  <depends>
    <mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
         name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">
      <attribute name="InvokerName">jboss:service=invoker,type=http</attribute>
      <attribute name="JndiName">UserTransactionSessionFactory</attribute>
      <attribute name="ExportedInterface">
        org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory
      </attribute>
      <attribute name="ClientInterceptors">
        <interceptors>
          <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
          <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
        </interceptors>
      </attribute>
      <depends>jboss:service=invoker,type=http</depends>
    </mbean>
  </depends>
  <depends optional-attribute-name="TxProxyName">
    <mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
         name="jboss:service=proxyFactory,target=ClientUserTransaction">
      <attribute name="InvokerName">jboss:service=invoker,type=http</attribute>
      <attribute name="JndiName"></attribute>
      <attribute name="ExportedInterface">
        org.jboss.tm.usertx.interfaces.UserTransactionSession
      </attribute>
      <attribute name="ClientInterceptors">
        <interceptors>
          <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
          <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
        </interceptors>
      </attribute>
      <depends>jboss:service=invoker,type=http</depends>
    </mbean>
  </depends>
</mbean>

Note that JRMP Proxy factory attributes differ from attributes of HTTP proxy factory.

B.4.2.2. JMX adaptor

The JMX adaptor is adapted for HTTP as following ('deploy/jmx-invoker-service.xml'):

<mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
       name="jboss.jmx:type=adaptor,name=Invoker,protocol=http,service=proxyFactory">
  <attribute name="InvokerURL">https://www.nuxeo.org/invoker/JMXInvokerServlet</attribute>
  <depends optional-attribute-name="InvokerName">jboss.jmx:type=adaptor,name=Invoker</depends>
  <attribute name="ExportedInterface">org.jboss.jmx.adaptor.rmi.RMIAdaptor</attribute>
  <attribute name="JndiName">jmx/invoker/HttpAdaptor</attribute>
</mbean>

and ('deploy/console-mgr.sar/META-INF/jboss-service.xml'):

<mbean code="org.jboss.console.manager.PluginManager"
       name="jboss.admin:service=PluginManager">
  <depends>jboss.jmx:type=adaptor,name=Invoker,protocol=http,service=proxyFactory</depends>
  <!-- the rest stays intact -->
</mbean>

B.4.2.3. Datasource adaptors

You need to set the invoker explicitly for all deployed data sources. The element <jmx-invoker-name> should be added to all <local-tx-datasource> and <xa-datasource> elements. Otherwise the server will complain about missing JRMP invoker which is used by default:

<datasources>
        ...
   <local-tx-datasource>
      <!-- specify explicitly the invoker to use -->
      <jmx-invoker-name>jboss:service=invoker,type=https</jmx-invoker-name>
      <!-- the rest stays intact -->
               ...
   </local-tx-datasource>
        ...
</datasources>

B.5. Installing a Subversion client

The official svnbook is a very good reference for both beginners and advanced subversion users.

B.5.1. Generic subversion clients with linux

The Nuxeo EP source repository is a Subversion repository thus you will need a subversion client to access the source code. Most Linux distributions provide the svn command line tool. To install it under Ubuntu / Debian:

$ sudo apt-get install subversion

Under Fedora Core, this should become:

$ yum install subversion

B.5.2. Windows

For MS Windows, we recommend to use the TortoiseSVN Subversion client. You can also directly use the Subversion command-line client from Subversion website.

B.6. Installing mercurial

Nuxeo EP source are tracked using Mercurial from Selenic.

B.6.1. Linux

To install the hg command under Ubuntu / Debian :

$ sudo apt-get install mercurial

Under Fedora Core, this should become:

$ yum install mercurial

B.6.2. Windows

For MS Windows, we recommend to use the all in one tortoise bundle provided to you by selenic.

B.6.3. Mac OS

For Mac OS, our preferred method is to use the darwin ports environment.

$ port install mercurial

B.6.4. Setting a username

If you plan to checkin in nuxeo's hg repositories, you should provide a valid user name. This is achieved by setting the username property in the .hgrc settings file.

 ...
 [ui]
  ...
  username = firstname lastname <you@your-domain>
  ...
 

B.6.5. Activating pre-integrated extensions

You should activate some pre-integrated extensions for working with nuxeo repositories. This is achieved by adding the following lines to the extensions section of your .hgrc.

 ...
 [extensions]
   ...
   hgext.mq =
   hgext.parentrevspec =
   hgext.graphlog =
   patchbomb =
   transplant =
   ...
   

B.6.6. Using forest

Nuxeo EP sources are available as a forest (nuxeo-ecm: nuxeo-common, nuxeo-core, ...). You're able to extend the hg internal commands by installing the hgforest plugin. One way is to clone the forest hg plugin's repository.

$ hg clone http://hg.akoha.org/hgforest

. The next step is to declare the plugin into you .hgrc file in the extension section.

[extensions]
...
hgext.forest = [your installation path]/forest.py
...

B.7. Chapter Key Point

In this chapter, we learned:

  • how to install a Java development environment (JDK) on your machine

  • how to install Ant and Maven, two mandatory tools for building and deploying your own projects on top of the Nuxeo platform

  • how to install the JBoss AS 4 application server that will act as a container for the Nuxeo application

  • how to install Mercurial and Subversion clients