web server - Borland Technical Publications
web server - Borland Technical Publications web server - Borland Technical Publications
Chapter 21 21Connecting to Resources with BES: Chapter using the Definitions Archive (DAR) Note J2EE specifies a uniform mechanism for establishing connections to resources using Java standard interfaces. A resource related object containing resource manager location details and connection attributes is bound under a JNDI service provider, and can be retrieved by your application as a resource connection factory in a JNDI lookup. Sample resource connection factories include JDBC datasources and JMS connection factories. Once a resource connection factory is obtained from JNDI, a connection to the desired resource manager can then be established. A connection to a relational database is obtained through a JDBC datasource, a connection to a message broker is obtained through a JMS connection factory, and general Enterprise Information Systems (EIS) connections are obtained through JCA resource adapters. Use the Borland Management Console and Borland Deployment Descriptor Editor (DDEditor) to create, edit, and deploy resource connection factories and other resource related JNDI objects, such as JMS destinations. An XML descriptor file (jndidefinitions.xml), generally called the JNDI Definitions module, captures the properties representing resource related objects. This file is packaged in a Data ARchive (DAR) module. In BES, a partition hosted Naming Service represents the default JNDI service provider - its an implementation of a CosNaming service provider. Resource related objects are bound in the Naming Service of a BES partition through deployment of DAR or RAR module using standard BES deployment procedures. At that time, only properties required to create an instance of a resource connection factory, or JMS destination, are stored in the JNDI bound object. During JNDI lookup for a resource related object, an instance of the desired resource object is created using the stored property values from the object retrieved. The newly created instance is then passed back to the caller of JNDI lookup() method. In this way, DARs can be successfully deployed to a BES partition without having to load classes for vendor specific resource objects. Class libraries for resource vendors are only required by application processes that actually perform JNDI lookup of resource related objects. In prior versions of BES, a file-system service provider called the Serial Provider was the default JNDI service provider for deployment of DARs and JNDI Definitions modules. Resource related objects bound to this provider involved creation of the resource objects during deployment, and hence required vendor class libraries to be deployed in advance. In addition, JNDI names for resource related objects required a Chapter 21: Connecting to Resources with BES: using the Definitions Archive (DAR) 191
JNDI Definitions Module Important serial URL prefix, that is “serial://”. With the Naming Service being the default service provider, this prefix is no longer required in JNDI name specification. Deployment of existing DARs/JNDI Definitions modules that have JNDI names with this prefix are now automatically bound to the Naming Service. A resource related object is obtained in J2EE through a resource reference. You can reference resource connection factories or JMS destinations from EJBs, servlets and other J2EE application components using resource-reference elements in the component's deployment descriptors. Refer to Chapter 22, “Using JDBC” for more specific information on how to define JDBC datasource resource references, and Chapter 23, “Using JMS” for resource reference definition examples of JMS connection factories and destinations. Each BES partition has a predeployed DAR module named default-resources.dar containing example definitions for JDBC datasources, JMS connection factories and JMS destinations. This module can be examined, updated and redeployed in the following steps: 1 Navigate to default-resources.dar under the Deployed Modules node of a partition in the left pane of the BES console. 2 Right-click on default-resources.dar and select Edit deployment descriptor from the context menu. The Borland Deployment Descriptor Editor window will open. The available datasources and connection factories should be visible in the left pane. 3 Right-click on the root node in the navigation pane of the Borland Deployment Descriptor Editor and select the appropriate option to create a New object you want to add. When a J2EE component attempts a JNDI lookup for a resource reference, vendor classes associated with the resource object must be available in the runtime environment. If the J2EE component is deployed to a BES partition, the vendor class libraries must be deployed to the partition as a library archive. Exceptions to this rule include JNDI lookups for resource objects whose dependent class libraries are bundled with BES. For example, a JDataStore datasource or any JMS resource object of the JMS message server installed with BES. For documentation updates, go to www.borland.com/techpubs/bes. JNDI Definitions Module Note Resource related objects are bound under the Naming Service through deployment of a DAR file containing the JNDI Definitions Module. A DAR has a special .dar file extension. It must be deployed to a BES partition either individually or packaged with other J2EE modules in an EAR file. A DAR is not a part of the J2EE specification. It is a Borland-specific implementation designed to simplify deployment and management of resource connection factories and JMS destinations. You do not package connection factory or JMS destination vendor classes in this archive type. Those classes must be deployed as a library to individual Partitions. The only contents of the DAR that you must provide is an XML descriptor file called jndi-definitions.xml. It contains definitions for resource related objects, each with a JNDI name identifying its location in JNDI. Like other descriptors, this is placed within the META-INF directory of the DAR. The contents of the DAR hence is as follows: META-INF/jndi-definitions.xml 192 BES Developer’s Guide
- Page 151 and 152: Container-Managed Persistence in Bo
- Page 153 and 154: 142 BES Developer’s Guide
- Page 155 and 156: Setting Properties J2EE 1.3 Entity
- Page 157 and 158: Setting Properties Figure 16.2 Edit
- Page 159 and 160: Setting Properties Table 16.1 ejb.m
- Page 161 and 162: Setting Properties Table 16.3 Table
- Page 163 and 164: Setting Properties Security Propert
- Page 165 and 166: Aggregate Functions in EJB-QL Selec
- Page 167 and 168: Support for ORDER BY Support for OR
- Page 169 and 170: Overriding SQL generated from EJB-Q
- Page 171 and 172: Container-managed data access suppo
- Page 173 and 174: 162 BES Developer’s Guide
- Page 175 and 176: Generating primary keys from a cust
- Page 177 and 178: Implementing primary key generation
- Page 179 and 180: Transaction manager services Consis
- Page 181 and 182: Transaction manager services When t
- Page 183 and 184: Transaction manager services Follow
- Page 185 and 186: Declarative transaction management
- Page 187 and 188: Declarative transaction management
- Page 189 and 190: JDBC API Modifications JDBC API Mod
- Page 191 and 192: Handling of EJB exceptions Applicat
- Page 193 and 194: 182 BES Developer’s Guide
- Page 195 and 196: Client View of an MDB Client View o
- Page 197 and 198: Clustering of MDBs This is yet anot
- Page 199 and 200: Error Recovery Redelivered messages
- Page 201: 190 BES Developer’s Guide
- Page 205 and 206: Disabling and Enabling a Deployed D
- Page 207 and 208: Configuring JDBC Datasources In the
- Page 209 and 210: Configuring JDBC Datasources To add
- Page 211 and 212: Defining the Connection Pool Proper
- Page 213 and 214: Defining the Connection Pool Proper
- Page 215 and 216: Descriptions of Borland Enterprise
- Page 217 and 218: Advanced Topics for Defining JDBC D
- Page 219 and 220: Connecting to JDBC Resources from J
- Page 221 and 222: Configuring JMS Connection Factorie
- Page 223 and 224: Defining Connection Pool Properties
- Page 225 and 226: Obtaining JMS Connection Factories
- Page 227 and 228: JMS and Transactions and its accomp
- Page 229 and 230: JMS and Transactions For instance:
- Page 231 and 232: 220 BES Developer’s Guide
- Page 233 and 234: Configuring JMS administered object
- Page 235 and 236: Tibco Creating Clustered JMS Servic
- Page 237 and 238: Sonic serverUrl String localhost:72
- Page 239 and 240: Sonic Creating Clustered JMS Servic
- Page 241 and 242: OpenJMS Even though OpenJMS can be
- Page 243 and 244: OpenJMS Important If you use OpenJM
- Page 245 and 246: OpenJMS openjms.clean_messages_on_s
- Page 247 and 248: OpenJMS Table 24.1 Property Name De
- Page 249 and 250: Other JMS providers The following a
- Page 251 and 252: 240 BES Developer’s Guide
JNDI Definitions Module<br />
Important<br />
serial URL prefix, that is “serial://”. With the Naming Service being the default service<br />
provider, this prefix is no longer required in JNDI name specification. Deployment of<br />
existing DARs/JNDI Definitions modules that have JNDI names with this prefix are now<br />
automatically bound to the Naming Service.<br />
A resource related object is obtained in J2EE through a resource reference. You can<br />
reference resource connection factories or JMS destinations from EJBs, servlets and<br />
other J2EE application components using resource-reference elements in the<br />
component's deployment descriptors. Refer to Chapter 22, “Using JDBC” for more<br />
specific information on how to define JDBC datasource resource references, and<br />
Chapter 23, “Using JMS” for resource reference definition examples of JMS connection<br />
factories and destinations.<br />
Each BES partition has a predeployed DAR module named default-resources.dar<br />
containing example definitions for JDBC datasources, JMS connection factories and<br />
JMS destinations. This module can be examined, updated and redeployed in the<br />
following steps:<br />
1 Navigate to default-resources.dar under the Deployed Modules node of a partition<br />
in the left pane of the BES console.<br />
2 Right-click on default-resources.dar and select Edit deployment descriptor from<br />
the context menu. The <strong>Borland</strong> Deployment Descriptor Editor window will open. The<br />
available datasources and connection factories should be visible in the left pane.<br />
3 Right-click on the root node in the navigation pane of the <strong>Borland</strong> Deployment<br />
Descriptor Editor and select the appropriate option to create a New object you want<br />
to add.<br />
When a J2EE component attempts a JNDI lookup for a resource reference, vendor<br />
classes associated with the resource object must be available in the runtime<br />
environment. If the J2EE component is deployed to a BES partition, the vendor class<br />
libraries must be deployed to the partition as a library archive. Exceptions to this rule<br />
include JNDI lookups for resource objects whose dependent class libraries are bundled<br />
with BES. For example, a JDataStore datasource or any JMS resource object of the<br />
JMS message <strong>server</strong> installed with BES.<br />
For documentation updates, go to www.borland.com/techpubs/bes.<br />
JNDI Definitions Module<br />
Note<br />
Resource related objects are bound under the Naming Service through deployment of<br />
a DAR file containing the JNDI Definitions Module. A DAR has a special .dar file<br />
extension. It must be deployed to a BES partition either individually or packaged with<br />
other J2EE modules in an EAR file.<br />
A DAR is not a part of the J2EE specification. It is a <strong>Borland</strong>-specific implementation<br />
designed to simplify deployment and management of resource connection factories<br />
and JMS destinations. You do not package connection factory or JMS destination<br />
vendor classes in this archive type. Those classes must be deployed as a library to<br />
individual Partitions.<br />
The only contents of the DAR that you must provide is an XML descriptor file called<br />
jndi-definitions.xml. It contains definitions for resource related objects, each with a<br />
JNDI name identifying its location in JNDI. Like other descriptors, this is placed within<br />
the META-INF directory of the DAR. The contents of the DAR hence is as follows:<br />
META-INF/jndi-definitions.xml<br />
192 BES Developer’s Guide