Red Hat APPLICATION SERVER - JONAS Manual

Jonas
Hide thumbs Also See for APPLICATION SERVER - JONAS:
Table of Contents

Advertisement

Quick Links

Red Hat Application Server
JOnAS User Guide

Advertisement

Table of Contents
loading

Summary of Contents for Red Hat APPLICATION SERVER - JONAS

  • Page 1 Red Hat Application Server JOnAS User Guide...
  • Page 2 All other trademarks and copyrights referred to are the property of their respective owners. The GPG fingerprint of the security@redhat.com key is: CA 20 86 86 2B D6 9D FC 65 F6 EC C4 21 91 80 CD DB 42 A6 0E...
  • Page 3: Table Of Contents

    Table of Contents I. Introductory JOnAS Documentation ..................vii 1. Java Open Application Server (JOnAS): a J2EE Platform ........... 1 1.1. Introduction to Red Hat Application Server ............1 1.2. JOnAS Features ..................... 2 1.3. JOnAS Architecture ....................4 1.4. JOnAS Development and Deployment Environment .......... 10 1.5.
  • Page 4 8.7. Configuring Database Access for Container-Managed Persistence..... 91 8.8. Using CMP2.0 Persistence................... 94 8.9. Standard CMP2.0 Aspects ................... 94 8.10. JOnAS Database Mappers ................. 95 8.11. JOnAS Database Mapping (Specific Deployment Descriptor)......97 8.12. Tuning a Container for Entity Bean Optimizations ......... 115 9.
  • Page 5 IV. J2EE Client Application Programmer’s Guide ..............169 19. Launching J2EE Client Applications................171 19.1. Launching Clients .................... 171 19.2. Configuring the Client Container..............171 19.3. Examples......................172 20. Defining the Client Deployment Descriptor ..............173 20.1. Principles......................173 20.2. Examples of Client Deployment Descriptors ..........173 20.3.
  • Page 6 32.1. Cluster Architecture ..................235 32.2. Load Balancing at the Web Level with mod_jk..........236 32.3. Session Replication at the Web Level.............. 239 32.4. Load Balancing at the EJB Level..............241 32.5. Preview of a Coming Version ................243 32.6. Used Symbols ....................243 32.7.
  • Page 7: Introductory Jonas Documentation

    I. Introductory JOnAS Documentation The chapters in this section contain introductory information for all JOnAS users. Table of Contents 1. Java Open Application Server (JOnAS): a J2EE Platform ............1 2. Getting Started with JOnAS ......................15 3. JOnAS Configuration ........................21 4.
  • Page 9: Java Open Application Server (Jonas): A J2Ee Platform

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform This chapter provides an overview of Red Hat Application Server and the JOnAS J2EE platform. 1.1. Introduction to Red Hat Application Server Red Hat Application Server is a middleware platform—it is layered between the operating system and applications.
  • Page 10: Jonas Features

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform The J2EE server provides containers for hosting web and enterprise components. The container pro- vides the component with life-cycle management and interfaces the components with the services provided by the J2EE server: The web container handles servlet and JSP components.
  • Page 11: Key Features

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform 1.2.2. Java Standard Conformance JOnAS is an implementation of J2EE 1.4. It currently conforms to EJB 2.1. Its current integration of Tomcat as a Web container ensures conformity to Servlet 2.4 and JSP 2.0 specifications. The JOnAS server relies on or implements the following Java APIs: JCA 1.5, JDBC 3.0, JTA 1.0.1, JMS 1.1, JMX 1.2, JNDI 1.2.1, JAAS 1.0, JACC 1.0, and JavaMail 1.3.
  • Page 12: Jonas Architecture

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform available with JOnAS provides JDBC PreparedStatement pooling and can be used in place of the JOnAS DBM service. A JORAM JMS Resource adapter is also available. JMS (Java Messaging Service): JMS implementations can be easily plugged into JOnAS. They run •...
  • Page 13 Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform 1.3.1. Communication and Naming Service The Communication and Naming Service (also called Registry) is used for launching the RMI reg- istry, the CosNaming, and/or the CMI registry, depending on the JOnAS configuration (that is, the CAROL configuration, which specifies which communication protocols are to be used).
  • Page 14 Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform supports complex mappings of EJBs to database tables, as well as several types of persistency support (relational databases, object databases, LDAP repositories, etc.). JOnAS also implements the Timer Service features as specified in EJB 2.1. 1.3.3.
  • Page 15: Database Service

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform may involve several components located on different JOnAS servers. This service implements the JTA 1.0.1 specification, thus allowing transactions from application components or from application clients to be explicitly started and terminated. Starting transactions from application components is allowed only from Web components, session beans, or message-driven beans.
  • Page 16 Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform EJB security is based on the concept of roles. The methods can be accessed by a given set of roles. • In order to access the methods, you must be in at least one role of this set. The mapping between roles and methods (permissions) is done in the deployment descriptor using elements.
  • Page 17 Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform The JMS service is in charge of launching (or establishing a connection to) the integrated JMS server, which may or may not run in the same JVM as JOnAS. It also provides connection pooling and thread pooling (for Message-driven Beans).
  • Page 18: Jonas Development And Deployment Environment

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform PreparedStatement pooling. A J2EE CA 1.5 Resource Adapter for JMS is available with JOnAS. It can replace the current JOnAS Messaging service for plugging into JORAM. 1.3.10. Management Service You require the Management service in order to administer a JOnAS server from the JOnAS admin- istration console.
  • Page 19: Clustering And Performance

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform be compared to the variables of Tomcat. While CATALINA_HOME CATALINA_BASE JONAS_ROOT is dedicated to JOnAS installation, is used to specify a particular JOnAS instance con- JONAS_BASE figuration. designates a directory containing a specific JOnAS configuration, and it iden- JONAS_BASE tifies subdirectories containing the EJB-JAR, WAR, EAR, and RAR files that can be loaded in this application environment.
  • Page 20 Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform on JGroups. The plugin dispatches HTTP requests from the Apache web server to Tomcat instances running as JOnAS web containers. Server fluctuations are automatically taken into account. This plu- gin supports round-robin and weighted round-robin load-balancing algorithms, with a sticky session option.
  • Page 21: Future Development

    Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform In addition to clustering solutions, JOnAS provides many intrinsic mechanisms to ensure high scalable and efficiency: A pool of stateless Session Bean instances • A pool of Entity Bean instances, configurable for each Entity Bean within its deployment descriptor •...
  • Page 22 Chapter 1. Java Open Application Server (JOnAS): a J2EE Platform...
  • Page 23: Getting Started With Jonas

    Chapter 2. Getting Started with JOnAS This tutorial guides you through running a first example EJB. Guidance is also provided for running a more complex example in which an EJB has access to a database. You can find additional information about JOnAS configuration in Chapter 3 JOnAS Configuration. 2.1.
  • Page 24: More Complex Examples

    Chapter 2. Getting Started with JOnAS Rollback the transaction Request outside any transaction ClientOp OK. Exiting. 5. Before ending this session, be sure to stop the JOnAS server: service jonas stop These instructions are also located in the file in the working directory. README 2.1.4.
  • Page 25 Chapter 2. Getting Started with JOnAS directory ($JONAS_ROOT/examples/src/mdb/samplemdb/) contains a Mes- • mdb/samplemdb sage Driven Bean that listens to a topic and an MdbClient, which is a pure JMS client, that sends 10 messages on the corresponding topic. This is a very good example for understanding how to write and use message-driven beans. The mdb/sampleappli directory ($JONAS_ROOT/examples/src/mdb/sampleappli/) contains the •...
  • Page 26 Chapter 2. Getting Started with JOnAS Section 2.2.2.1 Configuring Database Access • Section 2.2.2.2 Creating the Table in the Database • Section 2.2.2.3 Configuring the Classpath • 2.2.2.1. Configuring Database Access In order to be able to access your relational database, JOnAS will create and use a DataSource object that must be configured according to the database that will be used.
  • Page 27 Chapter 2. Getting Started with JOnAS 2.2.2.4. Building the eb Example The simplest way to compile this example is to go to the $JONAS_ROOT/examples/src/eb directory ($JONAS_ROOT/examples/src/eb/) shell script compile.sh ($JONAS_ROOT/examples/src/eb/compile.sh). If the Ant 1.5 build tool is installed on your machine, you can build the JOnAS examples by using files located in the build.xml $JONAS_ROOT/examples...
  • Page 28 Chapter 2. Getting Started with JOnAS 101 Antoine de St Exupery 200.0 102 alexandre dumas fils 300.0 103 conan doyle 500.0 104 alfred de musset 100.0 105 phileas lebegue 350.0 106 alphonse de lamartine 650.0 109 John Smith 100.0 Removing Account previously created in database ClientAccount terminated 3.
  • Page 29: Jonas Configuration

    Chapter 3. JOnAS Configuration This chapter describes how to configure JOnAS. 3.1. JOnAS Configuration Rules As described in Chapter 2 Getting Started with JOnAS, JOnAS is pre-configured and ready to use directly with for remote access, if visibility to classes other than those contained in the RMI/JRMP JOnAS distribution in is not required.
  • Page 30: Configuring The Jonas Environment

    Chapter 3. JOnAS Configuration This copies all the required files and creates all the directories. Note files provided with the JOnAS examples support . If this environment build.xml JONAS_BASE variable is defined prior to building and installing the examples, the generated archives are installed under the appropriate sub-directory of .
  • Page 31: Configuring The Communication Protocol And Jndi

    Chapter 3. JOnAS Configuration CLASSPATH= The_Path_To_Your_Jar $SPS$CLASSPATH Note that an additional environment variable called can be defined to load specific XTRA_CLASSPATH classes at JOnAS server start-up. Refer to Chapter 5 JOnAS Class Loader Hierarchy. 3.3. Configuring the Communication Protocol and JNDI 3.3.1.
  • Page 32: Configuring Logging System (Monolog)

    Chapter 3. JOnAS Configuration You can configure JOnAS to use several protocols simultaneously. To do this, just specify a comma- separated list of protocols in the property of the file. For carol.protocols carol.properties example: # jonas rmi activation (choose from jrmp, iiop, and cmi) carol.protocols=jrmp,iiop 3.3.2.
  • Page 33 Chapter 3. JOnAS Configuration Changing the file to configure the traces statically, before the JOnAS Server • trace.properties is run (refer to $JONAS_BASE/conf/trace.properties Using the command (refer to Section 6.1 jonas) to configure the traces dynamically • jonas admin while the JOnAS Server is running. Note The SQL requests sent to a database can be easily traced using the JOnAS Logging system and the integrated P6Spy tool.
  • Page 34: Configuring Jonas Services

    Chapter 3. JOnAS Configuration 3.4.1.1. Example: Setting the DEBUG Level To set the level for the logger used in the module: DEBUG jonas_ejb logger.org.objectweb.jonas_ejb.level DEBUG 3.4.1.2. Example: Setting the Output Traces to the Console and a File To set the output of JOnAS traces to both the console and a file named /tmp/jonas/log handler.logf.output /tmp/jonas.log logger.org.objectweb.jonas.handler.0 tty...
  • Page 35 Chapter 3. JOnAS Configuration As of the 4.1 release, a JMS provider can be integrated through the deployment of a resource adapter. security service enforces security at runtime. security The EAR service provides support for J2EE applications. mail service is required by e-mail applications. Mail The EJB Container service provides support for EJB application components.
  • Page 36 Chapter 3. JOnAS Configuration 3.5.1. Configuring the Registry Service service is used for accessing the RMI registry, CMI registry, or CosNaming (iiop), registry depending on the configuration of communication protocols specified in . (refer carol.properties to Section 3.3 Configuring the Communication Protocol and JNDI.) There are several Registry-launching modes based on the value of the JOnAS property .
  • Page 37 Chapter 3. JOnAS Configuration JOnAS can create WEB containers when the JOnAS server starts by providing the corresponding file names via the property in the file. jonas.service.web.descriptors jonas.properties Example: jonas.service.web.descriptors Bank.war In this example the WEB Container service creates a container from the WAR file named Bank.war It searches for this file in the directory.
  • Page 38 Chapter 3. JOnAS Configuration 3.5.5. Configuring the EAR Service allows deployment of complete J2EE applications (including both EJB-JAR and EAR service WAR files packed in an EAR file). This service is based on the and the WEB container service . The is used to deploy the WARs included EJB container service WEB container service...
  • Page 39 Chapter 3. JOnAS Configuration 3.5.7. Configuring the Database Service Note The description of the new JDBC Resource Adapters as a replacement for the database service is located in Chapter 40 Configuring JDBC Resource Adapters. To allow access to one or more relational databases (for example, Oracle, PostgreSQL, and so on), JOnAS will create and use DataSource objects.
  • Page 40 Chapter 3. JOnAS Configuration driver installed. (Oracle JDBC drivers can be downloaded from Oracle’s web site: http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html) For example: sqlplus user/passwd @Account.sql quit The JDBC driver classes must be accessible from the classpath. To do this, update the config_env file $JONAS_ROOT/bin/unix/config_env 3.5.7.2.
  • Page 41 Chapter 3. JOnAS Configuration There is no mapping for the security between JOnAS and the target operational environment. More • specifically, the roles defined for JOnAS cannot be mapped to roles of the target operational envi- ronment (for example, groups). There is one property in the file for configuring the security service: the jonas.properties...
  • Page 42 Chapter 3. JOnAS Configuration 3.5.8.2.1. Configuring a Memory Resource in the jonas-realm.xml File To add the role ’ ’, place this example role in the section: jonas roles roles role name="jonas" description="Role used in the sample security howto" / /roles Then, add a user with the specified role.
  • Page 43 Chapter 3. JOnAS Configuration dsrealm name="howto_datasource_realm1" dsName="jdbc_1" userTable="realm_users" userTableUsernameCol="user_name" userTablePasswordCol="user_pass" roleTable="realm_roles" roleTableUsernameCol="user_name" roleTableRolenameCol="role_name" [...] /jonas-dsrealm 3.5.8.2.3. Configuring an LDAP Resource in the jonas-realm.xml File The user is added in the LDAP server. In this case, all the users are on the ou=people,dc=jonas,dc=objectweb,dc=org example, user...
  • Page 44 Chapter 3. JOnAS Configuration All the elements of the configuration for the LDAP resource can be found in the file (refer http://jonas.objectweb.org/current/xml/jonas- jonas-realm_1_0.dtd realm_1_0.dtd). For this sample, it is assumed that the LDAP server is on the same computer and is on the default port (389).
  • Page 45 Chapter 3. JOnAS Configuration acceptCount="10" debug="0" scheme="https" secure="true" Factory className="org.apache.catalina.net.SSLServerSocketFactory" clientAuth="false" protocol="TLS"/ /Connector Important Set the parameter to false, otherwise all Web applications will request a client certificate clientAuth if they need SSL. The client authentication will be configured later in the file in the specific web.xml WAR files.
  • Page 46 Chapter 3. JOnAS Configuration accepts the following org.objectweb.jonas.security.auth.spi.JResourceLoginModule parameters: : the name of the entry in the file being used; this entry repre- • resourceName jonas-realm.xml sents how and where the authentication information is stored. This is the only required parameter. : Specify this optional parameter if you want this login module to ask for a cer- •...
  • Page 47 Chapter 3. JOnAS Configuration LoginModuleClassA Flag Options; Sample of a configuration file with a CRL directory: tomcat { org.objectweb.jonas.security.auth.spi.CRLLoginModule required CRLsResourceName="Directory" CRLsDirectoryName="path_to/CRLs"; org.objectweb.jonas.security.auth.spi.JResourceLoginModule required resourceName="memrlm_1"; There can be multiple entries in this file, specifying different configurations that JOnAS can use. The entry dedicated to Tomcat must be named .
  • Page 48 Chapter 3. JOnAS Configuration To enter a certificate-based user access, you must now enter the user’s DN preceded by the String: , as shown in the following example: ##DN## user name="##DN##CN=whale, OU=ObjectWeb, O=JOnAS, L=JOnAS, ST=JOnAS, C=ORG" password="" roles="jadmin" / 3.5.9. Configuring the JMS Service Until JOnAS release 4.1, the only way to provide the JMS facilities was by setting a JMS service when configuring JOnAS.
  • Page 49 Chapter 3. JOnAS Configuration 3.5.10. Configuring the Resource Service is an optional service that must be started as soon as EJB components Resource service require access to an external Enterprise Information Systems. The standard way to do this is to use a third-party software component called a Resource Adapter.
  • Page 50 Chapter 3. JOnAS Configuration 3.5.12.1. Configuring a Session Mail Factory The template file supplied in the installation directory defines a mail MailSession1.properties factory of type . The JNDI name of the mail factory object is . This template Session mailSession_1 must be updated with values appropriate to your installation.
  • Page 51 Chapter 3. JOnAS Configuration mail.authentication.username Set the username for the authentication. mail.authentication.password Set the password for the authentication. mail.debug The initial debug mode. Default is false mail.from The return email address of the current user, used by the method InternetAddress getLocalAddress.
  • Page 52: Configuring The Db Service (Hsql)

    Chapter 3. JOnAS Configuration 3.6. Configuring the DB Service (hsql) The DB service is an optional service that can be used to start a Java database server in the same JVM as JOnAS. The listening port and the database name can be set as follows: jonas.service.db.port 9001 jonas.service.db.dbname...
  • Page 53 Chapter 3. JOnAS Configuration Creates managed JMS instances and binds them with the names • ConnectionFactory Creates administered objects for this server (JMS destinations and non-managed factories) as de- • scribed by the file, located in the directory; those objects joram-admin.cfg $JONAS_ROOT/conf are bound with the names...
  • Page 54 Chapter 3. JOnAS Configuration Property Name Description Possible Values ServerId Identifier of the JORAM Identifier corresponding to the server to server to start (not taken start described in the a3servers.xml into account if the file (ex: 1). JORAM server is set as Nothing (default 0 value is then set).
  • Page 55 Chapter 3. JOnAS Configuration Property Name Description Possible Values UserPassword Default user password that will Any name (such as myPass). be used for opening JMS Nothing (default anonymous connections. password will be set). Collocated Specifies if the connections that True (for building will be created from the factory local-optimized connections).
  • Page 56 Chapter 3. JOnAS Configuration The default file provided with JOnAS creates a queue bound with the name , creates sampleQueue a topic bound with the name , sets the anonymous user, and creates and binds non- sampleTopic managed connection factories named , and .
  • Page 57 Chapter 3. JOnAS Configuration In the collocated persistent case, if you want to start a new JORAM server, remove its persistence directory. This directory is located in JOnAS’ running directory, and has the same name as the JORAM server (for example for server "s0").
  • Page 58 Chapter 3. JOnAS Configuration...
  • Page 59: Configuring Jdbc Datasources

    Chapter 4. Configuring JDBC DataSources This chapter shows the bean or application deployer how to configure the DataSources to connect the application to databases. 4.1. Configuring DataSources For both container-managed and bean-managed persistence, JOnAS makes use of relational storage systems through the JDBC interface. JDBC connections are obtained from an object, the , provided at the application server level.
  • Page 60: Cmp2.0/Jorm

    Chapter 4. Configuring JDBC DataSources datasource.url The JDBC database URL: jdbc:database_vendor_subprotocol:... datasource.classname Name of the class implementing the JDBC driver datasource.username Database user name datasource.password Database user password A DataSource object for Oracle (for example, Oracle1), named in JNDI, and using the Oracle jdbc_1 thin JDBC driver, would be described in a file called , as in the following...
  • Page 61: Connectionmanager Configuration

    Chapter 4. Configuring JDBC DataSources rdb.postgres: mapper for PostgreSQL • rdb.oracle8: mapper for Oracle 8 and lesser versions • rdb.oracle: mapper for Oracle 9 • rdb.mysql: mapper for MySQL • 4.3. ConnectionManager Configuration Each Datasource is implemented as a connection manager that can be configured via some additional properties described in the following table.
  • Page 62 Chapter 4. Configuring JDBC DataSources datasource.classname com.p6spy.engine.spy.P6SpyDriver datasource.username jonas datasource.password jonas datasource.mapper rdb.postgres Within the file: $JONAS_BASE/conf/spy.properties realdriver=org.postgresql.Driver Within the file: $JONAS_BASE/conf/trace.properties logger.org.objectweb.jonas.jdbc.sql.level DEBUG...
  • Page 63: Jonas Class Loader Hierarchy

    Chapter 5. JOnAS Class Loader Hierarchy This chapter is for the EAR application provider; that is, the person in charge of developing the J2EE application components on the server side. It describes a new and important key feature of the J2EE integration: the class loader hierarchy in JOnAS.
  • Page 64: Tomcat Class Loader

    Chapter 5. JOnAS Class Loader Hierarchy 5.4. Tools Class Loader The tools class loader is a JOnAS-specific class loader that loads all classes for which applications do not require visibility (that is, user applications will not be able to load the classes packaged in the tools class loader).
  • Page 65 Chapter 5. JOnAS Class Loader Hierarchy 5.7. JOnAS Class Loader Hierarchy The resulting JOnAS class loader hierarchy is as follows: Figure 5-1. JOnAS Class Loader Hierarchy...
  • Page 66 Chapter 5. JOnAS Class Loader Hierarchy...
  • Page 67: Jonas Command Reference

    Chapter 6. JOnAS Command Reference Commands provided with JOnAS are described in this chapter. Section 6.1 jonas: JOnAS manager • Section 6.2 jclient: Starting a JOnAS client • Section 6.3 newbean: Bean generator • Section 6.4 registry: Java Remote Object Registry •...
  • Page 68 Chapter 6. JOnAS Command Reference jonas start Start a new JOnAS server. The process can be run in the foreground, in the background, or in a new window. If the background option is chosen (default option), control is given back to the caller only when the server is ready.
  • Page 69 Chapter 6. JOnAS Command Reference A standard EJB-JAR file. This leads to the creation of a new EJB Container in the JOnAS • Server. If the file name has a relative path, this path is relative to where the EJB server has been launched or relative to the directory for an EJB-JAR file.
  • Page 70: Jclient

    Chapter 6. JOnAS Command Reference Interactive Command Online Matching Command ndinames istbeans emovebeans -r fileName -sync -debug topic imeout -tt timeout exit interactive mode 6.1.4. Examples jonas check jonas start -n jonas1 jonas admin -n jonas1 -a bean1.jar jonas stop -n jonas1 6.2.
  • Page 71: Newbean

    Chapter 6. JOnAS Command Reference 6.3. newbean 6.3.1. Synopsis newbean Generates skeletons for all the necessary files for making a bean. 6.3.2. Description tool helps the bean writer start developing a bean by generating skeletons for all the nec- newbean essary files for making a bean.
  • Page 72 Chapter 6. JOnAS Command Reference 6.3.3. Example newbean Bean Name MyFirstBean Bean type Session bean Entity bean Message-Driven bean Persistance manager Bean Container (CMP 1.x) Container (CMP 2.x) Bean location Remote Local Package name truc.machin Jar name machin Primary Key class String Integer Object...
  • Page 73: Registry

    > L Package name > com.redhat.rhdb.cc.jonas Jar name > rhaps-cc-jonas Creating bean MySecondBean (type SFL) in package com.redhat.rhdb.cc.jonas Your bean files have been created. You can now customize them. 6.4. registry 6.4.1. Synopsis registry [ port ] Creates and starts a remote object registry.
  • Page 74 Chapter 6. JOnAS Command Reference 6.5.2. Description The GenIC utility generates the container classes for JOnAS from the given Enterprise Java Beans. The InputFileName is either the file name of an EJB-JAR file or the file name of an XML deploy- ment descriptor of beans.
  • Page 75: Jmsserver

    Chapter 6. JOnAS Command Reference -rmiopts options Specifies the options to pass to the compiler. -verbose Displays additional information about command execution. -mappernames Comma-separated list of mapper names for which the container classes will be generated. Used for the JORM-based implementation of CMP 2.0. A mapper is used by JORM for accessing a given database.
  • Page 76: Raconfig

    Chapter 6. JOnAS Command Reference 6.6.3. Options None. 6.6.4. Example command is typically run in the background: JmsServer JmsServer & 6.7. RAConfig 6.7.1. Synopsis RAConfig [ Options ] InputFilename [OutputFilename] Generates a JOnAS-specific resource-adapter configuration file. 6.7.2. Description RAConfig utility generates JOnAS-specific resource-adapter...
  • Page 77 Chapter 6. JOnAS Command Reference rarlink Specifies the JNDI name of the RAR file with which to link. This option can be used when this RAR file will inherit all attributes associated with the specified JNDI name. If this option is specified in the file, it is the only file needed in the RAR, and the file...
  • Page 78 Chapter 6. JOnAS Command Reference...
  • Page 79: Enterprise Beans Programmer's Guide

    II. Enterprise Beans Programmer’s Guide This part contains information for the Enterprise Beans programmer; that is, the person in charge of developing the software components on the server side and, more specifically, the Session Beans. The individual in charge of developing Enterprise Beans should consult chapters in this part for in- structions on how to perform the following tasks: Write the source code for the beans.
  • Page 81: Developing Session Beans

    Chapter 7. Developing Session Beans This chapter is for the Enterprise Bean provider; that is, the person in charge of developing the soft- ware components on the server side and, more specifically, the Session Beans. Note In this documentation, the term "Bean" always means "Enterprise Bean." 7.1.
  • Page 82: The Component Interface

    Chapter 7. Developing Session Beans All the exceptions defined in the clause of an method must be defined in the throws ejbCreate clause of the matching method of the home interface. throws create A remote home interface extends the interface, while a local home interface javax.ejb.EJBHome extends the interface.
  • Page 83 Chapter 7. Developing Session Beans 7.4. The Enterprise Bean Class This class implements the Bean’s business methods of the component interface and the methods of the interface, which are those dedicated to the EJB environment. The class must be defined SessionBean as public and may not be abstract.
  • Page 84 Chapter 7. Developing Session Beans // This is an example of Session Bean, stateful, and synchronized. public class OpBean implements SessionBean, SessionSynchronization { protected int total = 0; // actual state of the bean protected int newtotal = 0; // value inside Tx, not yet committed. protected String clientUser = null;...
  • Page 85: Tuning The Stateless-Session Bean Pool

    Chapter 7. Developing Session Beans return newtotal; 7.5. Tuning the Stateless-Session Bean Pool JOnAS handles a pool for each stateless Session Bean. The pool can be configured in the JOnAS- specific deployment descriptor with the following tags: min-pool-size This optional integer value represents the minimum instances that will be created in the pool when the bean is loaded.
  • Page 86 Chapter 7. Developing Session Beans...
  • Page 87: Developing Entity Beans

    Chapter 8. Developing Entity Beans This chapter is for is the Enterprise Bean provider; that is, the person in charge of developing the software components on the server side, and more specifically the Entity Beans. Note In this documentation, the term "Bean" always means "Enterprise Bean." 8.1.
  • Page 88: The Home Interface

    Chapter 8. Developing Entity Beans Bean-Managed Persistence: the bean provider writes the database access operations (JDBC code) • in the methods of the enterprise bean that are specified for data creation, load, store, retrieval, and remove operations ( ..., ejbCreate ejbLoad ejbStore ejbFind...
  • Page 89: The Component Interface

    Chapter 8. Developing Entity Beans Database Access for Container-Managed Persistence. In the Home interface, the finder methods must adhere to the following rules: They must be named (for example, • find method findLargeAccounts The return type must be the Enterprise Bean’s component interface, or a collection thereof. •...
  • Page 90: The Primary Key Class

    Chapter 8. Developing Entity Beans 8.3. The Component Interface 8.3.1. Business Methods The Component Interface is the client’s view of an instance of the Entity Bean. It is what is returned to the client by the Home interface after creating or finding an Entity Bean instance. This interface contains the business methods of the Enterprise Bean.
  • Page 91 Chapter 8. Developing Entity Beans 8.4.1. Primary Key Class Example public class AccountBeanPK implements java.io.Serializable { public int accno; public AccountBeanPK(int accno) { this.accno = accno; } public AccountBeanPK() { } public int hashcode() { return accno; } public boolean equals(Object other) { 8.4.1.1.
  • Page 92 Chapter 8. Developing Entity Beans return null; If nothing else is specified and the JOnAS default CMP 2 database mapping is used, the JOnAS container generates a database column with the name to handle this PK. However, it is possible JPK_ to specify in the JOnAS-specific Deployment Descriptor the name of the column that will be used to store the PK value in the table.
  • Page 93: The Enterprise Bean Class

    Chapter 8. Developing Entity Beans 8.5. The Enterprise Bean Class The EJB implementation class implements the bean’s business methods of the component interface and the methods dedicated to the EJB environment, the interface of which is explicitly defined in the EJB specification. The class must implement the interface, must be javax.ejb.EntityBean defined as public, cannot be...
  • Page 94 Chapter 8. Developing Entity Beans ejbPassivate public void • The container invokes this method on an instance before the instance becomes dissociated with a specific EJB object. After this method completes, the container will place the instance into the pool of available instances. ejbRemove public void •...
  • Page 95 Chapter 8. Developing Entity Beans // Init object state accno = new Integer(val_accno); customer = val_customer; balance = val_balance; return null; public void ejbPostCreate(int val_accno, String val_customer, double val_balance) { // Nothing to be done for this simple example. public void ejbActivate() { // Nothing to be done for this simple example.
  • Page 96 Chapter 8. Developing Entity Beans return accno.intValue(); 8.5.1.2. CMP 2.0 import java.rmi.RemoteException; import javax.ejb.EntityBean; import javax.ejb.EntityContext; import javax.ejb.ObjectNotFoundException; import javax.ejb.RemoveException; import javax.ejb.CreateException; import javax.ejb.EJBException; public abstract class AccountImpl2Bean implements EntityBean { // Keep the reference on the EntityContext protected EntityContext entityContext; /*==== Abstract set and get accessors for cmp fields ====*/ public abstract String getCustomer();...
  • Page 97: Writing Database Access Operations (Bean-Managed Persistence)

    Chapter 8. Developing Entity Beans public void ejbPassivate() { // Nothing to be done for this simple example. public void ejbRemove() throws RemoveException { // Nothing to be done for this simple example, // in implicit persistence. public void ejbStore() { // Nothing to be done for this simple example, // in implicit persistence.
  • Page 98 Chapter 8. Developing Entity Beans conn.close(); A DataSource object associates a JDBC driver with a database (as an ODBC datasource). It is created and registered in JNDI by the EJB server at launch time (refer also to Chapter 4 Configuring JDBC DataSources).
  • Page 99: Configuring Database Access For Container-Managed Persistence

    Chapter 8. Developing Entity Beans bean. This datasource has been instantiated by the EJB server and is available for the bean through its resource reference name, which is defined in the standard deployment descriptor. In the bean, a reference to a datasource object of the EJB server is initialized: it = new InitialContext();...
  • Page 100 Chapter 8. Developing Entity Beans cmp-version 1.x /cmp-version cmp-field field-name fieldOne /field-name /cmp-field cmp-field field-name fieldTwo /field-name /cmp-field With the programmer need not develop the code for access- container-managed persistence ing the data in the relational database; this code is included in the container itself (generated by the platform tools).
  • Page 101 Chapter 8. Developing Entity Beans /jdbc-mapping cleanup create /cleanup For an explicit mapping definition, refer to Section 8.11 JOnAS Database Mapping (Specific Deploy- ment Descriptor). For a CMP 2.0 Entity Bean, the JOnAS-specific deployment descriptor contains an additional element, , at the same level as the element, which can have one of the following cleanup jdbc-mapping...
  • Page 102: Using Cmp2.0 Persistence

    Chapter 8. Developing Entity Beans Note that a element for the method is finder-method-jdbc-mapping findByPrimaryKey not necessary, since the meaning of this method is known. Additionally, note that for CMP 2.0, the information defining the behavior of the implementation of a method is located in the standard deployment descriptor, as an EJB-QL query (that find method is, this is not JOnAS-specific information).
  • Page 103: Jonas Database Mappers

    Chapter 8. Developing Entity Beans 8.9.2. Standard Deployment Descriptor The standard way to indicate to an EJB platform that an Entity Bean has container-managed persistence is to fill the tag of the deployment descriptor with the value persistence-type , and to fill the tags of the deployment descriptor with the list of container cmp-field...
  • Page 104 Chapter 8. Developing Entity Beans Thus, for each type of database (and more precisely for each JDBC driver), the corresponding map- per must be specified in the DataSource. This is the purpose of the prop- datasource.mapper erty of the DataSource properties file. Note that all JOnAS-provided DataSource properties files (in ) already contain this property with the correct mapper.
  • Page 105: Jonas Database Mapping (Specific Deployment Descriptor)

    Chapter 8. Developing Entity Beans # mappers for entity CMP2 mapper.names rdb.oracle,rdb.postgres 8.11. JOnAS Database Mapping (Specific Deployment Descriptor) You can specify the mapping to the database of Entity Beans and their relationships in the JOnAS-specific deployment descriptor, in elements, and in jonas-entity jonas-ejb-relation elements.
  • Page 106 Chapter 8. Developing Entity Beans 8.11.2. CMP fields mapping Mapping CMP fields in CMP2.0 is similar to that of CMP1.1, but in CMP2.0 it is also possible to specify the SQL type of a column. Usually this SQL type is used if JOnAS creates the table (the value of the element) and if the JORM SQL type is not appropriate.
  • Page 107 Chapter 8. Developing Entity Beans Mandatory jndi-name Optional. Default value is the upper-case CMP2 jdbc-table-name abstract-schema-name, or the CMP1 EJB-name, suffixed by "_". Optional. cmp-field-jdbc-mapping Optional. Default value is the field-name suffixed by "_". "idA_" jdbc-field-name and "f_" in the example. Optional.
  • Page 108 Chapter 8. Developing Entity Beans ejb-relationship-role !-- B = A -- ejb-relationship-role-name b2a /ejb-relationship-role-name multiplicity One /multiplicity relationship-role-source ejb-name B /ejb-name /relationship-role-source /ejb-relationship-role /ejb-relation /relationships ..8.11.3.1.2. Database Mapping c_idA cfk_idB c_idB There is a foreign key in the table of the bean that owns the CMR field. 8.11.3.1.3.
  • Page 109 Chapter 8. Developing Entity Beans ../jonas-entity ..jonas-ejb-relation ejb-relation-name a-b /ejb-relation-name jonas-ejb-relationship-role ejb-relationship-role-name a2b /ejb-relationship-role-name foreign-key-jdbc-mapping foreign-key-jdbc-name cfk_idb /foreign-key-jdbc-name /foreign-key-jdbc-mapping /jonas-ejb-relationship-role /jonas-ejb-relation ..is the column name of the foreign key in the table of the source bean of foreign-key-jdbc-name the relationship-role.
  • Page 110 Chapter 8. Developing Entity Beans /relationship-role-source cmr-field cmr-field-name a /cmr-field-name /cmr-field /ejb-relationship-role /ejb-relation /relationships ..8.11.3.2.2. Database Mapping Two mappings are possible. One of the tables may hold a foreign key. Case 1: c_idA cfk_idB c_idB Case 2: c_idA c_idB cfk_idA 8.11.3.2.3.
  • Page 111 Chapter 8. Developing Entity Beans ..Case 2: ..jonas-ejb-relation ejb-relation-name a-b /ejb-relation-name jonas-ejb-relationship-role ejb-relationship-role-name b2a /ejb-relationship-role-name foreign-key-jdbc-mapping foreign-key-jdbc-name cfk_ida /foreign-key-jdbc-name /foreign-key-jdbc-mapping /jonas-ejb-relationship-role /jonas-ejb-relation ..For the default mapping, the foreign key is in the table of the source bean of the first ejb-relationship- role of the ejb-relation.
  • Page 112 Chapter 8. Developing Entity Beans 8.11.3.3.2. Database Mapping c_idA c_idB cfk_idA In this case, the foreign key must be in the table of the bean which is on the "many" side of the relationship (that is, in the table of the source bean of the relationship role with multiplicity many), 8.11.3.3.3.
  • Page 113 Chapter 8. Developing Entity Beans ejb-relationship-role !-- A = B -- ejb-relationship-role-name a2b /ejb-relationship-role-name multiplicity One /multiplicity relationship-role-source ejb-name A /ejb-name /relationship-role-source cmr-field cmr-field-name b /cmr-field-name cmr-field-type java.util.Collection /cmr-field-type /cmr-field /ejb-relationship-role ejb-relationship-role !-- B = A -- ejb-relationship-role-name b2a /ejb-relationship-role-name multiplicity Many /multiplicity relationship-role-source ejb-name B /ejb-name...
  • Page 114 Chapter 8. Developing Entity Beans /jonas-ejb-relation ..Optional jonas-ejb-relation Optional. Default value is the abstract-schema-name of the foreign-key-jdbc-name destination bean of the “one” side of the relationship (that is, the source bean of the relationship role with multiplicity one), suffixed by “_” and its primary-key-field. in the example.
  • Page 115 Chapter 8. Developing Entity Beans c_idB In this case, the foreign key must be in the table of the bean which is on the "many" side of the relationship (that is, in table of the source bean of the relationship role with multiplicity many), t_A. 8.11.3.5.3.
  • Page 116 Chapter 8. Developing Entity Beans /ejb-relationship-role ejb-relationship-role !-- B = A -- ejb-relationship-role-name b2a /ejb-relationship-role-name multiplicity Many /multiplicity relationship-role-source ejb-name B /ejb-name /relationship-role-source /ejb-relationship-role /ejb-relation /relationships ..8.11.3.6.2. Database Mapping c_idA c_idB tJoin_AB cfk_idA cfk_idB In this case, there is a join table composed of the foreign keys of each Entity Bean table. 8.11.3.6.3.
  • Page 117 Chapter 8. Developing Entity Beans Optional jonas-ejb-relation Optional. Default value is built from the jdbc-table-name abstract-schema-names of the beans, separated by _. in the example. Optional. Default value is the abstract-schema-name of the foreign-key-jdbc-name destination bean, suffixed by “_” and by its primary-key-field. in the example.
  • Page 118 Chapter 8. Developing Entity Beans 8.11.3.7.2. Database Mapping c_idA c_idB tJoin_AB cfk_idA cfk_idB In this case, there is a join table composed of the foreign keys of each Entity Bean table. 8.11.3.7.3. JOnAS Deployment Descriptor ..jonas-ejb-relation ejb-relation-name a-b /ejb-relation-name jdbc-table-name tJoin_AB /jdbc-table-name jonas-ejb-relationship-role ejb-relationship-role-name a2b /ejb-relationship-role-name...
  • Page 119 Chapter 8. Developing Entity Beans Optional. Default value is the abstract-schema-name of the foreign-key-jdbc-name destination bean, suffixed by “_” and by its primary-key-field. in the example. B_idb A_ida Table 8-7. CMR fields mapping to primary-key-fields: Default values 8.11.4. CMR fields Mapping to Composite Primary-Keys In the case of composite primary keys, the database mapping should provide the capability to specify which column of a foreign key corresponds to which column of the primary key.
  • Page 120 Chapter 8. Developing Entity Beans ejb-name A /ejb-name /relationship-role-source cmr-field cmr-field-name b /cmr-field-name /cmr-field /ejb-relationship-role ejb-relationship-role !-- B = A -- ejb-relationship-role-name b2a /ejb-relationship-role-name multiplicity One /multiplicity relationship-role-source ejb-name B /ejb-name /relationship-role-source cmr-field cmr-field-name a /cmr-field-name /cmr-field /ejb-relationship-role /ejb-relation /relationships ..
  • Page 121 Chapter 8. Developing Entity Beans 8.11.4.1.3. JOnAS Deployment Descriptor Case 1: ..jonas-ejb-relation ejb-relation-name a-b /ejb-relation-name jonas-ejb-relationship-role ejb-relationship-role-name a2b /ejb-relationship-role-name foreign-key-jdbc-mapping foreign-key-jdbc-name cfk_id1b /foreign-key-jdbc-name key-jdbc-name c_id1b /key-jdbc-name /foreign-key-jdbc-mapping foreign-key-jdbc-mapping foreign-key-jdbc-name cfk_id2b /foreign-key-jdbc-name key-jdbc-name c_id2b /key-jdbc-name /foreign-key-jdbc-mapping /jonas-ejb-relationship-role /jonas-ejb-relation ..Case 2: ..
  • Page 122 Chapter 8. Developing Entity Beans ../entity ..entity ejb-name B /ejb-name ..cmp-field field-name id1B /field-name /cmp-field cmp-field field-name id2B /field-name /cmp-field ../entity ..relationships ejb-relation ejb-relation-name a-b /ejb-relation-name ejb-relationship-role !-- A = B -- ejb-relationship-role-name a2b /ejb-relationship-role-name multiplicity Many /multiplicity relationship-role-source ejb-name A /ejb-name...
  • Page 123: Tuning A Container For Entity Bean Optimizations

    Chapter 8. Developing Entity Beans tJoin_AB cfk_id1A cfk_id2A cfk_id1B cfk_id2B In this case, there is a join table composed of the foreign keys of each Entity Bean table. 8.11.4.2.3. JOnAS Deployment Descriptor ..jonas-ejb-relation ejb-relation-name a-b /ejb-relation-name jdbc-table-name tJoin_AB /jdbc-table-name jonas-ejb-relationship-role ejb-relationship-role-name a2b /ejb-relationship-role-name foreign-key-jdbc-mapping...
  • Page 124 Chapter 8. Developing Entity Beans container-serialized (Default.) The container insures the transaction serialization. This policy is suitable for most entity beans, particularly if the bean is accessed only from this container (shared = false). container-read-committed This policy is also container-serialized, except that accesses of outside transaction do not interfere with transactional accesses.
  • Page 125 Chapter 8. Developing Entity Beans 8.12.4. min-pool-size This optional integer value represents the minimum instances that will be created in the pool when the bean is loaded. This will improve bean instance create time, at least for the first instances. The default value is 0.
  • Page 126 Chapter 8. Developing Entity Beans 8.12.7. passivation-timeout Entity Bean instances are passivated at the end of the transaction and reactivated at the beginning of the next transaction. In the event that these instances are accessed outside a transaction, their state is kept in memory to improve performance.
  • Page 127: Developing Message-Driven Beans

    Chapter 9. Developing Message-Driven Beans The EJB 2.1 specification defines a new kind of EJB component for receiving asynchronous messages. This implements some type of “asynchronous EJB component method invocation” mechanism. The Message-Driven Bean (also referred to as MDB in the following) is an Enterprise JavaBean, not an Entity Bean or a Session Bean, that plays the role of a JMS MessageListener.
  • Page 128 Chapter 9. Developing Message-Driven Beans public class MdbBean implements MessageDrivenBean, MessageListener { private transient MessageDrivenContext mdbContext; public MdbBean() {} public void setMessageDrivenContext(MessageDrivenContext ctx) { mdbContext = ctx; public void ejbRemove() {} public void ejbCreate() {} public void onMessage(Message message) { try { TextMessage mess = (TextMessage)message;...
  • Page 129: Administration Aspects

    Chapter 9. Developing Message-Driven Beans container-transaction method ejb-name Mdb /ejb-name method-name * /method-name /method trans-attribute Required /trans-attribute /container-transaction /assembly-descriptor For the method, only the transaction attributes must be onMessage Required NotSupported used, since there can be no pre-existing transaction context. For the message selector specified in the previous example, the sent JMS messages are expected to have two properties, “Weight”...
  • Page 130: Running A Message-Driven Bean

    Chapter 9. Developing Message-Driven Beans class can be obtained from the com.swiftmq.appserver.jonas.JmsAdminForSwiftMQ SwiftMQ site. For the purpose of this implicit administration phase, the deployer must add the “jms” service in the list of the JOnAS services. For the example provided, the jonas.properties file should contain the following: jonas.services registry,security,jtm,dbm,jms,ejb...
  • Page 131 Chapter 9. Developing Message-Driven Beans 9.4.1. Launching the Message-Oriented Middleware If the configuration property contains the jms service, then the JOnAS JMS service jonas.services will be launched and may try to launch a JMS implementation (a MOM). For launching the MOM, three possibilities can be considered: 1.
  • Page 132: Transactional Aspects

    Chapter 9. Developing Message-Driven Beans configuration (for example, distribution, multi-servers), refer to the JORAM documentation on http://joram.objectweb.org. 9.5. Transactional Aspects Because a transactional context cannot be carried by a message (according to the EJB 2.1 speci- fication), an MDB will never execute within an existing transaction. However, a transaction may be started during the method execution, either due to a “required”...
  • Page 133 Chapter 9. Developing Message-Driven Beans Figure 9-1. Example Architecture There are two Message-Driven Beans in this example: $JONAS_ROOT/examples/src/mdb/sampleappli/StockHandlerBean is a Message-Driven Bean lis- • tening to a topic and receiving Map messages. The method runs in the scope of a onMessage transaction started by the container.
  • Page 134: Tuning The Message-Driven Bean Pool

    Chapter 9. Developing Message-Driven Beans with known values in order to check the results of updates at the end of the test (see $JONAS_ROOT/examples/src/mdb/sampleappli/EnvBean.java). Eleven messages are sent, the corresponding transactions are committed, and the last message sent causes the transaction to be rolled back.
  • Page 135 Chapter 9. Developing Message-Driven Beans 9.7.1. Message-Driven Bean Pool Example jonas-ejb-jar jonas-message-driven ejb-name Mdb /ejb-name jndi-name mdbTopic /jndi-name max-cache-size 20 /max-cache-size min-pool-size 10 /min-pool-size /jonas-message-driven /jonas-ejb-jar...
  • Page 136 Chapter 9. Developing Message-Driven Beans...
  • Page 137: Defining The Deployment Descriptor

    Chapter 10. Defining the Deployment Descriptor This chapter is for the Enterprise Bean provider; that is, the person in charge of developing the soft- ware components on the server side. 10.1. Principles The bean programmer is responsible for providing the deployment descriptor associated with the developed Enterprise Beans.
  • Page 138: Example Of Session Descriptors

    Chapter 10. Defining the Deployment Descriptor Information for the mapping of the bean to the underlying database, if it is an entity with container- • managed persistence. 10.2. Example of Session Descriptors ?xml version="1.0" encoding="ISO-8859-1"? ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" version="2.1"...
  • Page 139: Example Of Container-Managed Persistence Entity Descriptors (Cmp 1.1)

    Chapter 10. Defining the Deployment Descriptor /method trans-attribute NotSupported /trans-attribute /container-transaction container-transaction method ejb-name ExampleOne /ejb-name method-name methodTwo /method-name method-params method-param int /method-param /method-params /method trans-attribute Mandatory /trans-attribute /container-transaction container-transaction method ejb-name ExampleOne /ejb-name method-name methodTwo /method-name method-params method-param java.lang.String /method-param /method-params /method trans-attribute NotSupported /trans-attribute...
  • Page 140 Chapter 10. Defining the Deployment Descriptor description ... Bean example one ... /description display-name Bean example two /display-name ejb-name ExampleTwo /ejb-name home tests.Ex2Home /home remote tests.Ex2 /remote local-home tests.Ex2LocalHome /local-home local tests.Ex2Local /local ejb-class tests.Ex2Bean /ejb-class persistence-type Container /persistence-type prim-key-class tests.Ex2PK /prim-key-class reentrant False /reentrant cmp-version 1.x /cmp-version cmp-field...
  • Page 141: Tips

    Chapter 10. Defining the Deployment Descriptor jdbc-field-name dbf3 /jdbc-field-name /cmp-field-jdbc-mapping finder-method-jdbc-mapping jonas-method method-name findByField1 /method-name /jonas-method jdbc-where-clause where dbf1 = ? /jdbc-where-clause /finder-method-jdbc-mapping /jdbc-mapping /jonas-entity /jonas-ejb-jar 10.4. Tips Although some characters, such as “ ”, are legal, it is good practice to replace them with XML entity references.
  • Page 142 Chapter 10. Defining the Deployment Descriptor...
  • Page 143: Transactional Behavior Of Ejb Applications

    Chapter 11. Transactional Behavior of EJB Applications This chapter is for the Enterprise Bean provider; that is, the person in charge of developing the soft- ware components on the server side. 11.1. Declarative Transaction Management For container-managed transaction management, the transactional behavior of an Enterprise Bean is defined at configuration time and is part of the assembly-descriptor element of the standard deploy- ment descriptor.
  • Page 144 Chapter 11. Transactional Behavior of EJB Applications Transaction Client Transaction associated with Attribute transaction enterprise Bean’s method Required RequiresNew Mandatory error Supports Never error In the deployment descriptor, the specification of the transactional attributes appears in the assembly- descriptor as follows: assembly-descriptor container-transaction method...
  • Page 145: Bean-Managed Transactions

    Chapter 11. Transactional Behavior of EJB Applications 11.2. Bean-managed Transactions A bean that manages its transactions itself must set the element in its standard transaction-type deployment descriptor to: transaction-type Bean /transaction-type To demarcate the transaction boundaries in a bean with bean-managed transactions, the bean program- mer should use the interface, which is defined on an EJB javax.transaction.UserTransaction...
  • Page 146 Chapter 11. Transactional Behavior of EJB Applications jonas.service.jtm.remote false The Java Transaction Monitor can run outside any EJB server, in which case it can be launched in a stand-alone mode using the following command: TMServer Using these configuration facilities, it is possible to adapt the beans’ distribution to the resources (CPU and data) location, for optimizing performance.
  • Page 147 Chapter 11. Transactional Behavior of EJB Applications If the beans should run on the same machine, with the same server configuration, case 1 is the more • appropriate. If the beans should run on different machines, case 4 is the more appropriate, since it favors local •...
  • Page 148 Chapter 11. Transactional Behavior of EJB Applications...
  • Page 149: Enterprise Bean Environment

    Chapter 12. Enterprise Bean Environment This chapter is for the Enterprise Bean provider; that is, the person in charge of developing the soft- ware components on the server side. 12.1. Introduction The Enterprise Bean environment is a mechanism that allows customization of the Enterprise Bean’s business logic during assembly or deployment.
  • Page 150: Resource Environment References

    Chapter 12. Enterprise Bean Environment In the standard deployment descriptor, the declaration of a resource reference to a JDBC connection factory is: resource-ref res-ref-name jdbc/AccountExplDs /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref And the bean accesses the datasource as in the following: InitialContext ictx = new InitialContext();...
  • Page 151 Chapter 12. Enterprise Bean Environment home tests.SS1Home /home remote tests.SS1 /remote /ejb-ref The declaration of an EJB reference used for accessing the bean through its local home and component interfaces in the standard deployment descriptor is shown in the following example: ejb-local-ref ejb-ref-name ejb/locses1 /ejb-ref-name ejb-ref-type session /ejb-ref-type...
  • Page 152 Chapter 12. Enterprise Bean Environment ejb-name SSA /ejb-name jndi-name SSAHome /jndi-name jonas-ejb-ref ejb-ref-name ejb/ses1 /ejb-ref-name jndi-name SS1Home_one /jndi-name /jonas-ejb-ref /jonas-session jonas-session ejb-name SS1 /ejb-name jndi-name SS1Home_one /jndi-name jndi-local-name SS1LocalHome_one /jndi-local-name /jonas-session The bean locates the home interface of the other Enterprise Bean using the EJB reference with the following code: InitialContext ictx = new InitialContext();...
  • Page 153: Security Management

    Chapter 13. Security Management This chapter is for the Enterprise Bean provider; that is, the person in charge of developing the soft- ware components on the server side. 13.1. Introduction The EJB architecture encourages the Bean programmer to implement the Enterprise Bean class with- out hard-coding the security policies and mechanisms into the business methods.
  • Page 154: Programmatic Security Management

    Chapter 13. Security Management The application assembler defines the method permissions relationship in the deployment descriptor using the element as follows: method-permission Each element includes a list of one or more security roles and a list of one • method-permission or more methods.
  • Page 155 Chapter 13. Security Management then obtain the distinguished name of the caller principal using the method of the getName() interface. java.security.Principal 13.3.2. Use of isCallerInRole(String roleName) The main purpose of the method is to allow the Bean pro- isCallerInRole(String roleName) grammer to code the security checks that cannot be easily defined declaratively in the deployment descriptor using method permissions.
  • Page 156 Chapter 13. Security Management security-role-ref role-name role1 /role-name role-link tomcat /role-link /security-role-ref /session /enterprise-beans In summary, the role names used in the EJB code (in the isCallerInRole method) are, in fact, references to actual security roles, which makes the EJB code independent of the security configuration described in the deployment descriptor.
  • Page 157: Ejb Packaging

    Chapter 14. EJB Packaging This chapter describes how the bean components should be packaged. It is for the Enterprise Bean provider; that is, the person in charge of developing the software components on the server side. 14.1. Enterprise Bean Principles Enterprise Beans are packaged for deployment in a standard Java programming language Archive file, called an EJB-JAR file.
  • Page 158 Chapter 14. EJB Packaging...
  • Page 159: Application Deployment And Installation Guide

    Chapter 15. Application Deployment and Installation Guide This chapter is for the application deployer. 15.1. Deployment and Installation Process Principles 15.1.1. The Deployment and Installation of Enterprise Beans This chapter assumes that the Enterprise Bean provider followed the Enterprise Beans Programmer’s Guide and packaged the beans’...
  • Page 160 Chapter 15. Application Deployment and Installation Guide Perform the deployment: • Build an EJB-JAR file named with all the corresponding classes and the two ejb-jar.jar • deployment descriptors: mkdir -p ../../classes/META-INF ejb-jar.xml ../../classes/META-INF/ejb-jar.xml cp jonas-ejb-jar.xml ../../classes/META-INF/jonas-ejb-jar.xml cd ../../classes jar cvf eb/ejb-jar.jar META-INF/ejb-jar.xml META-INF/jonas-ejb-jar.xml eb/Account.class eb/AccountExplBean.class eb/AccountHome.class eb/AccountImplBean.class From the source directory, run the...
  • Page 161: Deploying And Installing A Web Application

    Chapter 15. Application Deployment and Installation Guide protocols="${protocols.names}" / /ejbjar /target 15.3. Deploying and Installing a Web Application Before deploying a Web application in the JOnAS application server, first package its components in a WAR file as explained in Chapter 18 WAR Packaging. , refer to the target WAR in the $JONAS_ROOT/examples/earsample/build.xml file.
  • Page 162 Chapter 15. Application Deployment and Installation Guide...
  • Page 163: Web Application Programmer's Guide

    III. Web Application Programmer’s Guide This section contains information for the Web Application programmer; that is, the person in charge of developing the web components on the server side. The Chapter 16 Developing Web Components guide explains how to construct Web components, as well as how to access Enterprise Beans from within the Web Components.
  • Page 165: Developing Web Components

    Chapter 16. Developing Web Components This chapter is for the Web Component provider; that is, the person in charge of developing the web components on the server side. 16.1. Introduction to Web Component Development A Web Component is a generic term that denotes both JSP pages and servlets. Web components are packaged in a file and can be deployed in a JOnAS server via the service.
  • Page 166: The Servlets

    Chapter 16. Developing Web Components font color="lightgreen" Product Reference /font font color="lightgreen" Product Name /font font color="lightgreen" Product Price /font !-- Each iteration of the loop display a line of the table -- Cart cart = (Cart) session.getAttribute("cart"); Vector products = cart.getProducts(); Enumeration enum = products.elements();...
  • Page 167 Chapter 16. Developing Web Components 16.3.1. Example The following example is a sample of a servlet that lists the content of a cart. This example is the servlet version of the previous JSP page example. import java.util.Enumeration; import java.util.Vector; import java.io.PrintWriter; import java.io.IOException;...
  • Page 168: Accessing An Ejb From A Servlet Or Jsp Page

    Chapter 16. Developing Web Components 16.4. Accessing an EJB from a Servlet or JSP Page Starting with JOnAS 2.6 with its container service, it is possible to access an enterprise Java bean and its environment in a J2EE-compliant way. The following sections describe: 1.
  • Page 169 Chapter 16. Developing Web Components Note that the following elements must be set in the file tied to this web application: web.xml ejb-ref ejb-ref-name ejb/Op /ejb-ref-name ejb-ref-type Session /ejb-ref-type home org.objectweb.earsample.beans.secusb.OpHome /home remote org.objectweb.earsample.beans.secusb.Op /remote ejb-link secusb.jar#Op /ejb-link /ejb-ref 16.4.2. Accessing the Local Home of a Bean: The following example shows how to obtain a local home interface using an EJB local OpLocalHome...
  • Page 170 Chapter 16. Developing Web Components env-entry-name envEntryString /env-entry-name env-entry-value This is a string from env-entry /env-entry-value env-entry-type java.lang.String /env-entry-type /env-entry 16.4.4. Starting Transactions in Servlets The servlet wants to start transactions via the UserTransaction import javax.transaction.UserTransaction; // We want to start transactions from client: get UserTransaction UserTransaction utx = null;...
  • Page 171: Defining The Web Deployment Descriptor

    Chapter 17. Defining the Web Deployment Descriptor This chapter is for the Web component provider; that is, the person in charge of developing the Web components on the server side. 17.1. Principles The Web component programmer is responsible for providing the deployment descriptor associated with the developed web components.
  • Page 172: Examples Of Web Deployment Descriptors

    Chapter 17. Defining the Web Deployment Descriptor If the WAR is packaged into an EAR file, the context-root used is the context specified in the • file. application.xml If the WAR is standalone, the context-root is the name of the WAR file (that is, the context-root is •...
  • Page 173 Chapter 17. Defining the Web Deployment Descriptor login-config auth-method BASIC /auth-method realm-name Example Basic Authentication Area /realm-name /login-config env-entry env-entry-name envEntryString /env-entry-name env-entry-value This is a string from the env-entry /env-entry-value env-entry-type java.lang.String /env-entry-type /env-entry !-- reference on a remote bean without ejb-link-- ejb-ref ejb-ref-name ejb/Op /ejb-ref-name ejb-ref-type Session /ejb-ref-type...
  • Page 174: Tips

    Chapter 17. Defining the Web Deployment Descriptor context-root /web-application /context-root /jonas-web-app 17.3. Tips Although some characters, such as " ", are legal, it is good practice to replace them with XML entity references. The following is a list of the predefined entity references for XML: <...
  • Page 175: War Packaging

    Chapter 18. WAR Packaging This chapter is for the Web component provider; that is, the person in charge of developing the web components on the server side. It describes how the web components should be packaged. 18.1. Principles Web components are packaged for deployment in a standard Java programming language Archive file called a file (Web ARchive), which is a similar to the package used for Java class libraries.
  • Page 176 Chapter 18. WAR Packaging...
  • Page 177: J2Ee Client Application Programmer's Guide

    IV. J2EE Client Application Programmer’s Guide This section contains information for the J2EE Client programmer; that is, the person in charge of developing the client components on the client side. Table of Contents 19. Launching J2EE Client Applications..................171 20. Defining the Client Deployment Descriptor ................173 21.
  • Page 179: Launching J2Ee Client Applications

    Chapter 19. Launching J2EE Client Applications This chapter is for the Client Component provider; that is, the person in charge of developing the client components on the client side. 19.1. Launching Clients The J2EE client application can be: A standalone client in a file •...
  • Page 180: Examples

    Chapter 19. Launching J2EE Client Applications A convenient way is to update the of your with your customized carol.properties client.jar file. That is, carol.properties jar -uf client.jar carol.properties 19.2.2. Trace Configuration The client container includes a file. This is the same file client.jar traceclient.properties as the one in...
  • Page 181: Defining The Client Deployment Descriptor

    Chapter 20. Defining the Client Deployment Descriptor This chapter is for the Client component provider; that is, the person in charge of developing the Client components on the client side. 20.1. Principles The Client component programmer is responsible for providing the deployment descriptor associated with the developed client components.
  • Page 182: Examples Of Client Deployment Descriptors

    Chapter 20. Defining the Client Deployment Descriptor 20.2. Examples of Client Deployment Descriptors Example of a standard Client Deployment Descriptor ( • application-client.xml ?xml version="1.0" encoding="UTF-8"? application-client xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" version="1.4" display-name Client of the earsample /display-name description client of the earsample /description env-entry env-entry-name envEntryString /env-entry-name env-entry-type java.lang.String /env-entry-type...
  • Page 183: Tips

    Chapter 20. Defining the Client Deployment Descriptor /jonas-client 20.3. Tips Although some characters, such as " ", are legal, it is good practice to replace them with XML entity references. The following is a list of the predefined entity references for XML: <...
  • Page 184 Chapter 20. Defining the Client Deployment Descriptor...
  • Page 185: Client Packaging

    Chapter 21. Client Packaging This chapter is for the Client component provider; that is, the person in charge of developing the client components on the client side. It describes how the client components should be packaged. 21.1. Principles Client components are packaged for deployment in a standard Java programming language Archive file called a JAR file (Java ARchive).
  • Page 186 Chapter 21. Client Packaging...
  • Page 187: J2Ee Application Assembler's Guide

    V. J2EE Application Assembler’s Guide This section contains information for the J2EE Application Assembler; that is, the person in charge of combining one or more components (ejb-jars and/or wars) to create a J2EE application. Table of Contents 22. Defining the EAR Deployment Descriptor ................181 23.
  • Page 189: Defining The Ear Deployment Descriptor

    Chapter 22. Defining the EAR Deployment Descriptor This chapter is for the Application Provider; that is, the person in charge of combining one or more components (EJB-JARs and/or WARs) to create a J2EE application. 22.1. Principles The application programmer is responsible for providing the deployment descriptor associated with the developed application (Enterprise ARchive).
  • Page 190: Advanced Example

    Chapter 22. Defining the EAR Deployment Descriptor /module module ejb ejb2.jar /ejb /module module web-uri web.war /web-uri context-root web /context-root /web /module /application 22.3. Advanced Example This is an advanced example of an Application Deployment Descriptors with alternative DD and security.
  • Page 191: Ear Packaging

    Chapter 23. EAR Packaging This chapter is for the Application Assembler; that is, the person in charge of combining one or more J2EE components (EJB-JARs and/or WARs) to create a J2EE application. It describes how the J2EE components should be packaged to create a J2EE application. 23.1.
  • Page 192 Chapter 23. EAR Packaging...
  • Page 193: Advanced Topics

    VI. Advanced Topics This section contains information for advanced JOnAS users. Table of Contents 24. JOnAS Services ......................... 187 25. JOnAS and the Connector Architecture................. 193 26. JMS User’s Guide ........................197 27. Ant EJB Tasks: Using EJB-JAR....................211 28. Login Modules in a Java Client ....................215 29.
  • Page 195: Jonas Services

    Chapter 24. JOnAS Services This chapter is intended for advanced JOnAS users who require that some “external” services run along with the EJB server. A service is something that may be initialized, started, and stopped. JOnAS itself already defines a set of services, some of which are cornerstones of the EJB Server. The JOnAS pre-defined services are listed in Section 3.5 Configuring JOnAS Services.
  • Page 196 Chapter 24. JOnAS Services String p1 = (String) ctx.lookup("jonas.service.serv1.p1"); ..} catch (NamingException e) { throw new ServiceException("..", e); ..public void start() throws ServiceException { ..this.started = true; public void stop() throws ServiceException { if (this.started) { this.started = false; ..
  • Page 197: Advanced Understanding

    Chapter 24. JOnAS Services // Get a reference on MyService. try { sv = (MyService) ServiceManager.getInstance().getService("serv1"); } catch (ServiceException e) { Trace.errln("Cannot find MyService:"+e); 24.1.4. Adding the Class of the New Service to JOnAS Package the class of the service into a file and add the JAR in the .jar JONAS_ROOT/lib/ext...
  • Page 198 Chapter 24. JOnAS Services depends on (that provide the ejb and web containers), thus these services must be launched before the service. depend on , thus the service must be launched before the services. It is possible to launch a stand-alone Transaction Manager with only the services.
  • Page 199 Chapter 24. JOnAS Services 24.2.2. The ServiceException exception is defined for Services. Its org.objectweb.jonas.service.ServiceException type is and it can encapsulate any java.lang.RuntimeException java.lang.Throwable 24.2.3. The ServiceManager class is responsible for creating, initial- org.objectweb.jonas.service.ServiceManager izing, and launching the services. It can also return a service from its name and list all the services.
  • Page 200 Chapter 24. JOnAS Services...
  • Page 201: Jonas And The Connector Architecture

    Chapter 25. JOnAS and the Connector Architecture This chapter is provided for advanced JOnAS users concerned with EAI (Enterprise Application In- tegration). 25.1. Introducing the Connector Architecture The Java Connector Architecture (Connectors) defines a way for enterprise applications (based on EJB, Servlet, JSP, or J2EE clients) to communicate with existing external Enterprise Information Systems (EIS) through an application server such as JOnAS.
  • Page 202 Chapter 25. JOnAS and the Connector Architecture resource-ref res-ref-name eis/MyEIS /res-ref-name res-type javax.resource.cci.ConnectionFactory /res-type res-auth Container /res-auth /resource-ref The mapping of the connection factory to the actual JNDI name (here ) is done in the adapt_1 JOnAS-specific deployment descriptor with the following element: jonas-resource res-ref-name eis/MyEIS /res-ref-name jndi-name adapt_1 /jndi-name...
  • Page 203 Chapter 25. JOnAS and the Connector Architecture Place the RAR file in the autoload directory of ; default • $JONAS_BASE value is . Note that it may be different if $JONAS_BASE/rars/autoload in jonas.properties is configured differently. jonas.service.resource.autoload Add the RAR: •...
  • Page 204 Chapter 25. JOnAS and the Connector Architecture...
  • Page 205: Jms User's Guide

    Chapter 26. JMS User’s Guide This chapter is provided for advanced JOnAS users concerned with JMS (Java Message Service). As required by the J2EE v1.4 specification, application components (servlets and enterprise beans) can use JMS for Java messaging. Furthermore, applications can use Message-driven Beans (MDBs) for asynchronous EJB method invocation, as specified by the EJB 2.1 specification.
  • Page 206 Chapter 26. JMS User’s Guide You can find a sample JMS application in $JONAS_ROOT/examples/src/jms/; it is described in Sec- tion 26.6 A JMS EJB Example. 26.2.1. Accessing the Connection Factory The EJB specification introduces the concept of resource manager connection factory references. This concept also appears in the J2EE v1.4 specification.
  • Page 207 Chapter 26. JMS User’s Guide 26.2.2. Accessing the Destination Object Accessing a JMS destination within the code of an application component requires using a Resource , which is represented in the standard deployment descriptor as follows: Environment Reference resource-env-ref resource-env-ref-name jms/stockQueue /resource-env-ref-name resource-env-ref-type javax.jms.Queue resource-env-ref-type /resource-env-ref The application component’s source code should contain:...
  • Page 208 Chapter 26. JMS User’s Guide A method that performs JMS operations should always contain the session create and close statements, as follows: public void doSomethingWithJMS (...) { session = connection.createSession(...); ... // JMS operations session.close(); The contained JMS operations will be a part of the transaction, if there is one, when the JOnAS server executes the method.
  • Page 209: Some Programming Rules And Restrictions When Using Jms Within Ejb

    Chapter 26. JMS User’s Guide 26.2.5. Authentication with JMS If your JMS implementation performs user authentication, the following methods can be used on connection factories: method can be used on • createConnection(String userName, String password) ConnectionFactory method can be used •...
  • Page 210 Chapter 26. JMS User’s Guide To keep the connection open during the life of a bean instance, the programming style shown in the following example is preferred, since it avoids many connection opening and closing operations: public class EjbCompBean implements SessionBean { ConnectionFactory qcf = null;...
  • Page 211 Chapter 26. JMS User’s Guide 26.3.2. Starting Transactions after JMS Connection or Session Creation Currently, it is not possible to start a bean-managed transaction after the creation of a JMS session and have the JMS operations involved in the transaction. In the following code example, the JMS operations will not occur within the transaction: public class EjbCompBean implements SessionBean {...
  • Page 212: Jms Administration

    Chapter 26. JMS User’s Guide Programming EJB components with bean-managed transactions can result in complex code. Using container-managed transactions can help avoid problems such as those previously described. 26.4. JMS Administration Applications using messaging require some JMS-administered objects: connection factories and des- tinations.
  • Page 213: Running An Ejb Performing Jms Operations

    Chapter 26. JMS User’s Guide 26.4.1. JMS Service Administration To use the JMS service in the default configuration, all that is necessary is requiring the use of the JMS service in the file: jonas.properties jonas.services security,jtm,dbm,jms,ejb JOnAS will not create additional connection factories when using the default configuration. How- ever, JOnAS can create requested destination objects at server launching time, if specified in the file.
  • Page 214 Chapter 26. JMS User’s Guide In this case, the MOM will be launched automatically at server launching time (command jonas start). Note To use the JMS resources from a distant host, the property value in the default hostname configuration file must be changed from to the actual host name.
  • Page 215: A Jms Ejb Example

    Chapter 26. JMS User’s Guide 26.5.2. Accessing the Message-Oriented Middleware as a J2EE1.4 Adapter With JOnAS, a JMS server can be accessed through a resource adapter that can be deployed. To deploy such a resource adapter, put the corresponding archive file ( ) in JOnAS’s *.rar directory, declare it at the end of the...
  • Page 216 Chapter 26. JMS User’s Guide The JMS-administered objects have been made available to the ConnectionFactory Topic bean by a resource reference in the first example, and by a resource environment reference in the second example. The standard deployment descriptor should contain the following element: resource-ref res-ref-name jms/conFactSender /res-ref-name res-type javax.jms.ConnectionFactory /res-type...
  • Page 217 Chapter 26. JMS User’s Guide This method sends a message containing its String argument. 26.6.2. The Entity Bean The example uses the simple Entity Bean Account for writing data into a database. Refer to the sample eb, which is described in Chapter 2 Getting Started with JOnAS and in the JOnAS Tutorial. 26.6.3.
  • Page 218 Chapter 26. JMS User’s Guide static ConnectionFactory cf = null; static Topic topic = null; public static void main(String[] arg) { ictx = new InitialContext(); cf = (ConnectionFactory) ictx.lookup("JCF"); topic = (Topic) ictx.lookup("sampleTopic"); Connection conn = cf.createConnection(); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);...
  • Page 219: Ant Ejb Tasks: Using Ejb-Jar

    Chapter 27. Ant EJB Tasks: Using EJB-JAR nested element uses the tool to build JOnAS-specific stubs and skeletons and jonas GenIC constructs a JAR file that can be deployed to the JOnAS Application Server. The build process always determines if the EJB stubs/skeletons and the EJB-JAR file are up-to-date and performs the minimum amount of work required.
  • Page 220 Chapter 27. Ant EJB Tasks: Using EJB-JAR Attribute Description Required javac Java compiler to use. If omitted, it defaults to the value of property. build.compiler javacopts Options to pass to the Java compiler. protocols Comma-separated list of protocols (chosen within jrmp, iiop, cmi) for which stubs should be generated.
  • Page 221 Chapter 27. Ant EJB Tasks: Using EJB-JAR This example shows being used to generate a single deployment JAR using a JOnAS EJB ejbjar container. This example does require the deployment descriptors to use the naming standard. This creates only one EJB-JAR file: TheEJBJar.jar ejbjar srcdir="${build.classes}"...
  • Page 222 Chapter 27. Ant EJB Tasks: Using EJB-JAR...
  • Page 223: Login Modules In A Java Client

    Chapter 28. Login Modules in a Java Client This chapter describes how to configure an environment to use login modules with Java clients, and provides an example of this. 28.1. Configuring an Environment to Use Login Modules with Java Clients The login modules for use by clients are defined in the file.
  • Page 224 Chapter 28. Login Modules in a Java Client LoginContext loginContext = new LoginContext("jaasclient", handler2); Finally, call the login method on the LoginContext instance. • loginContext.login(); If there are no exceptions, the authentication is successful. If the supplied password is incorrect, authentication can fail.
  • Page 225: Web Services With Jonas

    Chapter 29. Web Services with JOnAS Web Services can be used within EJBs or servlets/JSPs. This integration conforms to the JSR 921(Web Service for J2EE v1.1) specification (see http://www.jcp.org/en/jsr/details?id=921). Note While JSR 921 is in a maintenance review phase, we provide a link to the 109(v1.0) specification (http://www.jcp.org/en/jsr/details?id=109).
  • Page 226 Chapter 29. Web Services with JOnAS Web Services are generally exposed and discovered through a standard registry service. With these standards, Web Services consumers (whether they be users or other applications) can access a broad range of information—personal financial data, news, weather, and enterprise documents—through applications that reside on servers throughout the network.
  • Page 227: Exposing A J2Ee Component As A Web Service

    Chapter 29. Web Services with JOnAS The servlet is used to respond to a client request and dispatch the call to the designated instance of servant (the SSB or JAX-RPC class exposed as Web Service). It handles the deserialization of incoming SOAP message to transform SOAP XML into a Java Object, perform the call, and serialize the call result (or the thrown exception) into SOAP XML before send the response message to the client.
  • Page 228 Chapter 29. Web Services with JOnAS param(s), and work on processing a list of SOAP Headers defined with soap-headers child elements. The Handler is run as the SOAP actors defined in the list of SOAP-roles. A webservice-description defines a set of port-components, a WSDL Definition (describing the Web Service) and a mapping file (WSDL-2-Java bindings).
  • Page 229 Chapter 29. Web Services with JOnAS !-- The endpoint interface defining methods exposed -- !-- for the endpoint service-endpoint-interface org.objectweb.ws.servlets.wsendpoint.WSEndpointSei /service-endpoint-interface !-- Link to the J2EE component (servlet/EJB) !-- implementing methods of the SEI service-impl-bean !-- name of the servlet defining the JAX-RPC endpoint !-- can be ejb-link if SSB is used (only in EjbJar !) servlet-link WSEndpoint /servlet-link /service-impl-bean...
  • Page 230: The Web Services Client

    Chapter 29. Web Services with JOnAS host Configure the hostname to use in URL (must be an available web container host). port Configure the port number to use in URL (must be an available HTTP/HTTPS connector port number). When these values are not set, JOnAS will attempt to determine the default values for host and port. Limitations: The host can be determined only when only one host is set for the web container.
  • Page 231 Chapter 29. Web Services with JOnAS -needs to be in the wsdl directory -required if generated interface and sei are declared. -- wsdl-file WEB-INF/wsdl/stockQuote.wsdl /wsdl-file !-- (Optional) A file specifying the correlation of the WSDL definition to the interfaces (Service Endpoint Interface, Service Interface).
  • Page 232: Wsgen

    Chapter 29. Web Services with JOnAS !-- A list of SOAP actor definition that the Handler will play as a role. A soap-role is a namespace URI. -- soap-role http://actor.soap.objectweb.org /soap-role !-- A list of port-name element defines the WSDL port-name that a handler should be associated with.
  • Page 233: Limitations

    Chapter 29. Web Services with JOnAS When using service-ref (from EJB-JARs, Web Applications, or clients), WsGen automatically gener- ates a stub from WSDL (if a generated service interface name is provided). 29.4.1. Usage WsGen is used usually from an ant build file. Simply add this taskdef under the EJB-JAR taskdef: taskdef name="wsgen"...
  • Page 234 Chapter 29. Web Services with JOnAS...
  • Page 235: How-To Documents

    VII. How-to Documents This section contains information for a variety of JOnAS users. Table of Contents 30. JOnAS Versions Migration Guide................... 229 31. How to Install a jUDDI Server on JOnAS................231 32. Clustering with JOnAS ......................235 33. Distributed Message Beans in JOnAS 4.1................245 34.
  • Page 237: Jonas Versions Migration Guide

    Chapter 30. JOnAS Versions Migration Guide This section describes how to migrate from JOnAS 3.3.x to JOnAS 4.1. 30.1. JOnAS 3.3.x to Red Hat Application Server 1.0 Applications developed for JOnAS 3.3.x do not require changes; however, they should be rede- ployed (GenIC).
  • Page 238 Chapter 30. JOnAS Versions Migration Guide 30.1.2. Running EJB 2.1 Message-driven Beans The use of EJB 2.1 Message-driven beans (MDBs) requires changing the JOnAS configuration. While for EJB 2.0 MDBs the JOnAS JMS service was required, EJB 2.1 MDBs can only be used through a JMS Connector (J2EE CA 1.5 resource adapter).
  • Page 239: How To Install A Juddi Server On Jonas

    Chapter 31. How to Install a jUDDI Server on JOnAS 31.1. UDDI Server A UDDI server is basically a web services registry. Providers of web services put technical information (such as the WSDL definition used to access the web service, its description, ...) inside these registries. Web services users can browse these registries to choose a web service that fits their needs.
  • Page 240: Create The Database

    Chapter 31. How to Install a jUDDI Server on JOnAS # jUDDI HTTP Proxy Properties juddi.httpProxySet = true juddi.httpProxyHost = proxy.viens.net juddi.httpProxyPort = 8000 juddi.httpProxyUserName = sviens juddi.httpProxyPassword = password 3. Launch the compilation with Ant WAR. This produces a inside the juddi.war directory.
  • Page 241 Chapter 31. How to Install a jUDDI Server on JOnAS 0.8 : juddi_ase.sql • 0.9rc1 : create_database.sql insert_publishers.sql • PostgreSQL • 0.8 : juddi_postgresql.sql • 0.9rc1 : create_database.sql insert_publishers.sql • Oracle • 0.8 : juddi_oracle.sql • 0.9rc1 : create_database.sql insert_publishers.sql •...
  • Page 242: Links

    Chapter 31. How to Install a jUDDI Server on JOnAS jonas.service.dbm.datasources datasource-filename 31.4.4. Deploy and Test jUDDI Deploy jUDDI on JOnAS with a command similar to the following: $ jonas admin -a ~/juddi/juddi.war You should see the following output: 11:53:57,984 : RegistryServlet.init : jUDDI Starting: Initializing resources and subsystems.
  • Page 243: Clustering With Jonas

    Chapter 32. Clustering with JOnAS This chapter describes how to configure Apache, Tomcat, and JOnAS to install a cluster. This configuration uses the Apache/Tomcat plug-in to provide load balancing and high avail- mod_jk ability at the JSP/Servlet level. The plug-in enables the use of the Apache HTTP server in mod_jk front of one or more Tomcat JSP/Servlet engines, and provides the capability of forwarding some of the HTTP requests (typically those concerning dynamic pages—such as JSP and Servlet requests) to...
  • Page 244: Load Balancing At The Web Level With Mod_Jk

    Chapter 32. Clustering with JOnAS This architecture provides: Load Balancing: Requests can be dispatched over a set of servers to distribute the load. This im- • proves the “scalability” by allowing more requests to be processed concurrently. High Availability (HA): having several servers able to fulfill a request makes it possible to ensure •...
  • Page 245 Chapter 32. Clustering with JOnAS 32.2.1. Configuring the JK Module (mod_jk) 32.2.1.1. JK module principles is a plug-in that handles the communication between Apache and Tomcat. mod_jk uses the concept of a worker. A worker is a Tomcat instance that is running to perform Servlet mod_jk requests coming from the web server.
  • Page 246 Chapter 32. Clustering with JOnAS worker.worker1.lbfactor=1 # ---------------- # Second worker # ---------------- worker.worker2.port=8009 worker.worker2.host=server2 worker.worker2.type=ajp13 worker.worker2.lbfactor=1 # ---------------------- # Load Balancer worker # ---------------------- worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=worker1,worker2 32.2.1.3. Configure Tomcat To configure Tomcat, perform the following configuration steps for each Tomcat server: 1.
  • Page 247: Session Replication At The Web Level

    Chapter 32. Clustering with JOnAS jdbc-table-name clusterIdentityEC /jdbc-table-name cmp-field-jdbc-mapping field-name name /field-name jdbc-field-name c_name /jdbc-field-name /cmp-field-jdbc-mapping cmp-field-jdbc-mapping field-name number /field-name jdbc-field-name c_number /jdbc-field-name /cmp-field-jdbc-mapping finder-method-jdbc-mapping jonas-method method-name findByNumber /method-name /jonas-method jdbc-where-clause where c_number = ? /jdbc-where-clause /finder-method-jdbc-mapping finder-method-jdbc-mapping jonas-method method-name findAll /method-name /jonas-method jdbc-where-clause /jdbc-where-clause...
  • Page 248 Chapter 32. Clustering with JOnAS Figure 32-3. Session Replication The term session replication is used when the current service state is being replicated across multiple application instances. Session replication occurs when the information stored in an HttpSession is replicated from, in this example, one Servlet engine instance to another. This could be data such as items contained in a shopping cart or information being entered on an insurance application.
  • Page 249: Load Balancing At The Ejb Level

    Chapter 32. Clustering with JOnAS maxIdleSwap="-1" maxIdleBackup="-1" pathname="null" printSessionInfo="true" checkInterval="10" expireSessionsOnShutdown="false" serviceclass="org.apache.catalina.cluster.mcast.McastService" mcastAddr="237.0.0.1" mcastPort="45566" mcastFrequency="500" mcastDropTime="5000" tcpListenAddress="auto" tcpListenPort="4001" tcpSelectorTimeout="100" tcpThreadCount="2" useDirtyFlag="true" /Manager /Context Note: The multicast address and port must be identically configured for all JOnAS/Tomcat instances. 32.3.1. Running your Web Application The web application is now ready to run in the cluster: 1.
  • Page 250 Chapter 32. Clustering with JOnAS Figure 32-4. Load Balancing 32.4.1. CMI Principles CMI is a new ORB used by JOnAS to provide clustering for load balancing and high availability. Several instances of JOnAS can be started together in a cluster to share their EJBs. It is possible to start the same EJB on each JOnAS, or to distribute their load.
  • Page 251: Preview Of A Coming Version

    Chapter 32. Clustering with JOnAS # Multicast address used by the registries in the cluster carol.cmi.multicast.address=224.0.0.35:35467 # Groupname for JavaGroups carol.cmi.multicast.groupname=G1 # Factor used for this server in weighted round robin algorithms carol.cmi.rr.factor=100 For the client, specify the list of registries available in the file: •...
  • Page 252: References

    Chapter 32. Clustering with JOnAS A node (computer) that hosts one or more servers. A web container. An EJB container. A JOnAS instance that A JOnAS instance that hosts a web container. hosts an EJB container. A JOnAS instance that hosts a web container and an EJB container.
  • Page 253: Distributed Message Beans In Jonas 4.1

    Chapter 33. Distributed Message Beans in JOnAS 4.1 JOnAS release 4.1 dramatically simplifies the use of a distributed JORAM platform from within JOnAS servers. Such a configuration allows, for example, a bean hosted by JOnAS instance "A" to send messages on a JORAM queue, to which a Message-Driven Bean (MDB) hosted by JOnAS instance "B"...
  • Page 254: Specific Configuration

    Chapter 33. Distributed Message Beans in JOnAS 4.1 /server server id="1" name="S1" hostname="hostB" network domain="D1" port="16301"/ service class="org.objectweb.joram.mom.proxies.ConnectionManager" args="root root"/ service class="org.objectweb.joram.mom.proxies.tcp.TcpProxyService" args="16010"/ service class="fr.dyade.aaa.jndi2.distributed.DistributedJndiServer" args="16400 0 1"/ /server /config This configuration describes a platform made of two servers, "s0" and "s1", hosted by machines "hostA"...
  • Page 255: The Beans

    Chapter 33. Distributed Message Beans in JOnAS 4.1 jonas-config-property-name HostName /jonas-config-property-name jonas-config-property-value hostB /jonas-config-property-value /jonas-config-property The other default settings do not need to be changed. The shared queue is hosted by JORAM server s1. You then need to declare it in JOnAS B’s file as follows: joram-admin.cfg Queue...
  • Page 256 Chapter 33. Distributed Message Beans in JOnAS 4.1 /jonas-resource jonas-resource-env resource-env-ref-name jms/sharedQueue /resource-env-ref-name jndi-name scn:comp/sharedQueue /jndi-name /jonas-resource-env The ConnectionFactory is retrieved from the local JNDI registry of the bean. However, the Queue is retrieved from the distributed JORAM JNDI server because its name starts with the scn:comp/ prefix.
  • Page 257: How To Use Axis In Jonas

    Chapter 34. How to use Axis in JOnAS This chapter describes basic Axis use within JOnAS. It assumes that you do not require any explana- tion about Axis-specific tasks (for example, Axis deployment with ). Before deployment in Axis, WSDD you must verify that the file matches the site machine configuration (the deploy.wsdd...
  • Page 258: Axis Tests

    Chapter 34. How to use Axis in JOnAS 34.2. Embedded Axis Webapp 34.2.1. Constraints The EJBs exposed as Web Services can have either local or remote interfaces. • The EAR must contain a Webapp including a with Axis servlet mapping. •...
  • Page 259 Chapter 34. How to use Axis in JOnAS : the port of the listening http daemon (default : 9000) port : the hostname of the server running the JOnAS server (default : localhost) host...
  • Page 260 Chapter 34. How to use Axis in JOnAS...
  • Page 261: Using Websphere Mq Jms

    Chapter 35. Using WebSphere MQ JMS WebSphere MQ (formerly MQSeries) is the messaging platform developed by IBM; it provides Java and JMS interfaces. Section 3.5.9 Configuring the JMS Service has information on the JMS service. This chapter explains how WebSphere MQ can be used as a JMS provider within a JOnAS application server.
  • Page 262: Configuring Websphere Mq

    Chapter 35. Using WebSphere MQ JMS 3. In the directory, type: ant create_jonasbase $JONAS_ROOT 4. Set the JONAS_BASE environment variable so that it points towards the directory. JONAS_EJB 5. In the directory, type: ant create_jonasbase $JONAS_ROOT The JOnAS servers may now be configured independently. 35.2.1.
  • Page 263 Chapter 35. Using WebSphere MQ JMS You also need to add JOnAS’s library to WebSphere MQ’s classpath. client.jar When starting, JOnAS expects JMS objects to have been created and bound to the registry. Those objects are connection factories, needed for connecting to WebSphere MQ destinations and other destinations.
  • Page 264: Starting The Application

    Chapter 35. Using WebSphere MQ JMS To create a and bind it with the name , enter: QueueConnectionFactory JQCF InitCtx> DEF QCF(JQCF) You can add more parameters (for example, to specify the queue manager). To create a that represents a WebSphere MQ queue named and bind it with the Queue myWSMQqueue...
  • Page 265: Web Service Interoperability Between Jonas And Bea Weblogic

    Chapter 36. Web Service Interoperability between JOnAS and BEA WebLogic This chapter describes the basic use of web services between JOnAS and WebLogic Server. It assumes that the reader does not require any explanation about Axis-specific tasks (Axis deployment with , etc.).
  • Page 266 Chapter 36. Web Service Interoperability between JOnAS and BEA WebLogic !-- use of remote interfaces to access the EJB is allowed, but this example uses local interfaces -- parameter name="homeInterfaceName" value="EJB_Home"/ parameter name="remoteInterfaceName" value="EJB_Interface"/ !-- JNDI properties: it may be necessary to modify hostname and port number, protocol name could be changed in accordance with the ORB used -- !-- for a RMI ORB --...
  • Page 267: Accessing A Weblogic Web Service From A Jonas Ejb

    Chapter 36. Web Service Interoperability between JOnAS and BEA WebLogic 36.2.2.1. Generation of Web Service Client Class To access the web service, generate the client class using the Ant task . For example: clientgen clientgen wsdl=" wsdl_url " packageName="my.package" clientJar="client.jar" generatePublicFields="True" keep generated="True"/ This command creates four classes: Service implementation...
  • Page 268 Chapter 36. Web Service Interoperability between JOnAS and BEA WebLogic servicegen destEar="ears/myWebService.ear" contextURI="web_services" service ejbJar="jars/myEJB.jar" targetNamespace="http://www.bea.com/examples/Trader" serviceName="TraderService" serviceURI="/TraderService" generateTypes="True" expandMethods="True" /service /servicegen Use the version of provided with WebLogic Server. 36.3.1.2. WebService Deployment Deploy the webservice using the WebLogic administration console, and deploy the corresponding application.
  • Page 269 Chapter 36. Web Service Interoperability between JOnAS and BEA WebLogic 36.3.2.3. Deploy the EJB on JOnAS Deploy the EJB using the JOnAS administration console or command.
  • Page 270 Chapter 36. Web Service Interoperability between JOnAS and BEA WebLogic...
  • Page 271: Rmi-Iiop Interoperability Between Jonas And Bea Weblogic

    Chapter 37. RMI-IIOP Interoperability between JOnAS and BEA WebLogic This chapter describes the basic interoperability between JOnAS and a BEA WebLogic Server using RMI-IIOP. 37.1. Accessing a JOnAS EJB from a WebLogic Server’s EJB using RMI-IIOP 37.1.1. JOnAS Configuration No modification to the EJB code is necessary. However, to deploy it for use with the iiop protocol, add the tag protocols and indicate iiop when creating the .
  • Page 272 Chapter 37. RMI-IIOP Interoperability between JOnAS and BEA WebLogic 37.2. Access a WebLogic Server’s EJB from a JOnAS EJB using RMI-IIOP 37.2.1. WebLogic Configuration No modification to the EJB code is necessary. However, to deploy the EJB for use with the iiop protocol, add the element iiop="true"...
  • Page 273: Interoperability Between Jonas And Corba

    Chapter 38. Interoperability between JOnAS and CORBA This chapter describes the basic interoperability between JOnAS and CORBA using RMI-IIOP. 38.1. Accessing an EJB Deployed on a JOnAS Server by a CORBA Client 38.1.1. JOnAS Configuration No modification to the EJB code is necessary. However, the EJB should be deployed for the iiop protocol (for example, when the is created, add the tag "protocols"...
  • Page 274 Chapter 38. Interoperability between JOnAS and CORBA javax/ejb/EJBMetaData.idl javax/ejb/EJBObject.idl javax/ejb/Handle.idl javax/ejb/HomeHandle.idl javax/ejb/RemoveException.idl javax/ejb/RemoveEx.idl org/omg/boxedRMI/seq1_octet.idl org/omg/boxedRMI/seq1_wchar.idl org/javax/rmi/CORBA/ClassDesc.idl org/omg/boxedRMI/java/lang/seq1_StackTraceElement.idl Copy these files to the directory in which CORBA client development is being done. 38.1.3. CORBA Client Development 38.1.3.1. idlj Once idl files are generated, apply the idlj tool to build Java files corresponding to the idl files (idlj = idl to java).
  • Page 275: Accessing A Corba Service By An Ejb Deployed On Jonas Server

    Chapter 38. Interoperability between JOnAS and CORBA //Resolve the object reference in naming //make sure there are no spaces between "" NameComponent nc= new NameComponent("HelloHome",""); NameComponent path[] = {nc}; HelloHome tradeRef=HelloHomeHelper.narrow(ncRef.resolve(path)); //Call the Trader EJB and print results Hello hello=tradeRef.create(); String tr=hello.say();...
  • Page 276 Chapter 38. Interoperability between JOnAS and CORBA 38.2.2. Setting up the EJB on JOnAS Set up the EJB on JOnAS as follows: 1. To call the CORBA service, generate the Java file corresponding to the idl file. To do this, apply the idlj tool on the idl file corresponding to the CORBA service description: idlj -fclient Hello.idl 2.
  • Page 277: How To Migrate The New World Cruises Application To Jonas

    Chapter 39. How to Migrate the New World Cruises Application to JOnAS This section describes the modifications required to migrate the J2EE application “New World Cruise” to a JOnAS server. “New World Cruise” is a sample application that comes with Sun ONE Application Server. (See http://developers.sun.com/sw/building/tech_articles/jaxrpc/synopsis.html.) 39.1.
  • Page 278: Sun Web Service

    Chapter 39. How to Migrate the New World Cruises Application to JOnAS For the session Bean, describe the mapping between: The EJB name and JNDI name (JNDI name=ejb/ejb name) • 39.1.3. Web Application Create the that corresponds to the deployment descriptor of the New jonas-web.xml World Cruise application.
  • Page 279 Chapter 39. How to Migrate the New World Cruises Application to JOnAS // Get our port interface AirPack.AirClientGenClient.AirService service = new AirPack.AirClientGenClient.AirService_Impl(); AirPack.AirClientGenClient.AirServiceServantInterface port = service getAirServiceServantInterfacePort(); // Get the stub and set it to save the HTTP log. AirPack.AirClientGenClient.AirServiceServantInterface_Stub stub = (AirPack.AirClientGenClient.AirServiceServantInterface_Stub) port;...
  • Page 280: Jonas Web Service

    Chapter 39. How to Migrate the New World Cruises Application to JOnAS airlist.jsp clear.gif crubook.jsp crudone.jsp cruise_icon.gif cruises.jsp flights.jsp index.jsp nwcl_banner.gif nwcl_banner_a.gif nwcl_styles.css WEB-INF/web.xml 39.3. JOnAS Web Service 39.3.1. Deployment This web service uses the EJB stateless CruiseManager. To deploy this web service, create the web service deployment descriptor: deployment xmlns="http://xml.apache.org/axis/wsdd/"...
  • Page 281 Chapter 39. How to Migrate the New World Cruises Application to JOnAS jclient org.apache.axis.client.AdminClient -lhttp://localhost:port/context-root-axis.war/servlet/AxisServlet ws_wsdd 39.3.2. Axis Classes Generation To call a web service, first generate Axis classes. The generated classes will allow a web service to be called using the static method. For this step, download the file corresponding to the SUN web service description AirService.wsdl...
  • Page 282 Chapter 39. How to Migrate the New World Cruises Application to JOnAS WEB-INF/classes/AirService_JOnAS/Client/ \ CruiseManagerServiceLocator/AirServiceLocator.class PalmTree.jpg aboutus.jsp air_icon.gif airbook.jsp airclient.jsp airdates.jsp airdone.jsp airlist.jsp clear.gif crubook.jsp crudone.jsp cruise_icon.gif cruises.jsp flights.jsp index.jsp nwcl_banner.gif nwcl_banner_a.gif nwcl_styles.css WEB-INF/web.xml...
  • Page 283: Configuring Jdbc Resource Adapters

    Chapter 40. Configuring JDBC Resource Adapters Instead of using the JOnAS database service for configuring DataSources, it is also possible to use the JOnAS resource service and JDBC connectors compliant with the J2EE Connector Architecture specification. The resulting functionality is the same, and the benefit is the management of pools of JDBC PrepareStatements.
  • Page 284 Chapter 40. Configuring JDBC Resource Adapters password Database user password An RAR for Oracle configured as in JNDI and using the Oracle thin DriverManger JDBC jdbc_1 driver, should be described in a file called , with the following properties configured Oracle1_DM.rar in the file:...
  • Page 285 Chapter 40. Configuring JDBC Resource Adapters jonas-config-property jonas-config-property-name loginTimeout /jonas-config-property-name jonas-config-property-value /jonas-config-property-value /jonas-config-property jonas-config-property jonas-config-property-name URL /jonas-config-property-name jonas-config-property-value jdbc:mysql://malte/db_jonas /jonas-config-property-value /jonas-config-property jonas-config-property jonas-config-property-name dsClass /jonas-config-property-name jonas-config-property-value org.gjt.mm.mysql.Driver /jonas-config-property-value /jonas-config-property jonas-config-property jonas-config-property-name mapperName /jonas-config-property-name jonas-config-property-value rdb.mysql /jonas-config-property-value /jonas-config-property To create a PostgreSQL RAR configured as in JNDI, it should be described in a file called jdbc_3 , with the following properties configured in the...
  • Page 286: Using Cmp2.0/Jorm

    Chapter 40. Configuring JDBC Resource Adapters 40.2. Using CMP2.0/JORM For implementing the EJB 2.0 persistence (CMP2.0), JOnAS relies on the JORM framework (see http://www.objectweb.org/jorm/index.html). JORM must adapt its object-relational mapping to the underlying database, and makes use of adapters called “mappers” for this purpose. Thus, for each type of database (and more precisely for each JDBC driver), the corresponding mapper must be specified in file of the deployed RAR.
  • Page 287 Chapter 40. Configuring JDBC Resource Adapters To enable this tracing feature, perform the following configuration steps: 1. Update the appropriate RAR file’s file by setting the property to jonas-ra.xml dsClass com.p6spy.engine.spy.P6SpyDriver 2. Set the property in the file (located in realdriver spy.properties $JONAS_BASE/conf...
  • Page 288: Migration From Dbm Service To The Jdbc Ra

    Chapter 40. Configuring JDBC Resource Adapters /jonas-resource In the file: $JONAS_BASE/conf/spy.properties realdriver=org.postgresql.Driver $JONAS_BASE/conf/trace.properties logger.org.objectweb.jonas.jdbc.sql.level DEBUG 40.5. Migration from dbm Service to the JDBC RA The migration of a file to a similar Resource Adapter can be accomplished Database.properties through the execution of the following RAConfig tool command. Refer to Section 6.7 RAConfig for a complete description.
  • Page 289: Configuring Resource Adapters

    Chapter 41. Configuring Resource Adapters This chapter describes how to use resource adapters with JOnAS. 41.1. Principles Resource Adapters are packaged for deployment in a standard Java programming language Archive file called a RAR file (Resource ARchive), which is described in the J2EE Connector Architecture specification.
  • Page 290 Chapter 41. Configuring Resource Adapters jdbc-check-level: Level of checking that will be done for the JDBC connection. Values are 0 for • no checking, 1 to validate that the connection is not closed before returning it, and greater than 1 to send the jdbc-test-statement.
  • Page 291: Index

    Index CMP2.0 deployment descriptor, 95 EJB implementation class, 94 new features, 94 Symbols CMP2.0 persistence $JONAS_BASE using, 94 defaults to $JONAS_ROOT, 21 CMP2.0/JORM, 52 using, 278 CMR fields mapping to primary-key-fields 1-1 bidirectional relationships, 101, 111 1-1 unidirectional relationships, 99 EJB tasks, 211 1-N bidirectional relationships, 104 Apache...
  • Page 292 JAX-RPC, 219 Stateless Session Bean (SSB), 219 database access operations configuring for container-managed persistence, 91 Enterprise Bean writing, 89 performing JMS operations, 205 Database Service overview, 7 Enterprise Bean class dbm (Database Manager service), 26 of Entity Beans, 85 configuring, 31 configuring Oracle, 31 Enterprise Bean environment configuring other databases, 32...
  • Page 293 interoperability with CORBA, 265 J2EE Connector Architecture Service, 9 J2EE, 1 Java standard conformance, 3 J2EE applications key features, 3 deployment and installation, 151, 153 Mail Service, 10 J2EE clients Management Service, 10 launching, 171 Messaging Service, 8 J2EE Connector Architecture Service overview, 1 overview, 9 Registry, 5...
  • Page 294 security, 27 description, 119 configuring, 32 developing, 119 overview, 119 configuring, 28 WEB Container, 27 running, 122 WebServices, 27 transactional aspects, 124 configuring, 29 Message-Driven Bean pool JOnAS traces controlling output, 26 tuning, 126 jonas-web.xml, 221 Message-Driven Beans (MDB) jonas-webservices.xml, 221 administering, 121 jonas.properties configuration file, 22...
  • Page 295 Tomcat RAConfig (command), 68 configuring for a cluster, 238 registry (command), 65 trace.properties registry (service), 26 syntax, 25 configuring, 28 transaction context overview, 5 propagation, 24 resource (Resource Adapter service), 26 transactions configuring, 41 and JMS, 200 Resource Adapters configuring, 275, 281 deploying with JOnAS, 193 RMIC WAR packaging, 167...

This manual is also suitable for:

Application server

Table of Contents