![]() |
![]() |
|
|
Deploying EJBs with the WebLogic Enterprise EJB Deployer
This topic includes the following sections:
Introducing the WebLogic Enterprise EJB Deployer
This topic includes the following sections:
The WebLogic Enterprise-TM (WLE) WebLogic Enterprise EJB Deployer provides a graphical interface that Application Assemblers can use to deploy EJBs to one or more Java servers. The WebLogic Enterprise EJB Deployer simplifies the process of configuring EJB deployment properties and mapping EJB references to actual resource factories, roles and other EJBs available on a Java server.
The WebLogic Enterprise EJB Deployer provides many services related to EJB deployment. You can use it to:
For general information about deploying EJBs on WebLogic Enterprise, or for information on using hot deployment features, see "Developing WebLogic Enterprise EJB Applications" in Getting Started.
WebLogic Enterprise Deployment Files
When you modify deployment properties with the WebLogic Enterprise EJB Deployer, the utility updates and saves information in the XML deployment files, ensuring that the XML is correct for its associated Document Type Definition (DTD). The WebLogic Enterprise EJB Deployer can modify all properties in ejb-jar.xml. It can also create the weblogic-ejb-extensions.xml file if it is not available in the EJB JAR.
weblogic-ejb-extensions.xml contains properties that define the performance behavior of EJBs. It also contains properties that map available WebLogic Enterprise resources to EJBs. WebLogic Enterprise resources include security role names, data sources such as JDBC pools and JMS connection factories, other deployed EJBs, and container-managed persistence services available in the server.
Properties in weblogic-ejb-extensions.xml are linked to EJB names in ejb-jar.xml and resource names of EJBs running in the WebLogic Enterprise environment. If you want to edit the XML deployment files manually, outside of the WebLogic Enterprise EJB Deployer utility, see the WebLogic Enterprise EJB XML Reference.
Roles and Responsibilities
The WebLogic Enterprise EJB Deployer is designed primarily for:
To satisfy the requirements of these roles, the WebLogic Enterprise EJB Deployer provides complete controls for managing multiple EJB JAR files and Java servers, and for configuring WebLogic Enterprise deployment properties and resources. Roles are designated by two primary types of WebLogic Enterprise EJB Deployer projects: deployer projects and developer projects.
Deployer Projects
Deployer projects enable EJB deployers and application assemblers to configure EJB deployment properties and deploy EJB JAR files to Java servers. Using deployer, you can automatically create the required weblogic-ejb-extensions.xml file with valid deployment properties. Deployer projects enable you to work with EJB JAR files without knowing the details of the EJB code.
Developer Projects
Developer projects provide all the capabilities of a deployer project. Developer projects also enable you to modify EJB deployment properties that may require some knowledge of the EJB implementation code.
Note: Although a developer project enables you to configure some basic properties defined in the ejb-jar.xml deployment file, it is the responsibility of the Bean Provider to create this file and package it with the compiled EJB classes and interfaces. WebLogic Enterprise provides the DDConverter utility to generate an ejb-jar.xml file from an existing WebLogic Enterprise-compatible text descriptor.
Requirements
Requirements for using the WebLogic Enterprise EJB Deployer depend on whether you are a Deployer or Developer.
To use the WebLogic Enterprise EJB Deployer in the Deployer role, you must have:
To use the WebLogic Enterprise EJB Deployer in the Developer role, you must have:
An EJB module in the WebLogic Enterprise EJB Deployer consists of a Java Archive (EJB JAR) file. The EJB JAR file must contain all of the compiled classes for your EJB home interface, remote interface, and implementation class. It must also have a META-INF subdirectory that contains, at minimum, a valid ejb-jar.xml deployment file. The EJB JAR file may contain classes and deployment descriptors for one or more distinct EJBs.
Note: You do not need to include a MANIFEST file in the EJB JAR file, as was required with the Enterprise JavaBeans Specification 1.0.
Optionally, the EJB JAR file can contain the weblogic-ejb-extensions.xml file, which defines additional deployment properties for EJBs. If the EJB JAR does not contain this file, the WebLogic Enterprise EJB Deployer creates it as necessary during the deployment process.
Listing 1-1 shows the contents of a simple EJB JAR file that can be loaded into the WebLogic Enterprise EJB Deployer:
Listing 1-1 Sample EJB JAR File
$ jar tf ejb_basic_beanManaged.jar
META-INF/
META-INF/MANIFEST.MF
examples/ejb/basic/beanManaged/
examples/ejb/basic/beanManaged/Account.class
examples/ejb/basic/beanManaged/AccountBean.class
examples/ejb/basic/beanManaged/AccountHome.class
examples/ejb/basic/beanManaged/AccountPK.class
examples/ejb/basic/beanManaged/ProcessingErrorException.class
META-INF/ejb-jar.xml
META-INF/weblogic-ejb-extensions.xml
Note: Classes in the EJB JAR file must reside in directories that match their Java package hierarchy.
Java Servers
The WebLogic Enterprise EJB Deployer connects to one or more Java servers during the deployment process, enabling you to map references in the deployment description files to actual Java server resources, and to pass some information for the module to the Java server.
Getting Started
To begin using the WebLogic Enterprise EJB Deployer:
Starting the WebLogic Enterprise EJB Deployer
To start the WebLogic Enterprise EJB Deployer, enter the following command:
% java -ms24m -mx24m weblogic.EJBDeployWizard
The Java standard -ms24m and -mx24m parameters are optional.
The WebLogic Enterprise EJB Deployer loads and displays an empty program window, as shown in Figure 1-1.
Figure 1-1 WebLogic Enterprise EJB Deployer Program Window
The WebLogic Enterprise EJB Deployer program window is divided into the following main components:
The menu bar contains several menus to:
Icons in the toolbar provide quick access to selected WebLogic Enterprise EJB Deployer menu options. Hold your cursor over an individual icon to learn its function.
Object Panel
The Object panel provides a hierarchical view of the EJB JAR files, EJBs, and EJB properties you have opened. Clicking the plus (+) symbol next to an object expands the object, listing the nested objects or properties it contains. Clicking the hyphen (-) symbol collapses the object, hiding its nested properties.
Clicking directly on an object or property name displays its details and editable fields in the Properties panel, described below.
Top-level Categories
The top-level categories in the Object panel represent WebLogic Enterprise EJB Deployer Projects and Servers. WebLogic Enterprise EJB Deployer Projects can contain Deployer projects or Developer projects. Developer projects allow you to configure properties that require some knowledge of the EJB code. Deployer projects allow EJB deployers or application assemblers to deploy EJBs on Java servers without knowing the details of the EJB code.
The Servers category lists all Java servers to which the WebLogic Enterprise EJB Deployer can connect and deploy. See Setting Up Java Servers and WebLogic Enterprise EJB Deployer Preferences for information on configuring servers.
Properties Panel
The Properties panel displays detailed information about the selected EJB JAR, EJB, or EJB property, and allows you to edit certain property fields. The contents of the Properties panel differs depending on the object or property you have selected in the Object panel. For example, if you click an EJB JAR filename in the Object panel, the Properties panel shows display characteristics for the EJB JAR file. If you expand the EJB JAR file and select the Security object, the Properties panel displays the file's application role definitions.
Many, but not all, of the fields displayed in the Properties panel can be modified. To modify the contents of a field, you can either:
The sections that follow provide details about how to edit fields to perform EJB configuration tasks.
Message Panel
The Message panel displays informational and error messages as you perform tasks in the WebLogic Enterprise EJB Deployer. The Message panel has three separate displays, indicated by the tabs at the bottom of the panel: Messages, Problems, and Console.
Deployment property errors can occur because of undefined or incorrectly defined deployment values. The text of each error message indicates the field to enter or modify in order to correct the error. See Validating Deployment Properties for more information about addressing deployment errors.
Setting Up Java Servers and WebLogic Enterprise EJB Deployer Preferences
This topic includes the following sections:
Viewing Java Server Properties
The WebLogic Enterprise EJB Deployer enables you to connect and deploy to one or more Java servers. The WebLogic Enterprise EJB Deployer displays the properties of all running Java servers in the Servers category of the Object panel. The Java server properties are defined in the application's UBBCONFIG file. With the WebLogic Enterprise EJB Deployer, you can select a default server for deployment and you can deploy, redeploy, and undeploy to one or more Java servers, but you cannot change the properties. You must configure at least one new server to begin deploying EJBs. For more information about setting up Java servers, see "Creating a Configuration File" in the Administration Guide.
Note: The WebLogic Enterprise EJB Deployer provides access to running Java servers within a WebLogic Enterprise domain. The domain is defined in a UBBCONFIG file. You can change domains by changing the tuxconfig setting, as described in Changing Preferences for the WebLogic Enterprise EJB Deployer.
To view the properties of all running Java servers:
Figure 1-2 Java Server Properties
The WebLogic Enterprise EJB Deployer displays the following properties:
Changing Preferences for the WebLogic Enterprise EJB Deployer
You can optionally configure WebLogic Enterprise EJB Deployer and ejbc options to customize the behavior and appearance of the tool. You can modify the WebLogic Enterprise EJB Deployer preferences to specify the Java compiler that ejbc uses during compilation. The WebLogic Enterprise EJB Deployer preferences also affect the location of temporary files and the window size and location for the utility.
The WebLogic Enterprise EJB Deployer stores these settings in the deployer.properties file. You can use an ASCII text editor to change some of these settings. For more information, see WebLogic Enterprise EJB Deployer Properties File.
Changing WebLogic Enterprise EJB Deployer Preferences
To change WebLogic Enterprise EJB Deployer preferences:
Figure 1-3 WebLogic Enterprise EJB Deployer Properties Dialog Box
Changing Compiler Options
To change ejbc compiler options:
Figure 1-4 ejbc Properties
Working with EJB Modules
This topic includes the following sections:
The WebLogic Enterprise EJB Deployer can import multiple EJB JAR files for editing or deploying to servers.
Note: Before importing an EJB JAR file, make sure the file meets the requirements described in Java ARchive (EJB JAR) File.
To load an EJB JAR module:
Figure 1-5 New EJB Jar File
Viewing the Contents of an EJB JAR File
Once you have loaded an EJB JAR file, to view the file's contents, complete the following steps:
Figure 1-6 Class Files in an EJB JAR File
.:
Columns in the Files display show the name, date modified, size, and relative directory of class files and XML deployment files contained in the EJB JAR. You cannot edit the information stored in these columns.
Setting EJB JAR File Display Properties
Once you have loaded an EJB JAR file, to edit the file's display name or description within the WebLogic Enterprise EJB Deployer, complete the following steps:
Figure 1-7 Basic EJB JAR File Properties
Creating a New EJB JAR File
The WebLogic Enterprise EJB Deployer can help you create a new EJB JAR file from scratch, if you have not yet created one using the jar tool included in your JDK. To create a new EJB JAR file from scratch:
Figure 1-8 New Jar File Dialog Box
Configuring Basic EJB Properties
This topic includes the following sections:
The following sections explain how to change basic EJB class and method properties. The deployment properties described in this section are all part of the ejb-jar.xml file defined in the Enterprise JavaBeans Specification 1.1.
Setting EJB Class Properties
To view or change the basic home, remote, and EJB class information in an EJB module, complete the following steps:
Figure 1-9 Classes Tab
Note: Classes and interfaces in the EJB JAR file must reside in directories that match their Java package hierarchy.
Setting Method Transaction Attributes
To create or change the transaction attributes for EJB methods, complete the following steps:
If no method transactions are available, click the Add button to create a new tx-0 transaction attribute. The WebLogic Enterprise EJB Deployer highlights the new attribute collection in red to indicate that you have not yet assigned attributes to methods.
Figure 1-10 Transaction Attributes
Note: If the EJB provider does not specify a transaction attribute in the ejb-jar.xml file, WebLogic Enterprise uses Supports by default.
Assigning Method Permissions
The steps that follow describe how to limit access to individual EJB method calls by assigning method-level permissions.
Default Method Permissions in WebLogic Enterprise
You must specify method-level permissions for an EJB. If you specify no method-level permissions for an EJB (there is no method-permission stanza in ejb-jar.xml), all EJB methods in the EJB JAR file will not be accessible.
Note: You must specify method-level permissions for all methods in all EJBs stored in the EJB JAR file. WebLogic Enterprise denies access for any methods that do not have permissions defined in the EJB JAR file.
Changing Method Permissions
To change an EJB's method-level permissions:
If no method permissions are available, click the Add button to create a new perm-0 permission. The WebLogic Enterprise EJB Deployer highlights the new permission in red to indicate that you have not yet assigned an application role to the EJB methods.
Note: If you choose to specify method-level permissions, you must do so for all methods in all EJBs in the EJB JAR file. Otherwise, WebLogic Enterprise denies access for methods that have no assigned permissions.
Figure 1-11 Application Role Assignments
Adding, Removing, and Changing Environment Entries
To configure an EJB's environment entries or values, complete the following steps:
Figure 1-12 Environment Entries
Figure 1-13 Input New Environment Entry Dialog Box
Specify a new Name, Type, Value, and optional Description for the entry, and then click OK.
Configuring Deployment Properties
WebLogic Enterprise uses deployment properties defined in the weblogic-ejb-extensions.xml file to specify an EJB's performance properties. Use the following instructions to set or change any of these WebLogic Enterprise-specific properties.
Figure 1-14 Performance Optimizations
Mapping EJB References
This topic includes the following sections:
Mapping Application Roles to WebLogic Enterprise Principals
EJB providers can define application roles for EJBs in the ejb-jar.xml deployment file. Application roles (security groups) define required roles for EJBs, but they do not specify the actual security principal names in the running application server. Security roles are defined and administered (in the UBBCONFIG file) per domain. For more information about security roles, see "Configuring Authentication" in Using Security.
The WebLogic Enterprise EJB Deployer enables you to create EJB application roles and map them to actual security principal names during the deployment process.
To map principals to EJB application roles:
If the EJB JAR file does not contain any application roles, click Add and enter a name for the new role.
Figure 1-15 Application Roles and Principals
Mapping EJB References
To map EJB references to actual EJBs:
If the EJB JAR file does not contain any EJB references, click Add to create one.
Figure 1-16 EJB References
Mapping Resource Factory References
To map resource factory references:
If the EJB JAR file does not contain any EJB references, click Add and enter a name for the new reference.
Figure 1-17 Resource Factory References
Configuring Persistence Properties for EJBs
This topic includes the following sections:
You can use the WebLogic Enterprise EJB Deployer to configure persistence properties for entity beans and stateful session beans that use container-managed persistence. For container-managed persistence, the WebLogic Enterprise EJB container supports storing an EJB in either of the following formats:
Note: JDBC-based persistence is required for an entity bean to fully cooperate in a WebLogic Enterprise global transaction.
You can use the WebLogic Enterprise EJB Deployer to configure JDBC-based or file-based persistence properties for stateful session beans or entity beans. For more information about EJB persistence, see "Developing WebLogic Enterprise EJB Applications" in Getting Started.
Configuring Container-managed Fields
To view or modify the container-managed fields defined in your XML deployment files:
Figure 1-18 JDBC Persistence Properties
Note: For each field that you designate as Container-managed, define the mapping of the field to a database column using the instructions in Configuring JDBC-based Persistence for Entity Beans.
Configuring JDBC-based Persistence for Entity Beans
The WebLogic Enterprise EJB Deployer enables you to perform the following configuration tasks for entity beans that use JDBC-based persistence:
Specifying the Table and Connection for JDBC Operations
To specify table and connection properties for JDBC operations:
Figure 1-19 JDBC Persistence Configuration Properties
Mapping Container-managed Fields to Database Columns
To map individual EJB container-managed fields to columns in a selected datastore:
Figure 1-20 Field-column Mappings
Note: WebLogic Enterprise does not support using quoted RDBMS keywords in a column mapping. For example, you cannot map EJB fields to columns named "create" or "select" if those names are reserved in the underlying datastore.
Editing EJB Finder Method Expressions
To modify the finder signature expressions used in EJB finder methods:
Figure 1-21 Finder Methods
Figure 1-22 Edit Expression Dialog Box
The Edit Expression dialog box displays an editing window for changing the expression for the selected finder signature.
Syntax
The query grammar syntax has an expression prefix notation of:
[operator operand1 operand2]
Operators
Valid operators include:
Operands
Valid operands include:
Examples
The following examples show sample query expressions in finder methods.
The following expression determines whether balance exceeds amount:
"(> balance $amount)"
The following example shows the use of compound expressions. Note that single quotes are used to denote strings:
"(& (> bal $amount) (! (= accountType 'checking')))"
The following example is a method signature and an expression that is converted to a findBigAccounts method in the generated persistent storage class. The method returns an enumeration of beans of this class that satisfy this expression:
"findBigAccounts(double amount)" "(> balance $amount)"
The following example finds all the EJBs in a table:
"findAll()" "(= 1 1)"
The following example finds all EJBs whose lastName fields starts with M:
"findNamesStartingWithM()" "(like lastName M%)"
The following example finds all EJBs whose firstName field is null:
"findNullFirstNames()" "(isNull firstName)"
The following example finds all EJBs whose firstName field is not null:
"findNullFirstNames()" "(isNotNull firstName)"
The following expression finds all EJBs in which the value of the balance field exceeds balanceGreaterThan and returns the beans ordered by the id database column. Notice that this expression should all be contained in a single line and that no column mapping is performed. The database column must be specified directly:
"findOrderedAccounts(double balanceGreaterThan)"
"(orderBy 'id' (> balance $balanceGreaterThan))"
The following expression is identical to the previous one except that it returns the beans in descending order:
"findOrderedAccounts(double balanceGreaterThan)"
"(orderBy 'id desc' (> balance $balanceGreaterThan))"
Configuring File-based Persistence for Stateful Session Beans
To configure file-based persistence for a stateful session bean with container-managed persistence:
Figure 1-23 File-based Persistence Checkbox
Figure 1-24 File-based Persistence Properties
Validating Modules
This topic includes the following sections:
The WebLogic Enterprise EJB Deployer validates EJB modules in the following ways:
Validating Deployment Properties
When you load a new EJB JAR file or change deployment properties, the WebLogic Enterprise EJB Deployer automatically checks the properties to ensure that supplied values are valid and appropriate for the selected server. This includes:
If the WebLogic Enterprise EJB Deployer finds any errors in the deployment properties that would prevent you from deploying to the selected server, it lists those errors in the Problems display of the Message panel. The WebLogic Enterprise EJB Deployer also highlights in red the EJB JAR file, EJB, method, or property category that contains the error.
To address deployment property errors:
Checking for Compliance with the Enterprise JavaBeans Specification 1.1
The WebLogic Enterprise EJB Deployer provides a compliance checking option to check compiled EJB classes for compliance with the Enterprise JavaBeans Specification 1.1 published by Sun Microsystems, Inc. To check the contents of a module for compliance with the specification:
The WebLogic Enterprise EJB Deployer displays any noncompliance messages in the Message panel.
For more information about system messages, see the System Messages in the WebLogic Enterprise online documentation. If you need more information about how to address a noncompliance message, see the Enterprise JavaBeans Specification 1.1.
After addressing known compliance errors, recompile your classes, repackage the EJB JAR file, and use the WebLogic Enterprise EJB Deployer to repeat the compliance check.
Compiling and Deploying EJBs
This topic includes the following sections:
Compiling EJB Container Classes
For each EJB deployment present in an EJB JAR file, the WebLogic Enterprise EJB Deployer calls the ejbc compiler to generate container implementation classes. The implementation classes are then processed through the RMI compiler, which generates a client-side stub and a server-side skeleton.
When you use the WebLogic Enterprise EJB Deployer to generate container classes, the files are inserted back into the EJB JAR file. If you want to place the container classes into a different file, use ejbc from the command line, as described in Commands, Systems Processes, and MIB Reference.
By default, ejbc uses javac as a compiler. For faster performance, specify a different compiler (such as Symantec's sj) by setting up ejbc preferences within the WebLogic Enterprise EJB Deployer. See Setting Up Java Servers and WebLogic Enterprise EJB Deployer Preferences for more information.
To generate container classes for EJBs:
Deploying EJB JAR Files to Java Servers
You can deploy EJB JAR files to one or more running Java servers in accordance with the following requirements:
To deploy an EJB JAR file to a Java server:
The Enter Module Name dialog box appears, as shown in Figure 1-25.
Figure 1-25 Enter Module Name Dialog Box
Note: If you are redeploying an EJB JAR file to this server, you must specify a different module name.
Note: The WebLogic Enterprise EJB Deployer uses hot deployment, via the deploy command shell utility, to deploy Enterprise JavaBeans (EJBs). For more information, see "Developing WebLogic Enterprise EJB Applications" in Getting Started.
Undeploying EJB JAR Files
Undeploying an EJB JAR file removes it from a Java server on which it is deployed. To undeploy an EJB JAR file from a Java server:
Figure 1-26 Java Server Properties
WebLogic Enterprise EJB Deployer Properties File
This section includes the following topics:
The WebLogic Enterprise EJB Deployer stores its settings in the deployer.properties file. You can modify this file using the WebLogic Enterprise EJB Deployer, as described in Changing Preferences for the WebLogic Enterprise EJB Deployer. If you want, you can also modify many, but not all, properties using an ASCII text editor.
The WebLogic Enterprise EJB Deployer creates this file in the user's home directory. For example, on Unix, the home directory might be /home/loginName, where loginName is the user's login name. On Windows NT, this directory might be c:\winnt\profiles\loginName. If the file does not exist in the user's home directory, the WebLogic Enterprise EJB Deployer creates one with default settings automatically.
Properties Specified in the deployer.properties File
Table 1-1 describes the properties specified in the deployer.properties file.
Property |
Description |
---|---|
ejbc.compiler |
Path and executable name of the Java compiler. Default setting is /java/bin/javac.exe. |
ejbc.keepgenerated |
Specify true to keep generated intermediate Java files, or specify false to remove them. Default setting is true. |
environment.localclasspath |
Optional. Path and filename to one or more additional EJB JARs that are required to load. Default setting is no path. |
environment.tuxconfig |
Path and filename of the tuxconfig file. Default setting is /tuxconfig. |
layout.bounds |
Do not edit manually. Managed internally by the WebLogic Enterprise EJB Deployer. |
layout.horz-divider.location |
Do not edit manually. Managed internally by the WebLogic Enterprise EJB Deployer. |
layout.vert-divider.location |
Do not edit manually. Managed internally by the WebLogic Enterprise EJB Deployer. |
maxRecentProjects |
Maximum number of entries in the list of most recently used projects under the File menu. Default setting is 5. |
Sample deployer.properties File
Listing 1-2 shows a sample deployer.properties file.
Listing 1-2 Sample deployer.properties File
environment.localclasspath=e\:\\ij_51\\IcedJava\\jars\\QaDb.jar;e\:\\ij_51\\IcedJava\\jars\\qafunc.jar;e\:\\ij_51\\IcedJava\\jars\\qalib.jar
environment.tuxconfig=F\:/iceberg/samples/j2ee/ejb/basic/statefulSession/tuxconfig
ejbc.compiler=E\:/VisualCafe/Bin/SJ.exe
ejbc.keepgenerated=true
layout.bounds=0.21375,0.14166666666666666,0.5325,0.6725
layout.horz-divider.location=0.6071942446043166
layout.vert-divider.location=0.2872467222884386
maxRecentProjects=5
Note: Do not change the values of the layout.bounds, layout.horz-divider.location, or layout.vert-divider.location settings.
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|