Utility Tools
CHAPTER 14
This chapter helps you target your application at an appropriate version of J2EE (Java 2 Platform, Enterprise Edition). It is especially useful if you need to know when and how to migrate existing projects to a newer J2EE version. Topics include:
For an overview of J2EE, see the Sun J2EE Web site.
Choices you make about J2EE versions are largely determined by the J2EE server(s) you deploy to. To begin, find out whether your J2EE server is compatible with J2EE 1.2 or 1.3. Then read the following topics to learn what that means for your application and how you handle it in the Novell exteNd Director development environment:
If you develop applications for deployment to J2EE 1.2 servers, you can use J2EE 1.2 archives and J2EE 1.2 technologies. But J2EE 1.2 servers do not support J2EE 1.3 archives and J2EE 1.3 technologies.
J2EE 1.2 archives The J2EE 1.2 archives are:
J2EE 1.2 technologies The J2EE 1.2 technologies include:
If you develop applications for deployment to J2EE 1.3 servers, you can use either of the following:
In other words, J2EE 1.3 servers support J2EE 1.2 applications as well as J2EE 1.3 applications. For further flexibility, you also have the option of mixing J2EE 1.2 modules and features into your J2EE 1.3 applications as follows:
These J2EE 1.3 archives |
Can contain |
---|---|
EARs |
Both J2EE 1.2 modules (WARs, EJB JARs, client JARs) and J2EE 1.3 modules |
EJB JARs |
Entity beans that use either 1.x or 2.x container-managed persistence (CMP) |
J2EE 1.3 archives The J2EE 1.3 archives are:
J2EE 1.3 technologies The J2EE 1.3 technologies include:
The following technologies previously included with J2EE are now included with the Java 2 Platform, Standard Edition (J2SE): JNDI, RMI-IIOP.
The exteNd Director development environment provides built-in support for multiple versions of J2EE, including 1.2 and 1.3. It helps you handle version-related tasks throughout the life cycle of a project, including development, migration, and deployment:
Task |
What you can do |
---|---|
Development |
You can use the development environment to develop projects for any of the following:
|
Migration |
You can use the development environment to migrate existing projects to a newer J2EE version. Scenarios include: |
Deployment |
You can deploy projects to J2EE servers by using the development environment (or, if necessary, vendor deployment tools). Scenarios include:
|
This section examines specific kinds of projects and offers advice about making J2EE version choices for them. It covers:
Use the following table to find the project scenarios that apply to you and learn how you can handle them in the exteNd Director development environment:
If you have this |
You can |
---|---|
Source files for a J2EE 1.2 module or application (but no project) |
Create one or more J2EE 1.2 projects for the source files, specifying appropriate project types and versions. Possible choices are: |
Source files for a J2EE 1.3 module or application (but no project) |
Create one or more J2EE 1.3 projects for the source files, specifying appropriate project types and versions. Possible choices are: |
Packaged J2EE 1.2 archive (but no source files or project) |
Create a J2EE 1.2 deploy-only project for the archive, specifying an appropriate project type and version. Possible choices are: |
Packaged J2EE 1.3 archive (but no source files or project) |
Create a J2EE 1.3 deploy-only project for the archive, specifying an appropriate project type and version. Possible choices are: |
J2EE 1.2 enterprise archive project (EAR 1.2) |
Do any of the following: |
J2EE 1.3 enterprise archive project (EAR 1.3) |
Do any of the following: |
J2EE 1.2 project for any module: |
Do any of the following: |
J2EE 1.3 project for any module: |
Do any of the following: |
J2EE 1.2 deploy-only project (EAR 1.2, WAR 2.2, EJB 1.1, or CAR 1.2) |
Do any of the following: |
J2EE 1.3 deploy-only project (EAR 1.3, WAR 2.3, RAR 1.0, EJB 2.0, or CAR 1.3) |
Do either of the following: |
When you start work on a new application or module, a good rule of thumb is to use the latest J2EE version and technologies supported by your target J2EE server(s). This typically provides a more mature platform, including:
J2EE improvements such as additional features, architecture enhancements, and other updates
Server improvements that accompany the newer J2EE implementation, such as faster deployment, better runtime performance, and easier maintenance
For example, if your deployment target is a J2EE 1.3 server, you should develop J2EE 1.3 archives for it (even though 1.2 archives are also supported). Within your archives, it's also recommended that you code to the latest standards available. If you develop EJB entity beans with container-managed persistence, that means using 2.x CMP instead of 1.x CMP.
Use the following table to decide when to migrate an existing J2EE archive project to a newer J2EE version:
For example, suppose you have a J2EE 1.2 WAR project and want to add servlet filters to it. In that case, you must first migrate this project to J2EE 1.3 (in other words, from WAR 2.2 to WAR 2.3).
Because the exteNd Director development environment supports multiple versions of J2EE, it offers you a choice of versions when you create parts of an application. This applies:
When you create a generic J2EE project, you can specify the J2EE version (1.2 or 1.3) of the archive that the project represents. The default is J2EE 1.3.
For example, suppose you need a new Web archive project. To create it, you select File>New>Project and choose WAR (on the Generic tab) as the project type. Then the New Project Wizard prompts for details about the project, including its J2EE version:
When you create other types of generic J2EE archive projects (EAR, RAR, EJB, CAR), the New Project Wizard adjusts the list of J2EE version choices accordingly. For deploy-only projects, you specify project type and J2EE version at the same time by choosing from a combined list:
How your J2EE version choice affects a project When a project is created, your J2EE version choice is reflected in several places:
In this part of the project |
Your J2EE version choice affects |
---|---|
Project (SPF) file |
The following project settings:
|
Deployment descriptor |
Which version of the appropriate J2EE deployment descriptor is created for the project. Depending on the project's J2EE version, you get a 1.2 or 1.3 deployment descriptor for your project type: EAR, WAR, RAR, EJB, or CAR. You can examine the DOCTYPE statement of the deployment descriptor to determine which DTD it follows.
(Note that deployment descriptors are not created for deploy-only projects because their archive contents are static.) |
Deployment plan (for exteNd Application Server 4.x or 5.x) |
Which version of the appropriate exteNd deployment plan you get by default if you create one for the project.
|
You can use the Tag Handler Wizard to develop a new or existing JSP tag library. If you ask to create a new tag library, the wizard requires you to specify which JSP version (1.1 or 1.2) to support in it.
To start the Tag Handler Wizard, you select File>New>File and choose Tag handler. It then prompts for several panels of information, including details about the tag library descriptor (TLD) file. The JSP version is one of those details (for a new TLD file):
Your JSP version choice is recorded in the TLD file via the jsp-version element. This choice also determines which DTD is used for the TLD file:
JSP version |
TLD DTD |
---|---|
1.1 |
web-jsptaglibrary_1_1.dtd |
1.2 |
web-jsptaglibrary_1_2.dtd |
WAR 2.3 projects support both JSP 1.1 and 1.2 tag libraries (although JSP 1.2 is recommended). WAR 2.2 projects support only JSP 1.1 tag libraries.
You can use the EJB Wizard to add various kinds of Enterprise JavaBeans to an EJB project. That includes entity beans using container-managed persistence, with a choice of 1.x or 2.x CMP.
To start the EJB Wizard, you select File>New>File and choose EJB as the component to create. It then prompts for the kind of EJB you want:
For an EJB 2.0 project, you can choose either version of CMP entity bean (although 2.x CMP is recommended). Your CMP version choice is recorded in the project's deployment descriptor via the cmp-version element.
EJB 1.1 projects support only 1.x CMP.
The exteNd Director development environment provides an Update Project Version command that you can select to migrate an existing J2EE 1.2 project to 1.3. For most kinds of projects, this command does the entire migration for you. In a few cases, it will notify you about additional migration tasks that you need to perform manually. The development environment also provides a command for when you just want to update an exteNd deployment plan from J2EE 1.2 to 1.3.
If you have one or more projects to migrate, read the following topics:
This section describes the steps to follow once you've decided to migrate a project. For background information on when and what to migrate, see these earlier sections:
In the development environment, open a J2EE archive project (EAR, WAR, EJB, or CAR) that you want to migrate.
On the Project tab of the Navigation Pane, right-click the project (SPF) file to display the popup menu.
Select Update Project Version.
First, the update utility checks the J2EE version of your selected SPF file. If it is already set to J2EE 1.3, the update utility notifies you, asking if you want to proceed. Migrating such a project can make sense if it includes J2EE 1.2 items (deployment descriptors, deployment plans, or subprojects) that you want to update to 1.3. The update utility will migrate just those items that need it.
Once past the SPF check, the update utility prompts you for confirmation before migrating the project. Files that are modified during the migration will be backed up first only if you have enabled backup in your development environment preferences.
For information about enabling backup, see Backup preferences.
Click Yes to start the migration.
The update utility migrates the project from J2EE 1.2 to 1.3, then displays status information about:
This status information appears on the Output tab of the Output Pane. For example:
If you migrate an EAR project, the update utility automatically migrates the J2EE archive subprojects (WARs, EJBs, and CARs) that the EAR contains as well. The update utility includes details about these migrations in the status information it displays:
How migration affects a project When a project is migrated, the update utility makes changes in several places to reflect the new J2EE version:
In this part of the project |
Migration affects |
---|---|
Project (SPF) file |
The following project settings:
|
Deployment descriptor |
The following descriptor items:
(Note that deployment descriptors are not updated for deploy-only projects because their archive contents are static.) |
Deployment plan, if present (for exteNd Application Server) |
The following plan items:
|
In addition to the Update Project Version command, the exteNd Director development environment provides an Update Deployment Plan Version command on the popup menu for a J2EE project (SPF file). Update Deployment Plan Version works just like Update Project Version except that it only updates the project's exteNd deployment plan.
Update Deployment Plan Version is useful when you want to deploy J2EE 1.2 projects (including deploy-only projects) to Novell exteNd Application Server 5.x, which requires 1.3 deployment plans. When you invoke this command, it migrates the deployment plans of those projects from 1.2 to 1.3 format, but leaves other project characteristics unchanged.
When you use the Update Project Version command or the Update Deployment Plan Version command to migrate certain kinds of projects, the update utility may not be able to resolve all issues automatically. In that case, it displays information about changes you need to make to the project yourself.
The need for manual migration typically occurs with EJB and EAR projects containing CMP entity beans. While updating exteNd deployment plans for such projects, the update utility does not handle some items, including:
You should edit the updated deployment plan to specify these items and check for any other changes that may be needed.
This section presents J2EE version issues specific to the exteNd Application Server (specifically, Novell exteNd Application Server 5.x and SilverStream eXtend Application Server 4.x). It includes some details on the server's implementation of J2EE 1.2 and 1.3 that may help you make decisions about deploying and migrating projects:
The 4.x and 5.x servers are compatible with J2EE 1.3. To implement this support, they provide J2EE 1.3 versions of the Web, client, and EJB containers:
The Web and client containers for J2EE 1.3 are used when you deploy J2EE 1.3 projects (WAR 2.3, CAR 1.3) as well as J2EE 1.2 projects (WAR 2.2, CAR 1.2).
The EJB container for J2EE 1.3 is used when you deploy J2EE 1.3 projects (EJB 2.0) and, in normal cases, when you deploy J2EE 1.2 projects (EJB 1.1).
Because of container implementation changes introduced to support EJB 2.0, some EJB 1.1 deployments can't use the J2EE 1.3 version of the EJB container. For these scenarios, the 4.x server also provides a J2EE 1.2 version of this container. In the 5.x server, that older EJB container is no longer provided, so you'll need to adjust such projects before deploying.
The following table summarizes the possible project deployment scenarios and shows which version of the appropriate container is used in each case:
Project |
Deployment plan |
Container |
---|---|---|
WAR 2.2 |
WAR 2.2 (4.x server only) |
J2EE 1.3 Web container |
WAR 2.2 |
WAR 2.3 |
J2EE 1.3 Web container |
WAR 2.3 |
WAR 2.3 |
J2EE 1.3 Web container |
CAR 1.2 |
CAR 1.2 (4.x server only) |
J2EE 1.3 client container |
CAR 1.2 |
CAR 1.3 |
J2EE 1.3 client container |
CAR 1.3 |
CAR 1.3 |
J2EE 1.3 client container |
EJB 1.1 |
EJB 1.1 (4.x server only) |
J2EE 1.2 EJB container |
EJB 1.1 |
EJB 2.0 (for limitations, see EJB deployment notes) |
J2EE 1.3 EJB container |
EJB 2.0 |
EJB 2.0 (for limitations, see EJB deployment notes) |
J2EE 1.3 EJB container |
EAR 1.2 |
EAR 1.2 (4.x server only) |
J2EE 1.3 Web container J2EE 1.3 client container J2EE 1.2 EJB container |
EAR 1.2 |
EAR 1.3 (for limitations, see EJB deployment notes) |
J2EE 1.3 Web container J2EE 1.3 client container J2EE 1.3 EJB container |
EAR 1.3 |
EAR 1.3 (for limitations, see EJB deployment notes) |
J2EE 1.3 Web container J2EE 1.3 client container J2EE 1.3 EJB container |
RAR 1.0 |
RAR 1.0 |
J2EE 1.3 containers |
In some situations, you may want (or need) to deploy an EJB 1.1 project to the J2EE 1.3 EJB container. One reason is that this lets you take advantage of performance improvements and other implementation enhancements introduced with the newer container version.
For EJB 1.1 projects containing session beans or BMP entity beans, you just need to create an EJB 2.0 deployment plan or include the project in a J2EE 1.3 EAR deployment. No other modifications to the project are required. This simple approach is not possible for EJB 1.1 projects that contain CMP entity beans and use SilverStream extensions to specify CMP details (such as expressions, foreign bean mappings, and complex fields). These extensions are supported by the EJB 1.1 deployment plan, but not the 2.0 plan.
There are also some limitations to note for EJB 2.0 projects containing CMP entity beans. In such projects, beans with 1.x CMP can't use elements specific to EJB 2.0 (such as abstract schema names, local interfaces, and queries). In addition, these beans can't use SilverStream extensions to specify CMP details (because, as mentioned above, the EJB 2.0 deployment plan doesn't support them).
Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved. more ...