3.3. Configuring the Communication Protocol and JNDI

3.3.1. Choosing the Protocol

Typically, access to JNDI (the Java Naming and Directory Interface) is bound to a jndi.properties file that must be accessible from the classpath. This is somewhat different within JOnAS. Starting with JOnAS 3.1.2, multi-protocol support is provided through the integration of the CAROL component (refer to http://www.objectweb.org/carol). This currently provides support for RMI/JRMP, RMI/IIOP, and CMI (clustered protocol) by changing the configuration. Other protocols may be supported in the future. This configuration is now provided within the carol.properties file (that includes what was provided in the jndi.properties file). This file is supplied with the JOnAS distribution in the $JONAS_ROOT/conf directory (refer to $JONAS_BASE/conf/carol.properties).

The following communication protocols are supported:

The carol.properties file contains:

# jonas rmi activation (jrmp, iiop,   or cmi) 
carol.protocols=jrmp
#carol.protocols=cmi
#carol.protocols=iiop
#carol.protocols=jeremie
# RMI JRMP URL
carol.jrmp.url=rmi://localhost:1099

# RMI IIOP URL
carol.iiop.url=iiop://localhost:2000

# CMI URL
carol.cmi.url=cmi://localhost:2001

# general rules for jndi
carol.jndi.java.naming.factory.url.pkgs=org.objectweb.jonas.naming

CAROL can be customized by editing the $JONAS_BASE/conf/carol.properties file to:

If the standard port number is changed, registry must be run with this port number as the argument, registry <Your_Portnumber>, when the registry is not launched inside the JOnAS server.

You can configure JOnAS to use several protocols simultaneously. To do this, just specify a comma-separated list of protocols in the carol.protocols property of the carol.properties file. For example:

# jonas rmi activation (choose from jrmp, iiop, and cmi) 
carol.protocols=jrmp,iiop

3.3.2. Security and Transaction Context Propagation

JOnAS implements EJB security and transactions by using the communication layer to propagate the security and transaction contexts across method calls. By default, the communication protocol is configured for context propagation. However, this configuration can be changed by disabling the context propagation for security and/or transaction; this is done primarily to increase performance. The context propagation can be configured in the jonas.properties file by setting the jonas.security.propagation and jonas.transaction.propagation properties to true or false:

# Enable the Security context propagation  
jonas.security.propagation              true

# Enable the Transaction context propagation
jonas.transaction.propagation           true

3.3.3. Multi-protocol Deployment (GenIC)

The JOnAS deployment tool (GenIC) must be told which protocol stubs (for remote invocation) are to be generated. Choosing several protocols will eliminate the need to redeploy the EJBs when switching from one protocol to another. The default is that GenIC generates stubs for rmi/jrmp. To change this configuration, call GenIC as described in Section 6.5 GenIC. Use the -protocols option to specify a comma-separated list of protocols (chosen from jrmp, iiop, and cmi). For example:

GenIC -protocols jrmp,iiop

This list of protocols can also be specified for Ant EJB tasks (refer to Chapter 27 Ant EJB Tasks: Using EJB-JAR):

<jonas destdir="${dist.ejbjars.dir}"
    jonasroot="${jonas.root}"           
    protocols="jrmp,iiop"
    keepgenerated="true"
    verbose="${verbose}"
    mappernames="${mapper.names}"
    additionalargs="${genicargs}">
</jonas>