Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 2f266c048a33eb1dd3fac8de91e62513 > files > 3

jonas-3.0-1.0.2mdk.src.rpm


                          Configuring JOnAS 3.0

This guide presents the different points of configuration of JOnAS after 
RPM installation.
Note that the environment settings (1.1) are already done for the "jonas"
user, and that the JOnAS/Tomcat configuration (1.2) is already done for
running the JOnAS examples (in the CATALINA_BASE of the "jonas" user).
So for just running the JOnAS examples as "jonas" user, you may just skip
to section 2.
A password for "jonas" user should be set when being "root", through the
command "passwd jonas".

Content:

1) ENVIRONMENT AND CONFIGURATION
   1.1) Environment settings
   1.2) JOnAS/Tomcat configuration
2) JOnAS POST INSTALLATION
3) RUNNING THE EXAMPLES
4) APPENDIX: initializing the PostgreSQL db for the examples

                         *****************************

1) ENVIRONMENT AND CONFIGURATION

This section describes the environment settings and the JOnAS/Tomcat
configuration, necessary to use JOnAS.

                         *****************************

1.1) Environment settings

Set the JAVA_HOME environment variable:

  export JAVA_HOME=<JDK Installation Directory>

Set the ANT_HOME environment variable:

  export ANT_HOME=/var/www/jakarta-ant-1.5

Set the CATALINA_HOME environment variable:

  export CATALINA_HOME=/var/www/jakarta-tomcat-4.1.18

You may run your own instance of Tomcat by defining a CATALINA_BASE environment
variable pointing to a directory containing your own conf and webapps
directories. By default CATALINA_BASE = CATALINA_HOME. For the "jonas" user,
CATALINA_BASE points to a directory containing the Tomcat configuration
for running the JOnAS examples.

   export CATALINA_BASE=<your Tomcat instance directory>

Set the JONAS_ROOT environment variable:

export JONAS_ROOT =/var/www/JONAS 

Update the PATH:

PATH = $ANT_HOME/bin:$JAVA_HOME/bin:$JONAS_ROOT/bin/unix:$PATH

Depending on the ORB you are going to work with, you may have to change the
$JONAS_ROOT/config/jndi.properties file (this file is already set if you want 
to use RMI with the default port). You also have to initialize the following
environment variable to the correct value:

export OBJECTWEB_ORB = RMI / JEREMIE / DAVID

                         *****************************

1.2) JOnAS/Tomcat configuration

Depending on the database you want to use, you may have to create a file
<datasource>.properties (you can find some templates in the directory
$JONAS_ROOT/config). See JOnAS documentation for more details. A datasource
file already exists for the PostgreSQL database installed on your system
($JONAS_ROOT/config/Postgres.properties). The database used by the examples
should be created as detailed in section 4) "APPENDIX: initializing the
PostgreSQL db for the examples."
Then add the data source file name (without the extension ".properties") in
the jonas.properties file (already done for JOnAS examples, in the
$JONAS_ROOT/config/jonas.properties):
 
   jonas.service.dbm.datasource <data source>

In the file $JONAS_ROOT/bin/unix/config_env, set the classpath to the JDBC
driver of the database used (already done for PostgreSQL). For example, for
PostgreSQL:

    CLASSPATH=/home/jonas/jdbc7.2dev-1.2.jar:$CLASSPATH

If you want to use jadmin, you need to add the following line to the file
$CATALINA_BASE/conf/tomcat-users.xml (already done in CATALINA_BASE of
the "jonas" user):
 
  <user name="jadmin" password="jonas" roles="jadmin, tomcat" />

For the example Petstore, you need to add the following line to the file 
$CATALINA_BASE/conf/tomcat-users.xml (already done in CATALINA_BASE of the
"jonas" user):
 
  <user name="jps_admin" password="admin" roles="administrator" /> 

To use the security (examples websample and earsample), you need to replace 
the following line to the file $CATALINA_BASE/conf/server.xml (already done
in CATALINA_BASE of the "jonas" user):

  <Realm className="org.apache.catalina.realm.MemoryRealm"/>

By the line:

  <Realm className="org.objectweb.security.tomcat.interceptor.SecurityCtxInterceptor41"/> 

Configure the Mail service if you want to use it (for PetStore or the example
mailsb for instance).  JOnAS provides two types of mail factories:
javax.mail.Session and javax.mail.internet.MimePartDataSource.  
In the directory $JONAS_ROOT/config, you can find two files:  
MailSession1.properties and MailMimePartDS1.properties that you can adapt to 
fit your installation.  Then, in the jonas.properties file, define the 
jonas.service.mail.factories property:

  jonas.service.mail.factories MailSession1,MailMimePartDS1

                         *****************************

2) JOnAS POST INSTALLATION

Do "ant install" in the JONAS_ROOT directory.
Note:  This step has to be executed every time you want to use a new version 
of Tomcat or change the ORB.

                         *****************************

3) RUNNING THE EXAMPLES

You can then compile the examples:  do "ant install" in the directory
$JONAS_ROOT/examples.

For examples involving entity beans, you should have created/initialized the
database corresponding to the used datasource
(JONAS_ROOT/config/Postgres.properties), as explained in section 4) "APPENDIX:
initializing the PostgreSQL db for the examples"

If you want to run Petstore, you need to erase the file admin.xml in the 
directory $CATALINA_BASE/webapps (if not already done).

You are now ready to use JOnAS.  For more information, consult the JOnAS
documentation ($JONAS_ROOT/doc/index.html). More documentation is available
on the JOnAS web site http://www.objectweb.org/jonas.


4) APPENDIX: initializing the PostgreSQL db for the examples

In the file /var/lib/pgsql/data/pg_hba.conf, the line

  local   all     ident   sameuser

must be replaced by the two lines
   
  local   all     trust
  host    all     0.0.0.0         0.0.0.0         trust

Logged as user "postgres", you should execute the following commands:

$  initdb -D /var/lib/pgsql/data
$  postmaster -D /var/lib/pgsql/data -i &
$  createuser -W
Enter name of user to add: jonas
Shall the new user be allowed to create databases? (y/n) y  
Shall the new user be allowed to create more new users? (y/n) n
password : jonas
CREATE USER

Then logged as user "jonas", you should execute the following commands:

$  createdb --username=jonas db_jonas
CREATE DATABASE