Migrating from WebSphere Application Server

Migrating from WebSphere Application Server
Front cover
Migrating from WebSphere
Application Server Community
Edition to WebSphere
Application Server
Includes migration strategies to help make
applications more portable and adaptable
Provides step-by-step migration
examples for J2EE applications
Discusses migration issues that we
encountered in our development
Rufus Credle
Deepika Aman
Manu T George
Vamsavardhana Reddy Chillakuru
ibm.com/redbooks
International Technical Support Organization
Migrating from WebSphere Application Server
Community Edition to WebSphere Application
Server
August 2007
SG24-7433-00
Note: Before using this information and the product it supports, read the information in
“Notices” on page ix.
First Edition (August 2007)
This edition applies to WebSphere Application Server V6.1 - Base, WebSphere Application
Server Community Edition V1.1.0.1, and WebSphere Application Server V6.1 - Network
Deployment.
© Copyright International Business Machines Corporation 2007. All rights reserved.
Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP
Schedule Contract with IBM Corp.
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
The team that wrote this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Chapter 1. Introduction to this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Our objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Scope of this book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Applications that we cover in this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 What this book does not include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 How to use this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 2. IBM WebSphere overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 About WebSphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 IBM WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 Supported platforms and software . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 IBM WebSphere Application Server Community Edition. . . . . . . . . . . . . . 10
2.3.1 Features and benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Development and deployment tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4.1 IBM Rational Application Developer V7.0 . . . . . . . . . . . . . . . . . . . . . 14
2.4.2 Application Server Toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 3. Migration strategy and planning . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1 Migration strategy considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.1 Getting help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.2 Migrating the different environments . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.1.3 Strategies to handle migration complexity . . . . . . . . . . . . . . . . . . . . 22
3.2 Application servers interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3 Migration planning activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.3.1 Gathering concerned parties together. . . . . . . . . . . . . . . . . . . . . . . . 31
3.3.2 Evaluating current assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.3.3 Assessing the high-level application architecture . . . . . . . . . . . . . . . 33
3.3.4 Reviewing and validating the application code . . . . . . . . . . . . . . . . . 33
3.3.5 Reviewing the development environment . . . . . . . . . . . . . . . . . . . . . 35
3.3.6 Reviewing the runtime environment . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.3.7 Reviewing the current build and deployment processes . . . . . . . . . . 36
© Copyright IBM Corp. 2007. All rights reserved.
iii
3.3.8 Assessing current skills. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3.9 Reviewing time constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3.10 Creating a detailed migration plan . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.4 Migration alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.4.1 Alternative 1: Developing the migration using Application Server Toolkit
37
3.4.2 Alternative 2: Developing the migration using Rational Application
Developer V7.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.5 Migrating the site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.5.1 Switchover migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.5.2 Coexistence migration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.5.3 Offline migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.5.4 Database migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.6 Testing the migrated site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.7 Going live . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Chapter 4. Installing and configuring the products for the migration . . . 45
4.1 Hardware and software installed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.2 Installing WebSphere Application Server V6.1 . . . . . . . . . . . . . . . . . . . . . 47
4.2.1 Installing the latest fix pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2.2 Understanding WebSphere profiles . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.2.3 Launching the WebSphere Administrative Console . . . . . . . . . . . . . 60
4.2.4 Managing the application servers . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.3 Installing Rational Application Developer V7.0 . . . . . . . . . . . . . . . . . . . . . 64
4.3.1 Installing any interim fixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.3.2 Testing the application server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.3.3 Using Universal Test Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.4 Administrative scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.4.1 Examples of administrative scripting features . . . . . . . . . . . . . . . . . . 85
4.5 Installing DB2 Universal Database Express Edition V8.2 . . . . . . . . . . . . . 87
4.6 Installing WebSphere Application Server Toolkit V6.1 . . . . . . . . . . . . . . . 97
4.7 Installing WebSphere Application Server Community Edition . . . . . . . . . 101
4.8 Downloading and launching Eclipse Web Tools Platform V1.5.2 . . . . . . 107
4.9 Downloading XDoclet 1.2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.10 Downloading WebSphere Application Server
Community Edition Eclipse Plugin 1.1.0.1 . . . . . . . . . . . . . . . . . . . . . . . 108
4.11 Installing Java Web Services Developer Pack 2.0 . . . . . . . . . . . . . . . . 109
4.11.1 Installing Sun JRE 1.5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.11.2 Installing Java Web Services Developer Pack 2.0 . . . . . . . . . . . . 111
iv
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4.12 Downloading Apache Ant 1.7.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
4.13 Installation directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Chapter 5. Common migration issues. . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.1 J2EE application server compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.1.1 Using vendor-specific features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.1.2 Class loader related issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.1.3 Deployment Descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5.2 Application portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.2.1 Application packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.2.2 Use of native code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5.2.3 Database-related issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5.2.4 Java Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
5.2.5 Java Naming and Directory Interface . . . . . . . . . . . . . . . . . . . . . . . 139
5.2.6 J2EE application clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.3 J2EE 1.4 migration considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.3.1 Enterprise Java Beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.3.2 Java Server Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.3.3 Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Chapter 6. Migrating WebSphere Application Server CE to WebSphere
Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.1 Introduction to this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.2 Prerequisites and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.3 Migrating the Plants by WebSphere sample application . . . . . . . . . . . . . 147
6.3.1 Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
6.3.2 Enterprise beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.3.3 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.3.4 Installing the application in its source environment . . . . . . . . . . . . . 153
6.3.5 Configuring the target environment . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.3.6 Migrating the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Chapter 7. Developing the application on WebSphere Application Server
Community Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
7.1 Introduction to this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
7.2 Prerequisites and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
7.3 Developing Adventure Builder on WebSphere Application Server Community
Edition V1.1.0.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
7.3.1 About the Adventure Builder application . . . . . . . . . . . . . . . . . . . . . 223
7.3.2 Creating users for database access . . . . . . . . . . . . . . . . . . . . . . . . 224
7.3.3 Database, data sources, and JMS resources . . . . . . . . . . . . . . . . . 224
7.3.4 Building the Adventure Builder application from source . . . . . . . . . 245
7.3.5 Configuring the workspace for Eclipse . . . . . . . . . . . . . . . . . . . . . . 246
7.3.6 Developing the LodgingSupplier EJB application . . . . . . . . . . . . . . 255
Contents
v
7.3.7 Developing the ConsumerWebsite application . . . . . . . . . . . . . . . . 293
7.3.8 Creating a servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
7.4 Deploying the application on WebSphere Application Server Community
Edition V1.1.0.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Chapter 8. Migrating Adventure Builder
to WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . 347
8.1 The sample application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
8.2 Overview of the migration process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
8.2.1 Installing the prerequisite software . . . . . . . . . . . . . . . . . . . . . . . . . 348
8.2.2 Importing applications with EJB modules into IDE . . . . . . . . . . . . . 349
8.2.3 Creating Web services for all modules . . . . . . . . . . . . . . . . . . . . . . 383
8.2.4 Fixing the Service References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
8.2.5 Fixing the environment variables entries. . . . . . . . . . . . . . . . . . . . . 399
8.2.6 Fixing the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
8.2.7 Preparing to deploy and export EAR files . . . . . . . . . . . . . . . . . . . . 409
8.2.8 Exporting DDL files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
8.2.9 Importing the ConsumerWebsite application that includes the Web
module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
8.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Chapter 9. Deploying Adventure Builder on WebSphere
Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
9.1 Configuring the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
9.1.1 Creating users. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
9.1.2 Creating the sample application database . . . . . . . . . . . . . . . . . . . 424
9.2 Configuring WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . 425
9.2.1 Configuring JDBC resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
9.2.2 Configuring the JMS resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
9.2.3 Configuring Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
9.3 Installing the applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
9.4 Testing the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Appendix A. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Getting the Plants by WebSphere application . . . . . . . . . . . . . . . . . . . . . . . . 494
How to use the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
vi
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
How to get IBM Redbooks publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Contents
vii
viii
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Notices
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area.
Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product, program, or service that
does not infringe any IBM intellectual property right may be used instead. However, it is the user's
responsibility to evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document.
The furnishing of this document does not give you any license to these patents. You can send license
inquiries, in writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive, Armonk, NY 10504-1785 U.S.A.
The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION
PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer
of express or implied warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made
to the information herein; these changes will be incorporated in new editions of the publication. IBM may
make improvements and/or changes in the product(s) and/or the program(s) described in this publication at
any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in any
manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the
materials for this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm
the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on
the capabilities of non-IBM products should be addressed to the suppliers of those products.
This information contains examples of data and reports used in daily business operations. To illustrate them
as completely as possible, the examples include the names of individuals, companies, brands, and products.
All of these names are fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in
any form without payment to IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating platform for which the
sample programs are written. These examples have not been thoroughly tested under all conditions. IBM,
therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.
© Copyright IBM Corp. 2007. All rights reserved.
ix
Trademarks
The following terms are trademarks of the International Business Machines Corporation in the United States,
other countries, or both:
Redbooks (logo)
®
developerWorks®
e-business on demand®
iSeries®
i5/OS®
z/OS®
AIX®
BladeCenter®
ClearCase®
Cloudscape™
DataPower®
DB2 Universal Database™
DB2®
Informix®
IBM®
OS/390®
OS/400®
Rational Unified Process®
Rational®
Redbooks®
RequisitePro®
Resource Link™
System i™
System x™
WebSphere®
The following terms are trademarks of other companies:
Oracle, JD Edwards, PeopleSoft, Siebel, and TopLink are registered trademarks of Oracle Corporation
and/or its affiliates.
Enterprise JavaBeans, EJB, Java, Java DataBase Connectivity, Java Naming and Directory Interface,
JavaBeans, JavaMail, JavaServer, JavaServer Pages, JDBC, JDK, JMX, JNI, JRE, JSP, JVM, J2EE, J2SE,
Solaris, and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other
countries, or both.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other
countries, or both.
Internet Explorer, Microsoft, SQL Server, Windows, and the Windows logo are trademarks of Microsoft
Corporation in the United States, other countries, or both.
Intel, Xeon, Intel logo, Intel Inside logo, and Intel Centrino logo are trademarks or registered trademarks of
Intel Corporation or its subsidiaries in the United States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Linux is a trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, or service names may be trademarks or service marks of others.
x
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Preface
This IBM® Redbook publication can help you plan and perform the migration of
your J2EE™ applications that are developed for IBM WebSphere Application
Server Community Edition V1.1.0.1, enabling them to run on IBM WebSphere
Application Server V6.1 - Network Deployment. It includes migration strategy
considerations for developing portable applications as well as working migration
examples. This book discusses some of the most common migration issues that
you might encounter when migrating from Java™ 2 Platform Enterprise Edition
(J2EE) platforms to WebSphere Application Server V6.1.
In this book, we use two sample applications to demonstrate how to migrate your
J2EE applications. We migrate each application using a different approach and
different development tools. In one migration, we use Rational Application
Developer V7.0 and, in the other, we use the Application Server Toolkit, which
comes with WebSphere Application Server V6.1 - Base. We also describe
step-by-step how we built and configured our environment for these migration
examples.
The audience for this book includes administrators and developers that seek a
process and instructions for migrating from WebSphere® Application Server
Community Edition to the WebSphere Application Server Basic and Network
Deployment editions.
The team that wrote this book
This book was produced by a team of specialists from around the world working
at the International Technical Support Organization (ITSO), Raleigh Center.
Rufus Credle is a Certified Consulting IT Specialist at the ITSO, Raleigh Center.
In his role as a project leader, he conducts residencies and develops IBM
Redbooks® about network operating systems, ERP solutions, voice technology,
high availability and clustering solutions, Web application servers, pervasive
computing, IBM and OEM e-business applications, IBM System x™, and IBM
BladeCenter®. Rufus' various positions during his IBM career have included
assignments in administration and asset management, systems engineering,
sales and marketing, and IT services. He holds a BS degree in business
management from Saint Augustine's College. Rufus has been employed at IBM
for 27 years.
© Copyright IBM Corp. 2007. All rights reserved.
xi
Deepika Aman is Advisory IT Specialist in India. She has 12 years of experience
in IT and education. She holds a Bachelors degree in Computer Science and
Engineering from MD University, Rohtak, and a Masters degree in Software
Systems from BITS Pilani. She has been working with IBM since 2001. Her
areas of expertise include J2EE, IBM WebSphere Application Server, and
Rational Application Developer V7.0. She is certified in IBM WebSphere
Application Server V3.5, V4, V5, and V6, IBM WebSphere Studio V5, and
Rational® Application Developer V6.
Manu T George is a Staff Software Engineer in the IBM India Software Labs and
an Apache OpenEJB Committer. He has more than five years of experience in
the IT field. He has worked at IBM for two years, before which he worked as a
J2EE Application Developer. His areas of expertise include J2EE, IBM
WebSphere Application Server Community Edition, Apache Geronimo, Apache
OpenEJB, and Apache Axis. He has written articles on Hibernate and Apache
Geronimo. He has also published articles on IBM DeveloperWorks.
Vamsavardhana Reddy Chillakuru, also known as Vamsi, is an Advisory
Software Engineer with IBM India Private Limited. He has been employed at IBM
since 1996. His areas of expertise include J2EE, IBM WebSphere Application
Server Community Edition, and Eclipse Web Tools Platform. He is a committer
and member of Project Management Committee for Apache Geronimo. Vamsi
received his B.Stat.(Hons.) and M.Stat. degrees from Indian Statistical Institute,
Kolkata, India in the years 1994 and 1996 respectively.
xii
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Figure 1 The team from left to right, Manu T George, Deepika Aman, Vamsavardhana
Reddy Chillakuru, and Rufus Credle
Thanks to the following people for their contributions to this project:
Tamikia Barrow, Carolyn Briscoe, Diane O’Shea, Linda Robinson
International Technical Support Organization, Raleigh Center
Shyam Nagaranjan, Manager, SOA Technology Practice
IBM San Diego
Donald Vines, IBM Software Group, Enterprise Architecture, Application
Migration
IBM Salt Lake City
John Catlin, IBM Software Group, Solution Architect - EMEA Software Services
Architecture Practice
IBM Warwick UK
John Doppke, IBM Software Group, Product Manager, WebSphere Application
Server Community Edition
IBM Chicago
Bill Stoddard, IBM Software Group, Manager, WebSphere Application Server
Community Edition Development
IBM RTP
Preface
xiii
Mary K O'Donnell, WebSphere Application Server Community Edition and Web
Zero Offering Team Lead Application and Integration Middleware (AIM) Division
IBM Research Triangle Park, NC
Rick Robinson, IBM Software Group, Manager, Software Services BPM and
SOA Architecture Practice
IBM Warwick UK
Ken Hygh, IBM Software Group, ISSW Advanced WAS & DataPower® Manager
IBM RTP
Ken McCauley, SOA Technology Practice, IBM Software Services for
WebSphere
IBM RTP
Hernan Cunico, IBM Geronimo Development - Certified Consultant IT
IBM RTP
Leonardo Fernandez, IT Specialist
IBM Argentina
Roman Kharkovski, WebSphere WW Tech Sales Support & Competitive
Analysis (BEA, Oracle®, iPlanet, Tomcat, JBoss)-J2EE & BI
IBM Pittsburgh
Become a published author
Join us for a two- to six-week residency program! Help write a book dealing with
specific products or solutions, while getting hands-on experience with
leading-edge technologies. You will have the opportunity to team with IBM
technical professionals, Business Partners, and Clients.
Your efforts will help increase product acceptance and customer satisfaction. As
a bonus, you will develop a network of contacts in IBM development labs, and
increase your productivity and marketability.
Find out more about the residency program, browse the residency index, and
apply online at:
ibm.com/redbooks/residencies.html
xiv
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Comments welcome
Your comments are important to us!
We want our books to be as helpful as possible. Send us your comments about
this book or other IBM Redbooks in one of the following ways:
Use the online Contact us review Redbooks form found at:
ibm.com/redbooks
Send your comments in an e-mail to:
[email protected]
Mail your comments to:
IBM Corporation, International Technical Support Organization
Dept. HYTD Mail Station P099
2455 South Road
Poughkeepsie, NY 12601-5400
Preface
xv
xvi
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
1
Chapter 1.
Introduction to this book
This chapter summarizes the contents of this book. It also describes the process
that we used to identify migration issues and to develop the content of this book.
This chapter is organized into the following sections:
Our objective
Scope of this book
Applications that we cover in this book
What this book does not include
How to use this book
© Copyright IBM Corp. 2007. All rights reserved.
1
1.1 Our objective
Migrating an enterprise application from one J2EE application server to another
is theoretically a straightforward activity, but the migration can become a
complex activity that should not be taken lightly. We do not pretend to offer final
and comprehensive solutions to every migration issue in this book. Instead, this
book provides some guideposts and strategies for a real migration effort, largely
by working through the details of several migration examples. By describing our
experience and showing the tools that we used, we hope to better prepare you
for tackling your own migration tasks.
The goal of this book is to be a practical guide to J2EE professionals. We identify
specific migration issues and make specific recommendations regarding:
Migration tools
Migration processes
Strategies to make applications more portable and adaptable
1.2 Scope of this book
This book is organized around the migration of two J2EE 1.4 applications running
on IBM WebSphere Application Server Community Edition V1.1.0.1 to IBM
WebSphere Application Server V6.1 - Base. Here is what we did:
We used the latest available version of WebSphere Community Edition
V1.1.0.1.
We migrated each application using a different approach and different
development tools. In one migration, we used IBM Rational Application
Developer for WebSphere 7.0 and, in the other migration, we used the
Application Server Toolkit that comes with IBM WebSphere Application
Server V6.1 - Base. In the process, we documented:
– The step-by-step migration process
– Our specific use of tools
– The migration issues that we identified along the way
As a last step, we analyzed, categorized, and expanded on the migration
issues that we encountered.
2
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
1.3 Applications that we cover in this book
This book includes two migration examples from different platforms. We have
selected two sample applications (Plants By WebSphere and Adventure
Builder).1 We cover the most commonly used J2EE 1.4 artifacts in this book to
give a comprehensive experience of what the migration of a J2EE application
between different application servers entails.
Table 1-1 illustrates the J2EE technologies, features, and functionalities that we
discuss. Table 1-2 shows the list of open source frameworks that our sample
applications use. These tables are not a complete list of the technologies that are
available for these platforms or applications. You can use these tables as a guide
to map our migration results with your own scenario.
Table 1-1 Technologies, features, and functionalities from the migration examples
Application Server
Application
1
WebSphere Application Server
Community Edition V1.1.0.1
Adventure Builder
Plants By WebSphere
JSP™ 2.0
Yes
Yes
Servlet 2.4
Yes
Yes
EJB™ CMP 2.1
Yes
Yes
EJB SSB 2.1
Yes
Yes
JMS 1.1
Yes
No
Java Mail 1.4
Yes
Yes
JDBC™ 3.0
Yes
Yes
JSR 109: Implementing
Enterprise Web Services
Yes
No
The Plants by WebSphere application is a sample application, developed and configured using
WebSphere Studio Application Developer Version 5.0.1, that you can download from the
developerWorks® Web site.
Chapter 1. Introduction to this book
3
Table 1-2 Open source frameworks used in sample applications
Framework
Description
Application
XDoclet 1.2
Annotation programming tool. Allows the programmer
to work with a single file, instead of multiple files for
single component. Used to generate Web and EJB
Deployment Descriptors, configuration files for
Hibernate from XDoclet tags within Java files.
Adventure Builder
Apache Maven 1.0.2
Tool that extends basic capabilities of Ant and adds
automatic dependency tracking, simplifies build
scripting, and so forth. Used as a software project
management tool, provides build scripting, and
execution.
Plants By WebSphere
Apache Ant 1.5.1
Build tool for Java.
Adventure Builder
Plants By WebSphere
Apache Velocity
1.3.1
Open source template engine used instead of JSPs.
Adventure Builder
Plants By WebSphere
JUnit and JUnitEE
These are POJO and J2EE unit test frameworks that aid
in test driven development.
Adventure Builder
Plants By WebSphere
All migration instructions in this book are written for Microsoft® Windows® but
are not platform-specific. The same principles apply to Linux®, UNIX®, System i,
z/OS® and any other platform where you might want to run your J2EE
application.
1.4 What this book does not include
During the development of this book, we had time and resource limitations that
did not allow us to cover some areas of technology, such as:
Bean Manage Persistence (BMP) Enterprise JavaBeans™ (EJB) technology
Java Management Extensions (JMX™)
Administrative scripting
Timer and startup services
Clustering, server administration, and configuration
Database and operating system migration
The main focus of the book is migration, and we assume that you are familiar
with J2EE concepts, the Java language, the platforms from which we are
migrating, and the development tools. As you go through the platform-specific
migration chapters, you will find references to additional documentation as
4
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
needed. You can find a complete list of all related documentation in “Related
publications” on page 495.
1.5 How to use this book
We hope you will take the time to read this entire book. However, depending on
your time and interest, you can read each chapter separately. Each chapter’s
contents should be obvious from its name. This book includes the following
chapters:
Chapter 2, “IBM WebSphere overview” on page 7 discusses available
WebSphere Application Server V6.1 - Base packages, operating systems,
and supported databases. This chapter also includes an overview of the
Rational Application Developer V7.0 development tool.
Chapter 3, “Migration strategy and planning” on page 19 includes advice for
planning migration activities, discusses four migration alternatives, gives
advice as to the selection of the development and migration tools, and covers
interoperability options if you have to run multiple application servers that
need to communicate with each other.
Chapter 4, “Installing and configuring the products for the migration” on
page 45 is a step-by-step guide to help you install and configure IBM products
that we used in this book, such as DB2 Universal Database Express Edition
V8.2, Rational Application Developer V7.0, and WebSphere Application
Server V6.1 - Base.
Chapter 5, “Common migration issues” on page 125 lists and analyzes the
migration issues that we discovered while developing this book. It also
discusses common pitfalls and suggests ways to solve them.
Chapter 6, “Migrating WebSphere Application Server CE to WebSphere
Application Server” on page 145 presents step-by-step migration examples of
the Plants by WebSphere application from WebSphere Application Server
Community Edition V1.1.0.1 to WebSphere Application Server V6.1 - Base
using the Application Server Toolkit.
Chapter 7, “Developing the application on WebSphere Application Server
Community Edition” on page 221 walks through developing the Adventure
Builder application using the Eclipse WTP framework and the Eclipse Plugin
for WebSphere Application Server Community Edition V1.1.0.1.
Chapter 8, “Migrating Adventure Builder to WebSphere Application Server” on
page 347 presents a step-by-step migration example from WebSphere
Application Server Community Edition V1.1.0.1 to WebSphere Application
Server V6.1. In this example, we use the application Adventure Builder using
Rational Application Developer V7.0.
Chapter 1. Introduction to this book
5
Chapter 9, “Deploying Adventure Builder on WebSphere Application Server”
on page 423 describes the steps that you need to follow to deploy the
migrated Adventure Builder application into WebSphere Application Server
V6.1 - Base.
6
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2
Chapter 2.
IBM WebSphere overview
IBM WebSphere is the leading software platform for e-business on demand®,
providing comprehensive e-business leadership, WebSphere is evolving to meet
the demands of companies faced with challenging business requirements, such
as the need for increasing operational efficiencies, strengthening client loyalty,
and integrating disparate systems. WebSphere provides answers in today’s
challenging business environments.
WebSphere is architected to enable you to build business-critical applications for
the Web. WebSphere includes a wide range of products that help you develop
and serve Web applications. They are designed to make it easier for clients to
build, deploy, and manage dynamic Web sites more productively.
In this chapter, we take quick a look at WebSphere Application Server V6.1 Base. For a more detailed discussion of the complete WebSphere platform, refer
to WebSphere Application Server V6.1: Technical Overview, REDP-4191.
This chapter is organized into the following sections:
About WebSphere
IBM WebSphere Application Server
IBM WebSphere Application Server Community Edition
Development and deployment tools
© Copyright IBM Corp. 2007. All rights reserved.
7
2.1 About WebSphere
WebSphere is the IBM brand of software products designed to work together to
help deliver dynamic e-business quickly. WebSphere provides solutions for a
positive effect on a client’s business. It also provides solutions for connecting
people, systems, and applications with internal and external resources.
WebSphere is based on infrastructure software (middleware) designed for
dynamic e-business. It delivers a proven, secure, and reliable software portfolio
that can provide an excellent return on investment.
The technology that powers WebSphere products is Java. Over the past several
years, many software vendors have collaborated on a set of server-side
application programming technologies that help build Web-accessible,
distributed, platform-neutral applications. These technologies are collectively
branded as the Java 2 Platform Enterprise Edition (J2EE), which contrasts with
the Java 2 Standard Edition (J2SE™) platform, with which most clients are
familiar.
J2SE supports the development of client-side applications with rich graphical
user interfaces (GUIs). The J2EE platform is built on top of the J2SE platform.
J2EE consists of application technologies for defining business logic and
accessing enterprise resources such as databases, Enterprise Resource
Planning (ERP) systems, messaging systems, e-mail servers, and so forth. The
potential value of J2EE to the client is tremendous, including the following
benefits:
Promotion of an architecture-driven approach to application development
helps reduce maintenance costs and allows for construction of an IT
infrastructure that can grow to accommodate new services.
Application development is focused on unique business requirements and
rules, rather than common application aspects, such as security and
transaction support. This improves productivity and shortens development
cycles.
Industry standard technologies allow clients to choose among platforms,
development tools, and middleware to power their applications.
Embedded support for Internet and Web technologies allows for a new breed
of applications that can bring services and content to a wider range of clients,
suppliers, and others, without creating the need for proprietary integration.
Another exciting opportunity for IT is Web services. Quite simply, Web services
allow for the definition of functions or services within an enterprise that can be
accessed using industry standard protocols that most businesses already use
today, such as HTTP and XML. This allows for easy integration of both intra- and
8
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
inter-business applications that can lead to increased productivity, expense
reduction, and quicker time to market.
2.2 IBM WebSphere Application Server
IBM WebSphere Application Server is a high-performance and scalable
transaction engine for dynamic e-business applications. The Open Services
Infrastructure allows companies to deploy a core operating environment that
works as a reliable foundation capable of handling high volume secure
transactions and Web services.
WebSphere Application Server continues the evolution to a single Web services
enabled, J2EE application server and development environment that addresses
the essential elements needed for an on demand operating environment.
The potential value of J2EE to the client is tremendous. Among the benefits of
J2EE are the following:
A simplified architecture based on standard components, services and
clients, that takes advantage of the write-once, run-anywhere Java
technology.
Services providing integration with existing systems, including Java DataBase
Connectivity™ (JDBC), Java Message Service (JMS), Java Connector
Architecture (JCA), Java Interface Definition Language (Java IDL), the
JavaMail™ API, and Java Transaction API (JTA and JTS) for reliable
business transactions.
Application development is focused on unique business requirements and
rules, rather than common application aspects, such as security and
transaction support. This improves productivity and shortens development
cycles.
Scalability to meet demand by distributing containers across multiple systems
and using database connection pooling, for example.
A better choice of application development tools and components from
vendors providing standard solutions.
A flexible security model that provides single sign-on support, integration with
existing security schemes, and a unified approach to securing application
components.
Because different levels of application server capabilities are required at different
times as varying e-business application scenarios are pursued, WebSphere
Application Server is available in multiple packaging options. Although they
share a common foundation, each provides unique benefits to meet the needs of
Chapter 2. IBM WebSphere overview
9
applications and the infrastructure that supports them. Therefore, at least one
WebSphere Application Server product package will fulfill the requirements of
any particular project and the prerequisites of the infrastructure that supports it.
As your business grows, the WebSphere Application Server family provides a
migration path to higher configurations.
WebSphere Application Server is available in several different packages that are
designed to meet a wide range of client requirements. Each package is designed
to provide a tailored environment for a specific set of clients. The following
sections describe these packages for distributed platforms in more detail.
Operating system terminology:
Distributed:
Windows, UNIX: AIX®, Linux/Intel®, Linux/PPC, zLinux,
Solaris™, HP-UX
System i™:
i5/OS®, OS/400®
z/OS:
OS/390®
2.2.1 Supported platforms and software
The following link provides a list of supported software and versions for
WebSphere Application Server V6.1:
http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg27007642
2.3 IBM WebSphere Application Server Community
Edition
IBM WebSphere Application Server Community Edition V1.1.0.1 is a free,
lightweight J2EE application server built on Apache Geronimo technology.
Available at no charge, it harnesses the latest innovations from the open source
community to deliver an integrated, readily accessible and flexible foundation for
developing and deploying Java applications.
WebSphere Application Server Community Edition is built on Apache Tomcat
and other best-of-breed open source software such as Apache OpenEJB,
Apache Axis, and IBM Cloudscape™ (based on Apache Cloudscape). For more
information about WebSphere Application Server Community Edition, see:
http://www-306.ibm.com/software/webservers/appserv/community/features/
10
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2.3.1 Features and benefits
This section lists the features and benefits of WebSphere Application Server
Community Edition V1.1.0.1.
The following Web link provides a list of supported software and versions for
WebSphere Application Server Community Edition V1.1.0.1:
http://www-1.ibm.com/support/docview.wss?uid=swg27006834
Features
Features of WebSphere Application Server Community Edition V1.1.0.1 include:
J2EE, Version 1.4 programming model
The model uses technology from Apache Geronimo, the open-source
application server project at the Apache Software Foundation. Apache
Geronimo brings together best-of-breed technologies across the broader
open-source community to support J2EE specifications, including:
–
–
–
–
–
–
–
Apache Tomcat to support Servlets and JavaServer™ Pages™ (JSP)
OpenEJB to support Enterprise JavaBeans (EJB)
ActiveMQ to support JMS
MX4J to support Java Management Extensions (JMX)
TranQL to support JDBC
Apache Axis for Web services
HOWL (ObjectWeb) for JTA
WebSphere Application Server Community Edition supports the Java
Developer Kit (JDK™) from IBM and Sun.
Eclipse plug-in
The plug-in enables you to take advantage of the Eclipse technology-based
Web tools platform to provide a simple development environment for creating,
deploying and debugging your WebSphere Application Server Community
Edition applications.
Database support
Database support is pre-integrated with IBM Cloudscape. Built from the open
source Apache Derby database, IBM Cloudscape provides a supported,
robust, small-footprint database server with full transactional capability that is
simple to deploy and reduces the cost of Web-based and embedded
applications. This pre-integration saves you time, effort and money as you do
not need to select, pay for, install and configure a database for applications
that run on WebSphere Application Server Community Edition. If you want
external database access, it also provides driver support for IBM DB2®,
Oracle, Microsoft SQL Server™, and MySQL.
Chapter 2. IBM WebSphere overview
11
Runtime customization
You can tailor the application server to your needs to improve performance
while saving on system resources. You can selectively enable and disable
specific components at runtime to improve efficiency.
User management
Features centralized user management to support systems administration
and deployed applications, unifying all applications running on the platform
under a shared, standards-based security framework based on Java
Authorization Contract for Containers (JACC). This capability virtually
eliminates the complexity of setting up and maintaining separate
user-management systems for your applications. It also supports Lightweight
Directory Access Protocol (LDAP) authentication against directory servers.
Centralized configuration and control
Provides a technology preview of an easy-to-use Community Edition
Administrative Console application that gives you the ability to manage and
monitor the application server and related resources.
Migration aids
Migration aids for Apache Geronimo and Apache Tomcat are available.
Liberal product license
There is no charge to use in development, testing, and production. You can
make unlimited copies of the software for internal use. Because it uses open
source that is licensed under Apache License, Version 2.0 as its underlying
foundation, you have the flexibility to modify the source code of the
application server to suit your needs.
Convenient access to code
The product binaries and source code is available as no-charge downloads
from the IBM Web site. You can choose to selectively install specific
components, such as the JDK. The wizard-driven installation application will
guide you through the installation and build process.
Benefits
Benefits of WebSphere Application Server Community Edition V1.1.0.1 include:
World-class support backed by IBM
IBM support ensures that you receive reliable assistance and timely problem
resolution. Three support options—entry, enhanced, and elite—enable you to
choose the support level that meets your business and technical needs. Reap
the benefits of open source with the peace of mind of knowing that your
applications are backed by IBM.
12
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Get started with no up-front costs
The small footprint makes it quick and easy to download, so you can get the
software up and running and show tangible results fast. Download
Community Edition for free and use it through your development, testing, and
production cycles at no cost to you unless you need technical support.
Pre-integrated to save you time and money
Includes the baseline components you need to deploy an application in one
integrated package. IBM continually tests and tracks the interdependencies
between them eliminating the need for you to undertake this tedious and
time-consuming task. The pre-integrated IBM Cloudscape database provides
a full-featured, robust, small-footprint database server for use during
development and deployment stages. Also included is a technology preview
of an administrative console application to help you easily manage and
configure the server components.
Customize to suit your business needs
Open-source technology as its underlying foundation, allows you the ability to
modify the source code of the application server to suit your needs. Extend
capabilities with custom features, or choose to remove unnecessary
components to further streamline the footprint.
Focus on your core capabilities
WebSphere Application Server Community Edition provides a starting
framework for building higher-level features. Solution providers can you can
focus efforts on building differentiated value for customers rather than
rewriting core infrastructure. Developers can accelerate development
allowing them to show tangible results even more quickly.
Clear path to advanced capabilities
Investment increases over time as the open source community continues to
mature and innovate. Additionally, you gain access to a comprehensive and
proven portfolio of middleware products from the IBM WebSphere family. IBM
provides a clear path to advanced capabilities as your needs grow over time.
2.4 Development and deployment tools
The WebSphere Application Server V6.1 environment comes with a rich set of
development tools. WebSphere Application Server V6.1 - Express comes with
the Application Server Toolkit and Rational Web Developer V7. WebSphere
Application Server V6.1 - Network Deployment comes with the Application
Server Toolkit and a trial version of Rational Application Developer V7.0. For a
Chapter 2. IBM WebSphere overview
13
full version of Rational Application Developer V7.0, additional licensing is
required.
This section covers the development and deployment tools that are available
with Rational Application Developer V7.0 as well as their key features.
IBM Rational Application Developer - Full J2EE development tools
IBM Rational Web Developer - Web development tools
Full development environment.
Support for J2EE 1.2, 1.3, 1.4 Web
based application.
Support for JSF, Struts frameworks
and SDO tools.
No EJB, J2C development.
Application Server Toolkit
Tool for assembly, deployment and
debug J2EE applications.
No development support.
Java development tool.
WebSphere Rapid Deployment.
Support for enhanced EAR.
Server tools - support remote
server.
Server support (WebSphere
Application Server V6.x, Tomcat
V5.0, WebLogic Server V6.1, 7.1
and 8.1 via Web Logic Toolkit).
Visual Java GUI builder.
Web Diagram Editor.
Site designer.
Page templates.
XML tools.
Web services tools.
Database tools.
Portal and portlet development.
Enterprise Generation Language
(EGL) tools.
Debugger.
Full J2EE 1.4 support.
Additional server: WebSphere
Application Server 6.1.
UML visual editors.
Static and runtime analysis.
Extended debugging and
profiling.
Component test automation.
Clearcase LT for team
integration.
Rational Unified Processing
(RUP) integration.
Eclipse 3.2
Universal Tooling Platform - provides frameworks, services, tools for tool builders.
Java development tools.
Core workbench technology basis for all IBM tooling.
Figure 2-1 A summary of the development and deployment tools
2.4.1 IBM Rational Application Developer V7.0
IBM Rational Application Developer V7.0 includes all the subset features of
Rational Web Developer V7. It is the IDE of choice for developing and deploying
applications for WebSphere Application Server V6.1. It is the successor to IBM
Rational Application Developer 6.0, and it supports applications developed for
WebSphere Application Server versions 5.0 and later and 6.0 and later.
We discuss some of the key features of Rational Application Developer V7.0 in
the following sections.
14
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Full support provided for Java 2 Enterprise Edition 1.4
All wizards have J2EE 1.4 options. Deployment Descriptor editors have been
upgraded for J2EE 1.4. options. There are wizards for the migration of J2EE 1.2
and 1.3 applications to J2EE1.4 and full support of the latest enterprise Java
APIs: Servlet 2.4, JSP 2.0 and EJB 2.1.
Annotation-based programming
New EJB, Servlet, and Web services annotations allow the programmer to use
XDoclet-style tags in source code files to specify configuration parameters for
J2EE applications. This programming style reduces the artifacts on which the
programmer has to concentrate and keep track.
Modelling functionality
The IDE has Unified Modeling Language (UML) modeling functionality which
allows the developer to express classes, EJBs and database schemas visually.
New UML Topic and sequence diagrams can be used to view class relationships
and method interactions. Because the diagrams are created by wizards and by
dropping classes on diagram panes, only a passive knowledge of UML is
required on the part of the developer. That is, the developer only needs to be
able to read the diagrams rather than actively having to know the language to
generate them.
Integration with the Rational Unified Process and Tool Set
IBM Rational software also offers an extensive suite of tools for the end-to-end
application development life cycle. These tools are not included with Rational
Application Developer V7.0, but instead they are additional tools that can interact
with the IDE.
For example, the Rational Tools Suite includes Rational ClearCase, which is a
code repository solution, and Rational RequisitePro®, which is a requirements
analysis tool. There are many others. Rational Application Developer V7.0
integrates seamlessly with these additional tools and also with the Rational
Unified Process which is the iterative software development process that
Rational software supports. The IDE has a Process Browser and Process
Advisor view which allows the developer to view Rational Unified Process best
practice advice for the task at hand.
Application analysis
The IDE also has built-in wizards for analyzing applications for coding practices.
Bad coding practices are identified in applications and examples are provided for
best practices and how to resolve problems as well.
Chapter 2. IBM WebSphere overview
15
Unit testing
Rational Application Developer V7.0 provides features for the easy creation,
execution and maintenance of unit tests for J2EE components. Support of
creating unit tests for:
Java classes
EJBs (1.1, 2.0 and 2.1)
Web services (J2EE and .Net based)
A selection of test patterns is available for defining complex unit test cases. Test
data can be stored in a separate data pool for the flexible definition of test cases.
The unit test frame work in Rational Application Developer V7.0 is constructed
using JUnit and Hyades technology. JUnit is a frame work for unit testing in Java,
it is available as a separate command line tool and it is also as an Eclipse
plug-in. Hyades is an Eclipse sub-project to produce an integrated test, trace and
monitoring environment. Recently, Hyades has been incorporated into a larger
Eclipse project for test and performance tools as an example of how Rational
Application Developer V7.0 through the Eclipse IDE frame work is using wider
open standards technologies.
For further information, visit the JUnit and Hyades sites at the following URLs,
respectively:
http://www.junit.org
http://www.eclipse.org/hyades
Integration with Clearcase
Rational Application Developer V7.0 has a client for accessing Rational
ClearCase LT. Rational ClearCase LT is the junior member of the Rational
ClearCase family of Source Code Management (SCM) repositories. Rational
Application Developer V7.0 also has a client for accessing CVS (Concurrent
Versions System), which is another popular SCM. The Rational ClearCase LT
client is another example of how the IDE integrates with the wider suite of
Rational tools and the Rational Unified Process®.
For the latest information visit the following Web sites:
Rational Application Developer for WebSphere Software features and
benefits
http://www-306.ibm.com/software/awdtools/developer/application/featu
res/index.html?S_CMP=wspace
16
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Rational Application Developer for WebSphere Software system
requirements
http://www-306.ibm.com/software/awdtools/developer/application/sysre
q/index.html
2.4.2 Application Server Toolkit
The Application Server Toolkit is a suite of tools for deploying applications to
Application Servers. The Application Server Toolkit is a sub-set of functionality in
Rational Application Developer V7.0.
Features in the Application Server Toolkit include tools for the following
operations of J2EE applications:
Assembling
Deploying
Running
Debugging
Profiling
Applications can be assembled and then deployed to local or remote test
servers. When deployed, the applications can simply be run. You can also
deploy the applications to diagnose errors or profile them o analyze
performance.
Chapter 2. IBM WebSphere overview
17
18
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3
Chapter 3.
Migration strategy and
planning
This chapter describes the very first activities that you need to accomplish in
every migration project. This chapter is not intended to be a final methodology,
but it can help you to organize the migration process, to address people about
certain tasks, to know where you need help or not help, and to decide how you
will go through the migration process.
This chapter also provides a list of topics that you can use as a checklist.
This chapter is organized into the following sections:
Migration strategy considerations
Application servers interoperability
Migration planning activities
Migration alternatives
Migrating the site
Testing the migrated site
Going live
© Copyright IBM Corp. 2007. All rights reserved.
19
3.1 Migration strategy considerations
Migration is not just a change from one application server to another, nor does it
simply mean changing some source code. Migration involves work and people
from different areas and with different skills. When you migrate to a new
application server, you are likely doing it because you want to take advantage of
new capabilities, improve the way you manage your applications, refactor your
code, improve performance, or decrease downtime.
All these changes need to take place in an ordered environment, step-by-step,
and with full knowledge of your target. That is why you need to plan the migration
as a complete project, and like any other project, the migration will involve
initiation, planning, execution, and closeout. In this section, we discuss the
initiation of the project and the activities involved.
3.1.1 Getting help
Depending in the complexity of your applications, your migration schedule, the
skilled resources that are available, and the critical nature of your business, you
might consider getting help from IBM services team or IBM business partners.
You can outsource your complete migration project. Alternately, you can seek
assistance from one or more experts, to help with migration while you provide the
rest of the resources for the project. This approach has the benefit of providing
mentors, who have performed a number of migrations, to help you with the actual
migration tasks. The IBM WebSphere Application Server Migration Services
Program offers a variety of migration services tailored specifically for
WebSphere. For more details, visit:
http://www-128.ibm.com/developerworks/ondemand/migrate/server.html
Finally, consider getting education to become familiar with the new features and
how they might impact or improve your day-to-day operations.
IBM provides excellent source materials to help architects design e-business
applications. For in-depth advice about application design, take a look at the
Patterns for e-business site. These techniques can be helpful in a migration
project:
http://www.ibm.com/developerworks/patterns
20
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3.1.2 Migrating the different environments
No matter how many applications you have, there are three kinds of
environments that you need to migrate:
Development environment
This group includes tools and frameworks used to develop your applications’
code. Here is where the greater portion of the technical migration is
accomplished, and this migration can be done in different ways as we discuss
in 3.1.3, “Strategies to handle migration complexity” on page 22. We
recommend that you have software version control and backup copies of your
work as you progress through the project.
Test environments
Every test environment is included in this group: system test, performance
test, pre-production, and so forth. Some of them should be as close as
possible to the production environment configuration in order to obtain more
realistic results, especially if you are focused on performance. Generally,
these test environments are developed initially for deploying and testing the
application being developed, but the same environments can be used to test
the application migration.
Production environment
The production environment is where the applications are actually running.
This is the most sensitive environment because migration will have a direct
impact on your business. The magnitude of this impact will depend on the
migration approach you decide to use. This decision is based on several
factors, such as hardware availability and business requirements, among
others. Refer to 3.5, “Migrating the site” on page 40 for further details about
the migration approaches.
Identify one development team and assign that team the task of migrating one
simple application. This task should not be complicated, but it can give the team
a feel for the new platform, the differences with the previous one, as well as
hands-on experience. This approach also gives you a measure of the time
needed to migrate.
Consider that not all the development teams are the same. The applications
could be very different (not only in size, but in complexity), and they might have
different delivery schedules. So, in turn, you might have to plan to migrate the
applications at different times, having both application servers running
concurrently and interoperating for a period of time. We discuss the issues of
interoperability in “Vertical slice strategy” on page 23.
Chapter 3. Migration strategy and planning
21
3.1.3 Strategies to handle migration complexity
When you have the first application ready to migrate, you have to decide on a
migration strategy. Based on the belief that a small problem is easier to solve
than a larger one, we discuss three different methods to achieve this strategy. In
some cases, you need to apply more than one method to get to the most atomic
form of the problem. These migration strategies are:
Modularization strategy
Deploy, test, and solve strategy
Vertical slice strategy
Modularization strategy
Modularization strategy is a common practice that is enforced by many
technologies. J2EE divides the application into different archives inside an EAR
file. These different archives are part of the problem of building the application,
dividing it in business logic and business presentation. So, the first approach to
migrating the application could be to migrate each of those modules separately.
Probably the less difficult module to migrate is the .jar file that includes the utility
classes, followed by the .war file with the Web application, and ending with the
.jar file that includes the EJBs. However, the migration path suggested is not be
in order of complexity but in order of testability.
Here is the suggested path:
1. Utility classes
This kind of module should be the simplest to migrate, because it usually
does not use many features of the Application Server, but simply provides
utility issues classes or solves data conversion problems (think of it as
Apache Commons). You can test the classes included in those .jar files using
JUnit, which is supported by Rational Application Developer V7.0.
2. Enterprise Java Beans
When you have all the utility classes you use inside your EJBs migrated, it is
time to migrate the EJBs. EJB migration is perhaps the most difficult part of
the migration, because EJBs use many features from the application server,
and the J2EE specification leaves some definitions open to vendor
interpretation. That is why there are different XML files to configure the same
element across the different J2EE compliant servers.
After you migrate your EJBs, you can deploy the .jar file and test your EJBs
with the Universal Test Client or using JUnit. The Universal Test Client and
JUnit are both provided with Rational Application Developer V7.0. You can
also use other testing frameworks such as JUnitEE or Cactus.
22
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Application Client
If there is any Application Client Project to migrate, you need to migrate it
after the EJBs.
4. Web application
At this point, you have utility classes and EJBs migrated and tested, so the
only thing left to do is migrate the Web application.
As you perform the migration, we suggest that you write extensive tests and
integrate them as part of your regular build process. The ultimate measure is
Test Driven Development, popularized by the Extreme Programming (XP). As
you finish large parts of the migration, you should also perform a Functional
Verification Test (FVT) and a System Integration Test (SIT).
Deploy, test, and solve strategy
You can use this approach in simple, well coded, or almost migrated
applications. It consists of deploying the application and testing it until an error
occurs, going back to the application, solving the problem, and deploying the
application again. This technique is rudimentary, but if you want to keep working
without an IDE or if you do not have the source code of the application, this
strategy might be the best approach.
Vertical slice strategy
You can use the same concept used in the development of an application in its
migration. The idea is to take an important use case of the application and
migrate it as a separate application. It will only contain limited functionality, but it
is migrated end-to-end. The problem with this type of migration is that it requires
a deep understanding of the application to know which slice of the application to
migrate. This slice should be the less cohesive one to ensure the fewest code
modifications possible to simulate the other non-migrated parts of the
application.
Very often, the application that needs to be migrated is very complex and cannot
be migrated all at once, which is why you slice it into parts and perform a phased
migration, potentially over multiple months for very large projects. Over a period
of time, different parts of application might need to communicate with each other.
For example, in a online commerce application, you can migrate the shipping
module first and make it available to the checkout service that might still be
running in the original environment. In some cases, you might need bidirectional
connectivity between the two. You might have a need for security, transactions,
synchronous and asynchronous communications. There are also different
requirements for performance and footprints in terms of the software licenses
and hardware utilized. These requirements can vary widely and this is why it is
Chapter 3. Migration strategy and planning
23
difficult to make generic, one-size-fits-all recommendation as to the
interoperability option to be used.
In some cases, a complete migration can take several months; in other cases,
parts of applications will never be migrated. There are also clients who decide to
perform all new development and deployment with IBM software, but keep their
existing applications intact. It is likely that these existing applications need to
communicate with the new ones, as in the case of a phased migration. This leads
us into the interoperability discussion.
3.2 Application servers interoperability
In recent years, the concept of universal interoperability became widely
accepted. It is called Enterprise Service Bus (ESB). IBM and many other vendors
see ESB as an architectural pattern that can be implemented in different ways
using different protocols and products.
In Table 3-1 on page 26, we have tried to summarize some of these
considerations as they apply to J2EE application servers. The following list
provides a description of each protocol that you can use to interoperate between
different application server instances as well as between different vendor
products:
JMS over WebSphere MQ
WebSphere MQ provides JMS as one of its programming APIs. You can use
WebSphere MQ as a JMS provider from within any J2EE application server,
C, or COBOL, and it supports over 40 platforms. WebSphere MQ provides
great quality of service for its messages and is one of the fastest messaging
engines with 80% market share in the message-oriented middleware market.
Note that the performance of this protocol is heavily dependent on the quality
of services configured in the messaging engine. Because of the persistence
and assured delivery options, we did not give it the highest mark for
performance, because we compared it to low latency synchronous protocols
that do not have high quality of service. If you need very high performance
and do not require full crash recovery, you can configure non-durable
in-memory messaging and achieve very high performance levels comparable
to those of synchronous protocols. JMS over WebSphere MQ is a very
popular choice for interoperability between WebSphere and other application
servers.
Simple Object Access Protocol
Simple Object Access Protocol is a popular Web services communication
protocol. most often used over HTTP, although it can also use JMS, SMTP or
other lower level protocols. Recent developments in Web services have
24
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
added a great deal to its capabilities, so it hardly deserves the name simple
anymore. These capabilities include security, transactions, policies, reliability,
registry and publish/subscribe services. Simple Object Access Protocol is
becoming more and more popular. WS-I.org is a good resource to learn more
about interoperability options for Simple Object Access Protocol. Many clients
use this protocol in production to connect multiple heterogeneous systems
together.
RMI-IIOP (EJB only)
The RMI-IIOP protocol is part of the J2EE specification 1.2 and above. It is
designed for EJB clients to allow them to invoke EJBs over a CORBA IIOP
stack with automatic security and transaction flow, subject to the
implementation and support terms of the vendor. This protocol is an efficient
synchronous protocol, but unlike Simple Object Access Protocol-HTTP, it is
not well supported by firewalls. RMI-IIOP is very popular to connect multiple
domains of the same server and less popular for heterogeneous
interoperability.
IIOP
IIOP is a pure CORBA IIOP protocol as defined by OMG. There are very few
applications built as CORBA, and WebSphere allows non-Java EJB clients to
invoke EJBs through IIOP.
Third-party JMS
This option assumes you have a third-party JMS provider, such as ActiveMQ
(Default JMS provider in WebSphere Application Server Community Edition),
Sonic, Tibco, or any other JMS server. You have to configure the JMS
provider in both application server environments, making sure that you have
transactional JTA support for sending/receiving messages and that it works
under a high load. This option is not used very often because most
organizations who use messaging tend to prefer WebSphere MQ.
HTTP socket
This is an way of connecting to the server by custom programming and
opening direct connection from the client, using HTTP to access the target
system in a similar way to a browser, except that instead of HTML payload,
some custom protocol, and encoding is being used. This approach is not
often used today because new applications are built much more easily with
standardized Simple Object Access Protocol and WSDL that have great tool
support and are very extensible. We do not recommend this option to anyone
except highly specialized systems.
Chapter 3. Migration strategy and planning
25
In Table 3-1, we have used a very simple binary scheme to rate all protocols
against each other in separate quality of service (QoS) categories. Our ratings
are simple—Y and N:
Y means a better choice as it relates to other protocol choices in the table.
N designates a lower ranking but not necessary a resounding no. It simply
means that the rated protocol offers a somewhat lesser capability in a
particular category, but it still can be a viable choice when considered across
all QoS categories.
We have put quality of service descriptions into the right-hand side of the table. A
detailed description of QoS used in these tables is given at the end of Table 3-1.
Protocol
Description
WebSphere Application Server as client for WebSphere
JMS over
Community Edition
WebSphere
Need to code Java JMS client to send/receive
MQ
messages. For WebSphere Community Edition we
need to set up the MQ connection factory and code
MDB or pull messages through JMS Java calls.
Simple
Object
Access
Protocol
Synchronous
Bidirectional
Strategic
Supported
Tested
Best performance
Easy to set up
Low cost
Loose coupling
Security propagation
JTA (2PC) support
Client transaction
Table 3-1 Interoperability ratings and service descriptors
N Y Y Y N N N N Y N N N
WebSphere Application Server as server for WebSphere
Community Edition
Need MDB or JMS calls from Java. On WebSphere
Community Edition, need to setup MQ as JMS
provider and code JMS Java client to send/receive
messages.
WebSphere Application Server as client for WebSphere Y Y Y Y Y N Y Y Y Y N N
Community Edition
Need to import WSDL and generate Web services
client - subject to version limitations and Java types
used (see WS-I.org profiles). WebSphere Community
Edition server (uses AXIS as Simple Object Access
Protocol provider), does not need to be aware of the
client and does not need any changes.
WebSphere Application Server as server for WebSphere
Community Edition
Same as above, but in reverse.
26
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
RMI-IIOP
(EJB only)
Third-party
JMS
HTTP
socket
Synchronous
Bidirectional
Strategic
Supported
Tested
Best performance
Easy to set up
Low cost
Loose coupling
Security propagation
JTA (2PC) support
Client transaction
Protocol
Description
WebSphere Application Server as client for WebSphere Y Y Y N N Y Y Y N N N N
Community Edition
No change in client Java source code. Should be able
to invoke WebSphere Community Edition EJBs from
WebSphere Application Server V6.1 and above, but
need proper initialContext. WebSphere Community
Edition EJBs do not need to be changed and are not
aware of the WebSphere Application Server client.
WebSphere Application Server as server for WebSphere
Community Edition
Same as above, but in reverse.
WebSphere Application Server as client for WebSphere N Y N N N N N N Y N N N
Community Edition
Similar to JMS over WebSphere MQ option.
WebSphere Application Server as server for WebSphere
Community Edition
Same as above.
WebSphere Application Server as client for WebSphere Y Y N Y Y Y Y Y Y N N N
Community Edition
In the Java client need to manually open a socket
connection and send HTTP request to custom
WebSphere Community Edition remote URL, acting
as a reverse proxy for services on WebSphere
Community Edition. This was usually done before
Simple Object Access Protocol became popular and is
not recommended. Need to develop a servlet acting
as a proxy and map incoming HTTP requests to EJBs,
invoke EJB and generate HTTP responses back to the
client.
WebSphere Application Server as server for WebSphere
Community Edition
Same as above, but in reverse.
Chapter 3. Migration strategy and planning
27
Here are the QoS that we used in Table 3-1:
Synchronous
This column simply refers to the protocol ability for non-blocking calls. In the
case of RMI-IIOP, all calls are synchronous, while in the case of JMS, calls
are asynchronous. Note that synchronous interaction can be built based on
two asynchronous calls. Also note that in many cases, greater performance
can be achieved by splitting the work into multiple parallel requests using
non-blocking asynchronous calls.
Bidirectional
This capability refers to the fact that both client and server should be able to
initiate the conversation. For example, in the case of the OEJP protocol, the
WebSphere Application Server V6 client is able to invoke EJBs in
WebSphere Application Server Community Edition, but the WebSphere
Application Server Community Edition client is not able to invoke WebSphere
Application Server V6 because it does not support the OEJP protocol. In
another example, WebSphere MQ is supported by all of these servers and
thus provides bidirectional communication channel, no matter what product
acts in a server and client role.
Strategic
This topic is introduced to give guidance for your future technology direction.
If you have to decide on the protocol, we suggest that you consider the
industry and vendor direction and set your time lines in line with the future
support options for this protocol by vendors. Prime examples of strategic
protocols are Simple Object Access Protocol and WebSphere MQ.
Supported
This refers to the fact that the vendor might or might not provide formal
support for the particular protocol if you have a problem. We could have split it
into two columns for IBM support and Other vendor support, but we merged it
into one by using the AND operation, so that is what is represented. The
column shows Yes only if both vendors support the protocol.
Tested
Yes in this column indicates that we have some direct or anecdotal evidence
that this protocol for the combination of products was attempted and was
proven to work at least in the lab environment. This does not refer to the
formal rigorous tests that IBM or other vendors typically perform. This column
is a more informal measure. Perform your own tests to verify that the protocol
still works with the version of products you are using in your own particular
hardware, network, and software environment.
28
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Best performance
This column designates a relative measure of protocols against each other.
In some environments, even N might be more than enough. In other
environments, even the best performing protocol can be used inappropriately
and have very poor performance. For example, if you access an EJB over the
network for every getXXX() and setXXX() operation separately and do not use
the Data Access Object pattern, you might get a very poor performance. The
same applies to Simple Object Access Protocol and any other network
communication.
Easy to set up
This refers to the fact that you might have to purchase, install, configure, and
maintain additional layers of software to provide support for some protocols.
For example, with WebSphere MQ, you will have to install and configure
additional software, while for OEJP or Simple Object Access Protocol or
RMI-IIOP you already have all necessary binaries as part of your application
server install. Having said that, WebSphere MQ gives you freedom and
capabilities that application server protocols do not provide. It is a question of
trading quality of service for simplicity and cost.
Low cost
This includes all kinds of costs that can be associated with the choice of the
particular protocol. This includes cost of development (is it easy to program
for the protocol?), cost of setup and configuration, cost of additional software
required, cost of maintenance, cost of risk of lost messages and downtime. It
is all relative and it is hard to give a generic measure. For example, with
WebSphere MQ, you have to factor in the cost of the license and installation
and (potentially) additional hardware, so it seems expensive, but this might
not be accurate for some environments where a single message carries a lot
of value and you cannot afford to lose your messages. This is called
downtime cost or risks cost.
Loose coupling
This capability refers to the fact that the server does not need to know about
the client and vice-versa. When the server implementation changes but the
API stays the same, the client does not need to be recompiled. Also, the
version of the server runtime might change, but the client does not need to
know about it. For example, if you have upgraded your server from a previous
version of WebSphere Application Server Community Edition to WebSphere
Application Server Community Edition V1.1.0.1, your client running inside of
WebSphere Application Server V6 that uses the WebLogic service does not
need to have new jar files installed or be recompiled.
Chapter 3. Migration strategy and planning
29
Security propagation
This category describes the capability of the protocol of automatically flowing
security context without programming. The prime example of this capability is
CORBA CSIv2, which is part of J2EE 1.3 and is supported by RMI-IIOP.
WebSphere Application Server V6 also supports automatic security context
flow over the Web services calls with WS-Security. This is possible because
WebSphere Application Server V6 supports WS-I Basic Security Profile. If the
security context is not automatically propagated by the client container or is
not understood by the server container, there are still options to manually
inject such context into the request flow, but this can lead to an interface bloat
(too many parameters on the interface).
JTA (2PC) support
JTA (2PC) support refers to the capability of propagating Two Phase Commit
(JTA) transaction context automatically over the stack of calls. This concept is
a similar concept to the Security concept described previously but as applied
to the transactions. The difference is that there is no workaround for this if
your server does not support external transactions. RMI-IIOP is capable of
carrying the transaction context, but not all J2EE servers accept external
transactions. Here is the quote from the WebSphere Information Center
article:
WebSphere Application Server is a transaction manager that supports
transactional interoperation with other transaction managers through
either the CORBA Object Transaction Service (OTS) protocol (for
example, application servers) or, for JSR-109 compliant requests, Web
Service Atomic Transaction (WS-AtomicTransaction) protocol. This is in
addition to its ability to coordinate XA resource managers and to be
coordinated by J2EE Connector 1.5 resource adapters.
You can find this quote at the following URL:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topi
c=/com.ibm.websphere.nd.doc/info/ae/ae/tjta_intop.html
In case you decide to use WebSphere MQ as the protocol of choice, you
cannot achieve 2PC for the end-to-end transaction, but you can make your
message send and receive transactional operations and configure
WebSphere MQ for durable transactional messaging. This provides the
assured delivery of messages and split your one logical transaction into at
least two physical transactions: one on the client side and one on the server
side. If you have a need for a rollback of such a logical transaction, you will
have to implement a compensation transaction. For example, you might have
to send a rollback message that will undo the previous action.
30
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Client transaction
This capability refers to the client being able to start/commit/rollback a
transaction on the server, except that in this case, the server transaction is
independent of the client global transaction. For example, if you have an EJB
running in WebSphere Application Server Community Edition that needs to
invoke an EJB running in WebSphere Application Server V6, can this “client”
EJB initiate and commit transactions on the WebSphere side? In this case,
the outcome of the WebSphere transaction has no direct impact on the
current transaction context of the WebLogic EJB.
3.3 Migration planning activities
As part of the migration planning, there is some information to gather in order to
understand its complexity, discover migration issues, and understand the skills
needed to accomplish it. The following activities represent the steps to gather all
the information needed in the migration.
Gathering concerned parties together
Evaluating current assets
Assessing the high-level application architecture
Reviewing and validating the application code
Reviewing the development environment
Reviewing the runtime environment
Reviewing the current build and deployment processes
Assessing current skills
Reviewing time constraints
Creating a detailed migration plan
3.3.1 Gathering concerned parties together
The migration assessment is a good opportunity to bring concerned parties
together. An interesting result of assessment is often a clearer understanding
between the different groups about the larger picture, and a greater appreciation
for the issues faced in other areas. At this time, it is a good idea to define your
project goal and set expectations and measures of success, as well as a time
line and management structure. This phase is no different from that in any
software project.
Chapter 3. Migration strategy and planning
31
3.3.2 Evaluating current assets
To evaluate current assets, assess the current state of the applications targeted
for migration and determine which assets are involved in this migration. Current
assets can include:
Topology
Topology refers to what devices and computers are been used to set up the
applications, the physical layout of each one and the relationship between
them. Assess the current topology and decide if you want to keep it as it is.
This is a good opportunity to decide to change the current topology, taking
advantage of the capabilities of WebSphere Application Server V6.1. For
further details about available topologies, refer to WebSphere Application
Server V6.1: Planning and Design, SG24-7305.
Hardware
Assess the power of the computers involved, processors assigned, storage
needed, and bandwidth used.
Source code
For every application to be migrated, follow this checklist:
–
–
–
–
–
Is it a custom application?
Is it being maintained?
Is it in development process?
Do you have the source code of the application?
Does it use third-party modules? If so, are they supported in the target
environment?
Business processes
Determine the business process related to every application to be migrated.
Measure the allowed downtime of every application and the business areas
using every one of them. If possible, let the most critical applications migrate
late, after you have gained some experience migrating the less critical ones.
Alternatively, it might be a good idea to migrate very simple application first to
gain initial experience and then migrate the most complex part, so that the
rest of the migration effort is more or less a mechanical task. This might be a
very good approach if you hire expensive consultants or mentors for the
beginning of your project and want to finish the bulk of the migration on your
own.
Integration with other products
Assess the applications integrated with other products and the technology
used to integrate. Determine whether that technology is standard and
supported, or if there are another technologies to connect to the other
32
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
product. The main issue to look for here is access to existing systems. That
will be one of the most important issues of the migration.
3.3.3 Assessing the high-level application architecture
With the gathering of concerned parties together comes an excellent opportunity
to articulate the application architecture at a high level. With a clearer view of the
big picture, the stage is neatly set for subsequent parts of the assessment. A
high-level architecture review should not take more than a few hours.
3.3.4 Reviewing and validating the application code
This review is not a full code review. The idea behind this review is to find
potential migration issues, not to determine code quality. Of course, the higher
the quality of the code, the simpler it will be to understand it and to find possible
migration issues. Consider assigning time for the review of the code of the
application. Depending on the complexity of the application, this could take from
one to several days. If possible, include the application architect in the reviews.
Verifying the baseline
Although it should be obvious, we recommend that you first verify that the
application works as expected on the source system: WebSphere Application
Server Community Edition in the case of our book. We applied this strategy to
the examples in this book. It helped us be more productive and perform
migrations more quickly by identifying problems at an early stage. This strategy
also ensures that:
You have collected all of the necessary artifacts.
All the pieces actually work together.
It is a common problem during migration to deal with missing or incorrect
artifacts. If the migration team does not follow this strategy, it might get into
trouble. Applications that need to be migrated can have compile errors, incorrect
build scripts, errors in Deployment Descriptors, invalid XML files, and JSP pages
and many more problems. Using the incorrect artifacts wastes time and
resources.
In some cases, it is advisable to have as little variation between the source and
target environments as possible. For example, if your source application runs on
WebSphere Application Server Community Edition with MySql and your target
environment is WebSphere Application Server V6.1 with DB2 Universal
Database Express Edition V8.2, than we suggest that you make your application
work with DB2 on WebSphere Application Server Community Edition and then
start migrating it into WebSphere.
Chapter 3. Migration strategy and planning
33
Code organization
The organization of the code might sound like a simple matter of order, but it
could take several hours to organize the code to fit it in a logical structure, and
put every source code in the right directory, inside a project. Assess the
organization of the code for every application to be migrated to determine the
need to rearrange the structure. This need is related to the migration strategy
assigned to the application. Code organization is often driven by your build
process, therefore you have to decide if you want to keep your existing build or if
you need a new approach.
Changes to the specifications
The main reason why the migration is possible is that the applications were built
following a standard. The J2EE specification is evolving with time, adding new
functionality and making it more flexible, but those changes have to be followed
by your application in order to stay up-to-date. Gather the versions of each
technology used in every application. This can give you an idea of the changes to
be made to fit the new J2EE specification.
As a second step of your migration, you might want to migrate your application to
J2EE 1.4 to take advantage of the new functionalities of this new specification.
WebSphere Application Server V6.1 has completed the full J2EE certification
test suite, and supports all the J2EE 1.4 APIs. Keep in mind that J2EE 1.4 is
backward-compatible, so you should be able to run your J2EE 1.3 applications
without change.
Pay attention to the applications that were developed for non-compliant
applications servers, or using functionality that is not included in the standard.
Once again, the advice is to follow the standards and make applications flexible
and adaptable.
Use of proprietary technologies
One of the most important issues of the migration is the use of proprietary
technologies. The use of proprietary code will be translated in the need to code
that functionality again. Pay special attention to this point. Assign time to make a
proof of concept for migrating the most difficult technologies. Those proofs of
concept will ease the migration of the actual application.
Third-party libraries
Get information about the use of third-party libraries in every application. Check
the version used, and whether it is supported. Again, the payback of the time
assigned to proofs of concept will be significant in the actual application
migration time.
34
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3.3.5 Reviewing the development environment
After you have all the code reviewed, you have to decide which migration tool
you will use. There are several options available:
Rational Application Developer V7.0 is perhaps the most powerful tool,
because it will help you identify migration issues and solve them. It will also
provide tools and wizards to create new code, or refactor the existing code,
simplifying the tasks of migration and development, adding visual aid to the
creation of the Deployment Descriptors.
You can use your preferred Java editor or IDE, such as Eclipse, IntellyJ IDEA,
SlickEdit, or any other tool. There might be some plugins available for these
tools that can assist you in migrating applications between different vendor
runtimes. Run a Google search to obtain the latest information.
If, for any reason, you decide not to use the IBM provided migration plugin
(perhaps it does not support your source environment), you might want to
write XSLT stylesheets to transform XML Deployment Descriptors of one
vendor into the format of another vendor.
To facilitate writing the XSLT or even to generate it automatically, you might
want to use Rational Application Developer V7.0 provided XML plugin or any
equivalent XML tool as long as it automates the generation of XSLTs and
supports XSL debugging. An example of such a tool is XMLSpy or the Eclipse
plugin for XML called XMLBuddy Pro.
Another important issue is the need for maintaining the history of your changes in
a version control system. If you are planning to use Rational Application
Developer V7.0, make sure that your version control system is supported, like
Rational ClearCase® or CVS, or that you can make Ant scripts to put and
retrieve the changes in your version control system. For further information about
the supported version control systems, refer to Rational Application Developer
V6 Programing Guide, SG24-6449.
3.3.6 Reviewing the runtime environment
As mentioned previously, there is more than one environment to migrate, and
you have to review the current assets to ensure that the existing requirements
are adequate for WebSphere Application Server V6.1. At this stage, it is
important to use all the information related to security requirements in those
environments, such as authorized users, user rights, disk quotas and firewall
configurations.
Chapter 3. Migration strategy and planning
35
3.3.7 Reviewing the current build and deployment processes
The procedure to build and deploy your applications is related to your current
application server requirements. You need to review and change the existing
scripts to build and deploy your applications. The same will be needed with the
scripts used to manage the application servers. In this book, we have used
several different build tools:
Ant-driven build
Maven build
IDE-driven build (in our case, Rational Application Developer V7.0 build as
well as Application Server Toolkit driven)
3.3.8 Assessing current skills
Application developers, architects and administrators can take further advantage
of WebSphere Application Server V6 and Rational Application Developer V7.0
functionalities if they are familiar with those.
Rational Application Developer V7.0 is a very powerful tool that can ease the
development process, so it is a good idea to train your staff in the tool.
Managing WebSphere Application Server V6.1 could be very different from
managing your current application server. While the main concepts are similar,
the details will be different. It can take time for your operators to learn and
understand how to configure and manage WebSphere Application Server V6.1.
As mentioned in the previous section, your operations staff will need to rebuild
the scripts used to manage the application server.
3.3.9 Reviewing time constraints
Not all the applications can be migrated at the same time. Complexity of the
migration, ongoing requirement changes or business needs are constraints to
deal within your planning. Gather the information about the next releases of your
applications, and try to put an intermediate delivery of the migrated application
release or a late delivery of the migrated application with the new features, but
avoid performing the migration and code changes at the same time.
3.3.10 Creating a detailed migration plan
All the previous steps help you to create a detailed plan for your migration. It is
important to have a detailed plan that includes all the previous tasks, with times
in accordance to your applications and business needs.
36
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Instead of a migration project, you might have a migration program planned, with
as many migration projects as you need, including one or more applications in
each project, starting with the less critical ones. This approach can give you the
capability to rectify the plans of the projects involving the most critical ones with
which you will gain more experience. You might need to consider getting
external, experienced help at this point.
3.4 Migration alternatives
The migration is done by first setting up the source environment and then
modifying the application source files, Deployment Descriptors, and properties
so that the application runs in the destination environment. For different
applications, there can be more than one way to migrate because developers
have choices for migration and build tools, Integrated Development
Environments (IDEs), persistence frameworks, databases, and so forth.
In this section, we discuss the different migration alternatives that we selected for
the two sample applications that we discuss in this book—Plants by WebSphere
and Adventure Builder.
Note: We used Alternative 1 for migrating the Plants by WebSphere sample
and Alternative 2 for migrating the Adventure Builder application.
3.4.1 Alternative 1: Developing the migration using Application
Server Toolkit
This alternative follows these steps:
1. We import the EAR file that is ready for deployment in WebSphere
Application Server Community Edition V1.1.0.1.
2. We remove all the WebSphere Application Server Community Edition
V1.1.0.1 deployment plans as well as generated Web service classes from
the imported EAR.
3. We then import the source files into the IDE and into the respective
directories.
4. We compile the source files, generate the Web service bindings, and map the
resources to their JNDI Names in WebSphere Application Server V6.1 Base.
5. We can then deploy the application either by exporting the EAR from
Application Server Toolkit V6.1 and deploying on the server separately or by
Chapter 3. Migration strategy and planning
37
deploying directly from Application Server Toolkit V6.1 into the server from
which we will register it.
Note: The Application Server Toolkit is actually a stripped down version of
Rational Application Developer V7.0. Therefore, when we talk discuss using
Rational Application Developer V7.0 in Alternative 2, the information there
applies to this section also.
3.4.2 Alternative 2: Developing the migration using Rational
Application Developer V7.0
This alternative follows these steps:
1. We import the EAR file that is ready for deployment in WebSphere
Application Server Community Edition V1.1.0.1.
2. We remove all the WebSphere Application Server Community Edition
V1.1.0.1 deployment plans as well as generated Web service classes from
the imported EAR.
3. We then import the source files into the IDE and into the respective
directories.
4. We compile the source files as well as make the mappings using Rational
Application Developer V7.0.
This alternative includes removing all XDoclet annotations for WebSphere
specific Deployment Descriptors and editing these directly through advanced
Deployment Descriptors editors built into Rational Application Developer V7.0.
The J2EE specific Deployment Descriptors can still be generated using Xdoclet.
This is also likely to force change in the project directory structure, build process
and scripts, source code and Deployment Descriptors, but you might keep
frameworks used in the original application if you want.
In some cases, we have seen that cost is considered to be a disadvantage in
Rational Application Developer V7.0 compared to Eclipse or other free tools.
Alternatively, better tools translate into higher development productivity and a
faster return on investment.
Reasons for using this option include:
If you decide to follow the path of using the IDE for your development, there is
no doubt that Rational Application Developer V7.0 is your best choice for
WebSphere Application Server V6.1 - Base. This is because of many
integration points between these two products, such as local and remote
deployment, debugging, configuration, Universal Test Client, specialized
38
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
editors for J2EE generic and WebSphere-specific Deployment Descriptors for
EJB, Web, Web services, and many more capabilities that allow a very
productive development.
We hope that you use Eclipse or another advanced Java development tool for
all alternatives, but there are many useful features and plugins available in
Rational Application Developer V7.0 in addition to Eclipse. These include
advanced XML editors, database tools, UML modelling, excellent JSP and
JSF development tools, version control integration, and too many others to
mention. All of this should increase your development speed.
Even if you are using Rational Application Developer V7.0, you can still use
Ant or Maven for your build process.
Reasons for not using this option include:
To take full advantage of Rational Application Developer V7.0, you might
have to change your project directory structure. This can be time consuming.
The good news is that Rational Application Developer V7.0 is based on
Eclipse, is very flexible and can likely adapt to your current directory structure
with minimum work on your part.
If you use XDoclet to generate your artefacts or if you use other framework
and you import a perfectly working project into Rational Application Developer
V7.0, you might see a lot of error and warning messages. This is because the
validation options in this IDE are not able to verify your file links or class
dependencies. It can take significant effort to fix those errors and messages,
or you might choose to disable some validators to remove those messages.
See Figure 3-1 for an example.
Chapter 3. Migration strategy and planning
39
Figure 3-1 Project validation preferences in Rational Application Developer V7.0
A variation on this alternative is to replace your current persistence model
(whether you use Hibernate, JDO or JDBC) with CMP EJBs. This is likely to
cause additional work and can involve a steep learning curve. There are benefits
of performing application development with Sessions and Entity EJBs, as is
proven by many production projects, yet some authors argue against EJBs. This
might be a decision that is more religious than technical. We suggest that you
keep your options open and use the right tools for the right task.
3.5 Migrating the site
As discussed in 3.1.2, “Migrating the different environments” on page 21, there
are three kinds of environments to migrate. In this section, we talk only about the
runtime environments, such as testing, staging, and production. There are
basically three ways to migrate these kinds of environments.
40
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3.5.1 Switchover migration
In the switchover migration scenario, a separate computer (or cluster) is needed
to install the new environment and then perform the migration. The installation
and migration is performed while the original environment is still in production,
keeping to a minimum the production server downtime at the time of switching
over to the newly migrated environment.
Because the original environment was in production until the last minute, it is up
to date and can be used as the production environment backup if anything goes
wrong during the switchover.
3.5.2 Coexistence migration
If your current set of servers is powerful enough to run two application servers,
this migration scenario could be a viable alternative. Pay special attention to the
ports used by every application server, and configure the new server to use
different ports from the previous installation. In this way, you can have your
current installation running while you configure the new application server, not
needing a second server.
Compared with the switchover migration, this approach has a higher potential
risk of affecting the current production environment because both the original
and the new environments reside on the same physical machine.
3.5.3 Offline migration
This migration scenario has the maximum downtime. The runtime environment
has to be non-operational for the duration of the migration because the idea of
this migration scenario is to replace the current environment with the new one, in
the same server. Typically, this scenario will be used when the server is hosting
a non-critical application or there is no additional hardware available.
3.5.4 Database migration
If you plan to migrate the database, consider performing an initial database
migration to evaluate the time and effort. Database migration can be a simple
task or be even more difficult than the application migration. Several factors will
affect the database migration; some of them are database size, design and
maintenance.
Chapter 3. Migration strategy and planning
41
There are several different tools available for the database migration:
The IBM DB2 Migration Toolkit helps you migrate from Oracle (versions 7, 8i
and 9i), Sybase ASE (versions 11 through 12.5), Microsoft SQL Server
(versions 6, 7, and 2000), Informix® (IDS v7.3 and v9), and Informix XPS
(limited support) to DB2 UDB V8.1 and DB2 V8.2 on Windows, UNIX and
Linux and DB2 iSeries® including iSeries v5r3. The DB2 Migration Toolkit is
available on a variety of platforms including Windows (2000, NT 4.0 and XP),
AIX, Linux, HP/UX and Solaris, for further details visit the following URL:
http://www.ibm.com/software/data/db2/migration/mtk
Migration from MySQL to DB2 is covered in MySQL to DB2 UDB Conversion
Guide, SG24-7093.
Ispirer Systems Ltd. offers the SQLWays migration tool; the demo version is
available for download and has a limit of seven characters in the length of
column names.
http://www.ispirer.com/products
MySQL database has the capability to export to other database formats. For
more information, see this blog posting at the following URL:
http://www.logemann.org/blojsom/blog/default/2005/05/10/why_i_love_M
ySQL_as_developer_database.html?page=comments
If your project is using Hibernate, then you can use Hibernate to migrate to a
new database, because Hibernate can generate the DDL for the specific
database dialect.
3.6 Testing the migrated site
In migrating servers as in developing, testing is one of the most important
activities in the project. Migration is not finished until the new server site
accomplishes all the test cases, which means that you have to migrate the test
cases too. If you do not have test cases, consider creating them and account for
them in your plan.
As you test the migrated site, you might need to go back to previous steps due to
errors found during or after migration, and fix them. Therefore, you need to
assign enough time not only to test the site but to test it again if anything goes
wrong the first time.
Many of the same principles of version-to-version migration apply to the
vendor-to-vendor migration. For further information about version-to-version
migration, refer to WebSphere Application Server V6 Migration Guide,
SG24-6369.
42
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3.7 Going live
After you have migrated and successfully tested your new environment, it is time
to put it in production. Whichever migration scenario you choose, you will likely
need to go offline to stop the transactions on your database and possibly migrate
its data.
In some cases, it might be possible to deploy the new application against the live
production database, run production workload in parallel by spraying requests
across two instances of the application running in different environments and,
when you are sure it works well, you can shut down your old environment and
handle the entire workload with the new runtime.
Building highly available systems is a big topic. Refer to WebSphere Application
Server V6 Scalability and Performance Handbook, SG24-6392 for further details.
Chapter 3. Migration strategy and planning
43
44
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4
Chapter 4.
Installing and configuring
the products for the
migration
In this chapter, we provide an overview of the environment that the migration
examples use and describe the hardware and software used. We also explain
how to install and configure the IBM products used in the migration. The
information that we present here is not intended to be a detailed installation
guide. It does, however, provide a step-by-step description of how we installed
the products for the migration examples that we explain in this book and allows
you to follow these examples.
For detailed installation instructions and prerequisites, refer to the product
documentation. “Related publications” on page 495 provides a list of additional
literature and online resources.
This chapter is organized into the following sections:
Hardware and software installed
Installing WebSphere Application Server V6.1
Launching the WebSphere Administrative Console
Installing Rational Application Developer V7.0
Administrative scripting
Installing DB2 Universal Database Express Edition V8.2
© Copyright IBM Corp. 2007. All rights reserved.
45
Installing WebSphere Application Server Toolkit V6.1
Installing WebSphere Application Server Community Edition
Eclipse Web Tools Platform V1.5.2
XDoclet 1.2.3
WebSphere Application Server Community Edition Eclipse Plugin 1.1.0.1
Java Web Services Developer Pack 2.0
Apache Ant 1.7.0
Installation directories
4.1 Hardware and software installed
This list describes the environment that we built as a destination environment for
all the examples that we present in this book and highlights the hardware and
software that we used to build our ITSO migration labs:
46
Intel Xeon® CPU 3.20 GHz processor, 2 GB RAM and a 33.8 GB HDD
Microsoft Windows 2003 Standard Edition with Service Pack 1 Build 3790
Microsoft Internet Explorer® V 6.0.3790.1830
Rational Application Developer V7.0
WebSphere Application Server V6.1 - Base
DB2 Universal Database V8.2, Express Edition
WebSphere Application Server Community Edition 1.1.0.1
Eclipse Web Tools Platform V1.5.2
XDoclet 1.2.3
WebSphere Application Server Community Edition Eclipse Plugin 1.1.0.1
Java Web Services Developer Pack 2.0
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4.2 Installing WebSphere Application Server V6.1
Although Rational Application Developer V7.0 includes WebSphere Application
Server V6.1 as an integrated test environment, some migration examples that we
discuss later in this book do not use Rational Application Developer V7.0 as part
of the migration process and only make use of WebSphere Application Server
V6.1.
This section describes the steps to install WebSphere Application Server V6.1 Base.
Note: WebSphere Application Server V6.1 allows you to have multiple
installations of the same, and previous, WebSphere Application Server
releases in the same system. For details about installation options and
topologies, refer to WebSphere Application Server V6.1: Planning and Design,
SG24-7305.
Before you start, make sure that you perform the installation with a user that
belongs to the Administrators group and that has the following advanced user
rights to ensure the correct installation of WebSphere Application Server V6.1:
To act as part of the operating system
To log on as a service
You can download a trial version of WebSphere Application Server V6.1 from the
following URL:
http://www-128.ibm.com/developerworks/downloads/ws/was/?S_TACT=105AGX28
&S_CMP=DLMAIN
Chapter 4. Installing and configuring the products for the migration
47
To install WebSphere Application Server V6.1, follow these steps:
1. Run the launchpad.exe file for WebSphere Application Server V6.1. A
welcome window opens (Figure 4-1).
2. Click Launch the installation wizard for WebSphere Application Server.
Figure 4-1 The Welcome window for WebSphere Application Server V6.1
48
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. A welcome message displays (Figure 4-2). Click Next to continue.
Figure 4-2 Welcome message
4. When the license window opens, read and accept the terms of the license
agreement, and click Next (Figure 4-3).
Figure 4-3 License Agreement window
Chapter 4. Installing and configuring the products for the migration
49
5. A new window opens and informs you of the successful check of the system
requirements (Figure 4-4). Click Next to continue.
Figure 4-4 System prerequisites check
50
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. At this point, the installation program asks you to Install the Sample
Applications (Figure 4-5). We will not install the sample application as one of
the applications that we migrate from WebSphere Application Server
Community Edition to WebSphere Application Server V6.1. So accept the
default and click Next.
Figure 4-5 Option to install sample applications
Chapter 4. Installing and configuring the products for the migration
51
7. Choose an installation directory and click Next (Figure 4-6). We installed
WebSphere Application Server V6.1 in the default directory.
Figure 4-6 Installation directory path
52
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. A new windows opens that allows you to Enable Administrative Security
(Figure 4-7). By default, the Enable administrative security check box is
selected. Clear this check box now, because you will enable administrative
security later from the Administrative Console.
Figure 4-7 Enable Administrative Security window
Chapter 4. Installing and configuring the products for the migration
53
9. A confirmation window opens with a description of the products and features
to install (Figure 4-8). Verify the summary information, and click Next to start
the installation.
Figure 4-8 Installation Summary window
54
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.Installation begins. A confirmation window opens and informs you that
WebSphere Application Server V6.1 installed successfully (Figure 4-9). Click
Finish.
Figure 4-9 Successful installation
Chapter 4. Installing and configuring the products for the migration
55
11.The First steps window opens (Figure 4-10). You can verify the installation,
start the server, and stop a running server using this window. You can launch
this window later by selecting Start → All Programs → IBM WebSphere →
Application Server v6.1 → Profiles → AppSrv01 → First steps.
Figure 4-10 First steps for WebSphere Application Server V6.1 - Base
4.2.1 Installing the latest fix pack
After you have installed WebSphere Application Server V6.1, you need to check
for updates of the product. You can find the latest updates for WebSphere
Application Server at:
http://www.ibm.com/software/webservers/appserv/was/support
At the time of writing, the latest fix available was the 6.1.0.5, so the following
steps describe how to install that fix. These steps are basically the same for
every installation but might not be exactly the same for future versions.
Nevertheless, you can find detailed instructions to install the fix pack when you
download it.
56
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
To install the fix pack:
1. Update Installer is required to install the fix pack.The Update Installer is not
packaged as part of the fix pack download. You need to acquire it separately.
You can download Update Installer to install this fix pack from:
http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg24012718
2. Click Next on the welcome window of Installation Wizard for the Update
Installer V6.1.0.1.
3. In the next window, select I accept both the IBM and the non-IBM terms
and click Next.
4. Review and verify the system prerequisites. Confirm if the check completed
successfully and click Next.
5. In the Installation directory window, select the directory where WebSphere
Application Server is installed.
6. Verify the installation summary and click Next.
7. After installation is complete, clear Launch IBM Update Installer for
WebSphere Software on exit and click Finish.
8. Now the Update Installer is installed in the following directory.
C:\Program Files\IBM\WebSphere\UpdateInstaller
9. Download the fix pack from:
http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg24014336
Put the fix pack to C:\Program
Files\IBM\WebSphere\UpdateInstaller\maintenance.
10.Launch the Update Installer from Start → All Programs → IBM
WebSphere → Update Installer for WebSphere V6.1 Software → Update
Installer.
11.After a few moments, a welcome page displays. Click Next.
12.In the next window, select which installation of WebSphere Application Server
you want to update. For our example, we selected the following directory
because this is the directory where we install WebSphere Application Server
V6.1:
C:\Program Files\IBM\WebSphere\AppServer
Click Next.
13.A new window opens in which you have to select the maintenance operation.
Select Install maintenance package and click Next.
Chapter 4. Installing and configuring the products for the migration
57
14.At this point, you have to browse to the location of
6.1.0-WS-WAS-WinX32-FP0000005.pak and select the maintenance
package file to install. Click Next.
15.A summary of maintenance packages to be installed is shown on the next
window. Click Next to begin the installation.
16.A new window opens, informing you of the success of the previous operation.
Click Finish to close the Update Installer. You can click Relaunch if you need
to install more fix packs.
4.2.2 Understanding WebSphere profiles
Before you start working with WebSphere Application Server V6.1, you need to
understand the concept of WebSphere profiles. WebSphere Application Server
V6.1 has the ability to run multiple instances on a single computer using a single
WebSphere installation. This instance of the WebSphere Application Server are
called WebSphere profiles.
When you install WebSphere Application Server V6.1, the product files have two
components:
A set of shared read-only product static files or product binaries to be shared
by any functional instance of the WebSphere Application Server product.
A user data set of configurable files that are customized. These files are
called WebSphere profiles. User data includes WebSphere Application
Server configuration, application servers, installed applications, properties,
logs, and so on.
Each profile has a separate configuration but still uses a single installation of the
WebSphere binaries. Each profile is distinguished by its base path, its own
directory structure, and its own setupCmdLine script to configure its command
line environment.
WebSphere profile support provides:
The ability to create different user data (WebSphere profiles) and run multiple
instances of WebSphere Application Server sharing the product binaries.
WebSphere profiles that define a functional instance of the server.
The ability to have multiple profiles running on the same shared product
binaries.
58
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Profile templates that you can use to create different server profiles.
–
–
–
–
Application Server Profile
Deployment Manager Profile
Custom profile
Cell Profile
Advanced users can tweak existing profile templates to create new profile
instances.
Note: The different types of WebSphere profiles (Application Server,
Deployment Manager, Custom, and Cell) are only available through
WebSphere Application Server V6.1 - Network Deployment. WebSphere
Application Server V6.1 - Base provides only one type of
profiles—Application Server.
A command line tool, wasprofile, that you can use to create additional
WebSphere profiles based on templates.
WebSphere Application Server V6.1 - Base also provides a default application
server profile that is created as part of the product install process, which is not
the case when you are installing WebSphere Application Server V6.1 - Network
Deployment.
Creating new WebSphere profiles
As mentioned previously, WebSphere Application Server V6.1 allows the
creation of different profiles within a single installation. You might want to create
different profiles to test and run different applications and to isolate their possible
issues during the migration. In our migration examples, we created new
WebSphere profiles as we were testing and deploying applications at different
stages of the migration.
To create a new WebSphere profile, follow these steps:
1. To create a new profile, we use the profile creation wizard. You can launch
the wizard in two different ways, depending on the software that you have
installed (that is, having installed WebSphere in addition to Rational):
– From WebSphere Application Server:
Click Start → All Programs → IBM WebSphere → Application Server
V6.1 → Profile Management Tool.
– From Rational Application Developer V7.0:
Within the Rational workspace, click in the top menu Window →
Preferences → Server → WebSphere and click Create Profile.
Chapter 4. Installing and configuring the products for the migration
59
Note: You could also create profiles using the command line profile tool
found at <was_home>\bin\manageprofiles.bat. For more information about
profiles in WebSphere, see:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?to
pic=/com.ibm.websphere.nd.doc/info/ae/ae/rxml_manageprofiles.html
2. When the profile creation wizard starts, click Next in the Environment
Selection window.
3. Select Typical Profile Creation In the Profile Creation Options window. Click
Next.
4. Clear Enable Administrative Security in the next window and click Next.
5. Review the profile creation summary and click Create.
6. When the profile is created successfully, click Finish.
When you use WebSphere Application Server V6.1 - Base, you can have a
single binary installation of the Application Server, and you can create multiple
profiles. Each profile has a single server defined, and the name of that server is
always server1. If you use WebSphere Application Server V6.1 - Network
Deployment, you can create multiple servers with different names in a single
profile.
4.2.3 Launching the WebSphere Administrative Console
The WebSphere Administrative Console is a Web-based interface that provides a
graphical interface for managing and configuring your servers. It provides
multiple wizards, with entry validation and other facilities and administration aids,
that translate all the settings in the corresponding configuration files, so you do
not have to edit any XML configuration files manually.
From the Administrative Console, you can install, uninstall, start, and stop
servers and applications. WebSphere Application Server V6.1 also provides
administrative scripts through the wsadmin client. Administrative scripts might
be the tool of choice, in production environments, for installing and administering
applications and servers.
For our migration examples, we use the Administrative Console for all our
administrative tasks.
To launch the Administrative Console, make sure that you have the application
server (server1) up and running. You can start the server by clicking Start → All
60
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Programs → IBM WebSphere → Application Server V6.1 → Profiles →
AppSrv01 → Start the Server.
Open a Web browser and access the Administrative Console through the
following URL:
http://localhost:9060/ibm/console
When the Administrative Console login first opens, there is no security
configured. So, you can enter any user name. This user name is used to keep a
session with your Web browser. See Figure 4-11.
Figure 4-11 WebSphere Application Server V6.1 Console Login window
Note: It is important that you log out before closing the Administrative
Console. Otherwise, it can cause a login conflict the next time that you log in
with the same user name.
Chapter 4. Installing and configuring the products for the migration
61
After you are logged in to the Administrative Console, a new window opens as
shown in Figure 4-12. From this window, you can install applications, start and
stop servers and applications, configure JDBC providers and data sources, and
perform all the necessary administrative tasks.
Figure 4-12 WebSphere Application Server V6.1 Console first window
4.2.4 Managing the application servers
In this section, we provide a high-level overview of the basic administration
functions that you can perform using the WebSphere Administrative Console.
The intent of this section is to give you the very first tools to deploy your
applications and control the status of the server and the applications. For more
information about the administrative operations that are available in the
Administrative Console, refer to WebSphere Application Server V6.1: System
Management and Configuration, SG24-7304.
62
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
When you are logged in to the Administrative Console, you can manage and
configure your server. The most basic operations that you can perform inside of
the application server are:
Verifying the server status and configuration
Installing applications
Managing applications
Verifying the server status and configuration
To verify the server status and configuration from the Administrative Console,
click Servers → Application Server.
A list of the existing servers displays, showing the name of the server, the node
in which it is defined, and the version of it. Click server1 to go to the detailed
information for this server.
You should see the configuration of the server, where you can select and change
the settings of the EJB container, the Web container, and the messaging engines
among others.
By clicking the Runtime tab, you can see the status of the server and other
additional properties for the server.
Installing applications
During the migration and development process, you can install your applications
using Rational Application Developer V7.0 functionalities. However, for some
migration examples, we did not use Rational tools. For those scenarios, we
provide the high-level steps for installing applications using the Administrative
Console:
1. After you are logged in the Administrative Console, click Applications →
Install New Application.
2. Specify the path of the file where your application is and click Next.
3. From this point, you go through several steps of configuration, depending on
the Deployment Descriptors that are included in your application and the
features that are needed. Follow the steps of the configuration, providing the
necessary information to configure your application, and then click Finish at
the last step.
4. Click Save and, when prompted, click Save to the master configuration.
5. After you complete the installation of the application, the Administrative
Console shows a list with the installed applications. You can start the new
application by selecting it and clicking Start.
Chapter 4. Installing and configuring the products for the migration
63
These operations are just the first steps of the administration. You will need to
define more configuration settings in your applications. We describe the
configuration settings of the applications that we migrated as needed in the
platform-specific chapter:
Chapter 6, “Migrating WebSphere Application Server CE to WebSphere
Application Server” on page 145
Chapter 7, “Developing the application on WebSphere Application Server
Community Edition” on page 221
Chapter 8, “Migrating Adventure Builder to WebSphere Application Server” on
page 347
Managing applications
The basic operations that you can perform on applications are install, uninstall,
start, stop, update, rollout update, remove file, export, and export DDL. In the
WebSphere Administrative Console, these options are available from
Applications → Enterprise Applications.
The status of the applications can be:
Started
Partial Start
Stopped
Partial Stop
Unavailable
Not applicable
To review or modify an application’s configuration, just click the application
name.
4.3 Installing Rational Application Developer V7.0
In this section, we show how we installed and configured Rational Application
Developer V7.0. For our examples, we installed WebSphere Application Server
as an integrated test environment. This way, you can start and stop your
application server from Rational Application Developer V7.0, as well as deploy
applications and debug the applications that are running on it.
You can download a trial version of Rational Application Developer V7.0 at the
following URL:
http://www-128.ibm.com/developerworks/downloads/r/rad/?S_TACT=105AGX15&
S_CMP=LP
64
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
To install Rational Application Developer V7.0, following these steps:
1. Run the launchpad.exe for Rational Application Developer V7.0. The window
shown in Figure 4-13 opens.
2. Select IBM Rational Application Developer V7.0.
Figure 4-13 Launch pad for Rational Application Developer V7.0
Chapter 4. Installing and configuring the products for the migration
65
3. A welcome window displays to install the Installation Manager. You install
Rational Application Developer V7.0 through the Installation Manager, so you
begin the installation by install Installation Manager first. Click Next.
4. When the license window opens (Figure 4-14), read and accept the terms of
the license agreement, and click Next.
Figure 4-14 License Agreement window
66
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. For the destination folder, click Next to install the Installation Manager in
default directory (Figure 4-15). You can click Change if you want to use
another directory. We chose the default location for out installation.
Figure 4-15 Installation directory path
Chapter 4. Installing and configuring the products for the migration
67
6. In the next window, click Install to begin the installation of Installation
Manager (Figure 4-16).
Figure 4-16 Starting the installation
68
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. When the installation has completed, a message displays. Click Finish
(Figure 4-17).
Figure 4-17 Successful installation of Installation Manager
Chapter 4. Installing and configuring the products for the migration
69
Now that the installation of Installation Manager is complete, a wizard to
install Rational Application Developer V7.0 starts.
8. The next window lists the packages to be installed (Figure 4-18). Click Next.
Figure 4-18 Choose the packages to install for Rational Application Developer V7.0
70
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9. Read and accept the terms of the license agreement (Figure 4-19), and click
Next.
Figure 4-19 License agreement
Chapter 4. Installing and configuring the products for the migration
71
10.Next, you can select the directory for shared resources (Figure 4-20). We
chose the default directory. Click Next.
Figure 4-20 Installation directory for shared resources
72
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
11.The next window displays the name of the package group and location of the
package (Figure 4-21). Rational Application Developer V7.0 is located under
this package.
Figure 4-21 Installation directory for Rational Application Developer V7.0
Chapter 4. Installing and configuring the products for the migration
73
12.In Figure 4-22, you can use already existing eclipse. We use the default
option.
Figure 4-22 Install Packages window
74
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
13.In Figure 4-23, you select the languages to install. English is selected by
default. Click Next.
Figure 4-23 Languages to install
Chapter 4. Installing and configuring the products for the migration
75
14.Next, you select the features to install (Figure 4-24). We chose Data Tools
along with other default features. Scroll down the window and select Data
Tools and click Next.
Figure 4-24 Features to install
76
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.A confirmation window displays with a description of the products and
features to be installed. Verify the summary information, and click Install to
start the installation (Figure 4-25).
Figure 4-25 Installation summary
Chapter 4. Installing and configuring the products for the migration
77
16.A confirmation window displays and informs you of the successful installation
(Figure 4-26). Select None and click Finish.
Figure 4-26 Successful installation
At this point, Rational Application Developer V7.0 is installed and WebSphere
Application Server V6.1 is also installed as an integrated test environment.
4.3.1 Installing any interim fixes
After you have installed Rational Application Developer V7.0, you can look for
new updates using the Rational Product Updater. You can install the fixes online
or offline. The offline installation is recommended when you have more than one
installation to update, because you download the Rational Product Updater once
and then install it as many times as needed. The offline installation requires you
to run an additional configuration step. This section describes the steps to update
Rational Application Developer V7.0 online.
78
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Using the online update
You can update the Rational Application Developer V7.0 through the Installation
Manager. To install the Rational Application Developer V7.0 interim fix online,
follow these steps:
1. Start the Installation Manager. Click Start → All Programs → IBM
Installation Manager → IBM Installation Manager.
2. In the first window, you see an option to Install Packages, Update Packages,
Modify Packages, Manage Licenses, and Uninstall Packages. Click Update
Packages. It will take some time before the next windows opens.
3. A window displays all the packages that are installed. Select Update All and
click Next.
4. A license agreement window opens. Read and accept the terms of the license
agreement, and click Next.
5. An update summary displays. Click Update to begin the update. Depending
on your connection speed, this operation could take several minutes. You can
see the progress in the status bar and can pause the download of updates if
required.
6. When the updates are installed, the main window shows all the updates that
you installed. Also, you can see the log file.
7. Exit the IBM Installation Manager by clicking Finish.
4.3.2 Testing the application server
With Rational Application Developer V7.0, you can manage the WebSphere
Application Server V6.1 from the development environment, but you can also run
administration commands from the command line if you like. WebSphere
Application Server V6.1 is installed inside of the Rational Application Developer
V7.0 installation directory in the following path:
<rad_home>\runtimes\base_v61
When using Rational Application Developer V7.0 in any of our migration projects,
we refer to this installation directory as <rad_was_home>.
WebSphere Application Server V6.1 uses WebSphere profiles to group user data
and configuration. These WebSphere profiles share the same binaries from the
WebSphere Application Server V6.1 installation but can be distinguished from
one another by their different home directories. (We explained WebSphere
profiles in detail in 4.2.2, “Understanding WebSphere profiles” on page 58.)
By default, a new profile is created during the product installation. This default
WebSphere profile defines a single application server called server1 that runs as
Chapter 4. Installing and configuring the products for the migration
79
a stand-alone server and that is configured within Rational Application Developer
V7.0. You can use this server, or you can define another WebSphere profile and
server to test and run your applications. For our examples, we used the default
WebSphere profile.
This default WebSphere profile is located in the following directory structure:
<rad_was_home>\profiles\AppSrv01
Within this directory structure, the subdirectories we reference the most are:
bin
In this directory, you find administrative commands for the profile. System
administration commands are now profile-specific, so you must execute the
commands from their particular profile/bin directory.
logs
Inside the logs directory, you find one directory per server that includes the
log files for each profile. This directory is created only after you start the
server for the first time. The SystemErr.log and SystemOut.log files are in this
directory, as well as the serverStatus and the trace log files. So if you need to
find the logs for server1, you have to go to the following directory:
<rad_was_home>\profiles\AppSrv01\server1
config
Within this directory, you find all the configuration files.
Verifying the configuration
From the Rational Application Developer V7.0 Servers tab, you find the defined
server referenced as WebSphere Application Server V6.1.
If you double-click this link, a new view opens with an overview of the server
where you can verify the settings of the server.
Starting the server
You can start the server using the Rational Application Developer V7.0 interface
or the command line:
To start the application server from the command line, run the startServer
command located in the following directory:
C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\bin
The startServer command must receive as a parameter the following server
name:
startServer server1
80
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
To start the server from Rational Application Developer V7.0, go to the
Servers view, right-click the server that you want to start, and then select
Start.
Verifying the server status
If you are running Rational Application Developer V7.0, you can see the server
status in the Servers view in the Status column, as shown in Figure 4-27.
Figure 4-27 Server tab in Rational Application Developer V7.0
If you are not using Rational Application Developer V7.0 or prefer to use the
command line, you can run the following command:
serverStatus server1
Alternatively, you can run the same command with the -all parameter to verify
the status of all the servers for that specific profile:
serverStatus -all
Note: When using WebSphere Application Server V6.1 - Base, you can
configure only one application server for each profile, but you can still create
as many profiles as you need. When using WebSphere Application Server
V6.1 - Network Deployment, you can create several application servers within
the same profile. In the Network Deployment version, you can still create
multiple profiles containing multiple application servers.
Chapter 4. Installing and configuring the products for the migration
81
Stopping the server
Similarly as with starting the server, you can stop the server using the Rational
Application Developer V7.0 interface or the command line:
To stop the application server from the command line, run the stopServer
command located in the following directory:
C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\bin
The stopServer command must receive as a parameter the following server
name:
stopServer server1
To stop the server from Rational Application Developer V7.0, go to the
Servers view, right-click the server that you want to stop, and then select
Stop.
4.3.3 Using Universal Test Client
When you install Rational Application Developer V7.0, you see that it includes a
tool called Universal Test Client (UTC). This client is a Web application that you
can use to test your EJBs.
We installed Rational Application Developer V7.0 after WebSphere Application
Server. Thus, the Web server port number of server1 in Rational Application
Developer V7.0 is 9081. This server needs to be running to see the UTC
application.
82
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
To start the UTC, open a Web browser and enter the following URL:
http://localhost:9081/UTC
The Universal Test Client opens, as shown in Figure 4-28.
Figure 4-28 Universal Test Client Welcome page
You can click the JNDI Explorer link to view all the published resources and test
them. At this point, running the UTC is just another way of verifying that your
application server is installed and running properly.
Chapter 4. Installing and configuring the products for the migration
83
You can also use the UTC directly from the Rational Application Developer V7.0
IDE to test EJB projects. Follow these steps:
1. From the Project Explorer in the J2EE perspective, right-click the EJB Project
that you want to test inside of the EJB Projects folder, then select Run → Run
on Server.
2. When the Server Selection dialog box opens, select WebSphere
Application Server V6.1 and click Finish. The server is started and the EJB
project is deployed, if necessary.
3. When the UTC welcome page opens, you can click JNDI Explorer and
navigate it, looking for EJBs to test.
We used this tool during the migration to test the correct migration of the EJB
projects before starting with the migration of the Web projects. You can use this
tool during your migration or development process to perform a unit test of your
EJBs.
4.4 Administrative scripting
WebSphere Application Server V6.1 supports the scripting of administrative
tasks, including installation, configuration, deployment, and runtime operations.
The scripts are executed with the wsadmin scripting client and can be written in
one of the following languages:
JACL
TCL-based scripting language
Jython
Python implemented in Java
WebSphere Application Server V6.1 represents the start of the deprecation
process for the JACL syntax. If you have existing JACL scripts and would like to
start migrating to Jython, the Application Server Toolkit V6.1 provides a
tool—Jacl2Jython—that converts the JACL scripts to Jython.
The administrative scripts have access to the following WebSphere Application
Server V6.1 objects:
AdminControl
Includes commands for invoking and querying server objects.
AdminConfig
Allows you to manage the server configuration.
84
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
AdminApp
Used for managing applications.
AdminTask
Includes commands for running administrative commands, such as creating a
cluster.
Help
Used for displaying help.
Tip: WebSphere Application Server V6.1 also includes Ant tasks that you can
use to automate administrative tasks to run scripts. For more information
about Ant tasks, refer to the WebSphere Application Server V6.1 Information
Center at:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topi
c=/com.ibm.etools.ant.tasks.doc/topics/tjant.html
WebSphere Application Server V6 includes a batch script for running Ant:
<was_home>\bin\ws_ant.bat or in <profile_home>\bin\ws_ant.bat
The script includes the WebSphere Application Server V6.1 classes.
The scripts are executed with the wsadmin tool. The wsadmin tool is located in:
<was_home>\bin or <profile_home>\bin
For further information and examples of scripting, refer to the WebSphere
Application Server V6.1 Information Center at:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/
com.ibm.websphere.base.doc/info/aes/ae/txml_script.html
You can also download sample administration scripts from:
http://www.ibm.com/developerworks/websphere/library/samples/SampleScrip
ts.html
4.4.1 Examples of administrative scripting features
In this section, we provide two basic examples of how to use the administrative
scripting features in WebSphere Application Server V6.1.
Note: You must edit the scripts to match the names of the WebSphere
Application Server V6.1 cell, node, and server in your environment.
Chapter 4. Installing and configuring the products for the migration
85
Generating a thread dump
Thread dumps are useful when debugging, for example, thread locks and
memory leaks. The script shown in Example 4-1 generates a thread dump for the
WebSphere Application Server V6 instance server1.
Example 4-1 JACL script for generating a thread dump
set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]
$AdminControl invoke $jvm dumpThreads
Follow these instructions to run the script in Example 4-1:
1. Save the script to:
<was_home>\profiles\<profile_name>\bin\threadDump.jacl
2. Execute the script with the following command:
wsadmin.bat -f threadDump.jacl
You should see the log message shown in Example 4-2.
Example 4-2 Log message from the wsadmin tool
WASX7209I: Connected to process "server1" on node blade18Node01 using
SOAP connector; The type of process is:
UnManagedProcess
3. The tool generates a thread dump in the profile’s root directory:
<was_home>\profiles\<profile_name>\javacore.20070221.145211.3416.txt
Starting the deployed application
Example 4-3 shows a more complete script that demonstrates how to start an
application in WebSphere Application Server V6. It also demonstrates the use of
arguments and other common scripting tasks.
Example 4-3 JACL scripting example showing how to start an application
proc startApplication {applicationName} {
global AdminControl
set cellName "blade18Node01Cell"
set nodeName "blade18Node01"
set processName "server1"
puts "Starting application '$applicationName'"
set applicationManager [$AdminControl queryNames
cell=$cellName,node=$nodeName,type=ApplicationManager,process=$processN
ame,*]
if {$applicationManager == ""} {
86
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
puts "Application manager not found"
} else {
$AdminControl invoke $applicationManager startApplication
$applicationName
}
}
#===============
#
Main method
#===============
if { !($argc == 1) } {
puts "Please specify the application name"
} else {
set applicationName
[lindex $argv 0]
startApplication $applicationName
}
Follow these instructions to run the script shown in Example 4-3:
1. Save the script to:
<was_home>\profiles\<profile_name>\bin\startApp.jacl
2. Execute the script with the following command:
wsadmin -f startApplication.jacl “application_name”
4.5 Installing DB2 Universal Database Express Edition
V8.2
This section covers the steps that we followed to install and configure DB2
Universal Database™ Express Edition V8.2. For further installation and
configuration instructions for DB2, refer to the DB2 Information Center at:
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp
You can download DB2 Universal Database V8.2 Express Edition from:
http://www.ibm.com/developerworks/downloads/im/udbexp
Before you start, make sure that you perform the installation with a user that
belongs to the Administrators group and with the authority to create users and
groups.
Chapter 4. Installing and configuring the products for the migration
87
To install DB2 Universal Database Express Edition V8.2, follow these steps.
1. Run the setup program. You see a window similar to Figure 4-29. In the setup
launchpad window, select Install Product.
Figure 4-29 Launch pad for DB2 Universal Database Express Edition V8.2
88
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. Select DB2 UDB Express and click Next (Figure 4-30).
Figure 4-30 Select the products to install
Chapter 4. Installing and configuring the products for the migration
89
3. Click Next in the welcome window.
4. In the license agreement page, read and accept the terms of the license
agreement and click Next (Figure 4-31).
Figure 4-31 License Agreement window
90
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Select Typical installation and click Next (Figure 4-32).
Figure 4-32 Type of installation
Chapter 4. Installing and configuring the products for the migration
91
6. Select a drive and a directory where you will install the files, and click Next
(Figure 4-33). For our example, we installed DB2 Universal Database
Express Edition V8.2 in the default directory C:\Program Files\IBM\SQLLIB\.
Figure 4-33 Installation directory path
92
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. Next, you need to provide information for the administration server. Select
Local system account and select Use the same user name and password
for the remaining DB2 services, as shown in Figure 4-34.
Figure 4-34 User information for DB2 Administration Server
If you are using an existing user, make sure this user has the authority to
perform the following actions:
–
–
–
–
–
–
–
Act as part of the operating system
Debug programs
Create token object
Increase quotas
Lock pages in memory
Log on as a service
Replace a process level token
Otherwise, you can use a brand new user name and password and the
installation program will create that user with all appropriate privileges. If the
user that you insert exists but does not have the privileges, it will be granted
these privileges. In this case, you will need to log on with this account to make
all those privileges effective.
8. Click Next.
Chapter 4. Installing and configuring the products for the migration
93
9. Click Next to accept the default DB2 instance (Figure 4-35).
Figure 4-35 DB2 instances
94
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.The installer displays a summary of the products and features to be installed.
Verify that this summary is correct and click Install to start the installation
process, as shown in Figure 4-36.
Figure 4-36 Installation summary
Chapter 4. Installing and configuring the products for the migration
95
11.After the installation process is complete, you see a window similar to
Figure 4-37. Click Finish.
Figure 4-37 Successful completion of Installation
96
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
12.A confirmation window opens, informing you that DB2 was successfully
installed. Click Finish to exit the setup.
Figure 4-38 First steps for DB2
13.The First Steps window is launched and displays a successful Installation.
Click Exit First Steps.
4.6 Installing WebSphere Application Server Toolkit
V6.1
This section covers the steps to install and configure the WebSphere Application
Server Toolkit V6.1. WebSphere Application Server Toolkit kit is provided to
customers who purchase WebSphere Application Server.
Before you start, make sure you perform the installation with a user that belongs
to the Administrators group and that has the authority to create users and
groups.
Chapter 4. Installing and configuring the products for the migration
97
To install Application Server Toolkit V6.1, follow these steps:
1. Go to the Application Server Toolkit V6.1 directory and click launchpad.exe.
2. Click Launch the installation wizard for the Application Server Toolkit
(Figure 4-39).
Figure 4-39 Launch pad windows for Application Server Toolkit V6.1
98
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. At the welcome window, click Next. Read and accept the license agreement,
and click Next (Figure 4-40).
Figure 4-40 License Agreement window
4. Select the installation directory (Figure 4-41). For our example, we chose the
default location. Click Next to continue.
Figure 4-41 Installation directory path
Chapter 4. Installing and configuring the products for the migration
99
5. Review the installation summary (Figure 4-42). Click Next to begin the
installation.
Figure 4-42 Installation summary
6. After the installation completes, click Finish to exit the installation wizard.
Figure 4-43 Successful installation of toolkit
100
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. You can launch the Application Server Toolkit V6.1 by clicking Start → All
Programs → IBM WebSphere → Application Server Toolkit V6.1 →
Application Server Toolkit.
4.7 Installing WebSphere Application Server
Community Edition
WebSphere Application Server Community Edition is a free, lightweight Java 2
Platform Enterprise Edition (J2EE) application server built on Apache Geronimo
technology. Available at no charge, it harnesses the latest innovations from the
open source community to deliver an integrated, readily accessible and flexible
foundation for developing and deploying Java applications.
WebSphere Application Server Community Edition is built on Apache Tomcat
and other best-of-breed open source software such as OpenEJB, Apache Axis,
and IBM Cloudscape (based on Apache Cloudscape)
You can download WebSphere Application Server Community Edition at:
http://www-128.ibm.com/developerworks/downloads/ws/wasce/?S_TACT=105AGX
10&S_CMP=WESDL
You can view the WebSphere Application Server Community Edition V1.1
documentation at:
http://publib.boulder.ibm.com/wasce/V1.1.0/en/index.html
To install the IBM 32-bit Software Development Kit (SDK) for Java 2 V5.0 and
WebSphere Application Server Community Edition, follow these steps:
1. First, install the IBM 32 bit SDK for Java 2 V5.0. Run
ibm-java2-sdk-pwi32devifx-20061016.exe. In our example, we launched this
executable from the following directory:
C:\Software\WAS CE v1.1\wasce_ibm150sdk_setup-1.1.0.1-ia32win
2. Select English(United States) and click OK (Figure 4-44).
Figure 4-44 Language of installation
Chapter 4. Installing and configuring the products for the migration
101
3. Click Next on the welcome window.
4. Read the license agreement and click Yes to accept it.
5. Select a destination folder. In our example, we selected the default
installation directory path. Click Next to continue. See Figure 4-45.
Figure 4-45 Installation directory path
102
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Click Typical setup type for install and click Next, as shown in Figure 4-46.
Figure 4-46 Type of installation
7. You see a window similar to Figure 4-47. Click Yes.
Figure 4-47 Installing the Java Runtime Environment as the System JVM™
Chapter 4. Installing and configuring the products for the migration
103
8. Review the current settings and click Next to begin the installation, as shown
in Figure 4-48.
Figure 4-48 Installation directory path
9. After the installation completes, click Finish.
104
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.You see a window similar to Figure 4-49. Click Next.
Figure 4-49 Welcome window of WebSphere Application Server Community Edition
11.Now that you have installed IBM 32-bit SDK, you next install WebSphere
Application Server Community Edition. Run wasce_setup-1.1.0.1-win.exe. In
our example, this executable is in the same folder as the IBM SDK.
12.Read and accept the terms of License Agreement and click Next.
Chapter 4. Installing and configuring the products for the migration
105
13.Accept the default location for installation and click Next, as shown in
Figure 4-50.
Figure 4-50 Installation directory path
106
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
14.Review the installation summary and click Install (Figure 4-51).
Figure 4-51 Installation summary
15.After installation completes, click Finish.
4.8 Downloading and launching Eclipse Web Tools
Platform V1.5.2
The Eclipse Web Tools Platform provides APIs for J2EE and Web-centric
application development. It includes both source and graphical editors for a
variety of languages, tools, and APIs to support deploying, running, and testing
applications.
You can download Eclipse Web Tools Platform V1.5.2 at the following URL:
http://download.eclipse.org/webtools/downloads
We downloaded the Web Tools Platform, All-in-one bundle (which has the
complete set of prerequisites), Eclipse 3.2.1 SDK, Eclipse Modelling Framework
(EMF), Graphical Editing Framework (GEF), and Java EMF Model (JEM).
Chapter 4. Installing and configuring the products for the migration
107
To launch Eclipse:
1. Extract the compressed archive to C:\.
2. Open the folder C:\eclipse.
3. Run eclipse.exe.
4.9 Downloading XDoclet 1.2.3
XDoclet is an open source code generation engine that enables
Attribute-Oriented Programming in Java. It allows to add more significance to the
code by adding metadata (attributes) in the Java sources using special JavaDoc
tags.
You can download XDoclet 1.2.3 at the following URL:
http://sourceforge.net/project/showfiles.php?group_id=31602
Download xdoclet-lib-1.2.3.zip and extract the archive to C:\.
4.10 Downloading WebSphere Application Server
Community Edition Eclipse Plugin 1.1.0.1
WebSphere Application Server Community Edition Eclipse Plugin provides
integration between WebSphere Application Server Community Edition and
Eclipse Web Tools Platform. With this plugin, you can develop, deploy, and
debug your J2EE applications to a WebSphere Application Server Community
Edition server.
You can download WebSphere Application Server Community Edition Eclipse
Plugin 1.1.0.1 at:
http://www-128.ibm.com/developerworks/downloads/ws/wasce/?S_TACT=105AGX
10&S_CMP=WESDL
We downloaded wasce_eclipse_plugin-1.1.0.1-deployable.zip and extracted the
archive to C:\eclipse.
108
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4.11 Installing Java Web Services Developer Pack 2.0
Java Web Services Developer Pack 2.0 requires Sun JRE 1.5.0 or higher.
You can download Sun JRE 1.5.0 from the following URL:
http://java.sun.com/javase/downloads/index_jdk5.jsp
You can download Java Web Services Developer Pack 2.0 at the following URL:
http://java.sun.com/webservices/downloads/webservicespack.html
The following sections explain how to install the Sun JRE™ 1.5.0 and the Java
Web Services Developer Pack 2.0:
4.11.1 Installing Sun JRE 1.5.0
To install Sun JRE 1.5.0, follow these steps:
1. Run jre-1_5_0_11-windows-i586-p.exe.
2. Read the terms of the license agreement.
3. Select Typical setup - All recommended features will be installed and
click Accept to start the installation (Figure 4-52).
Figure 4-52 Installing Sun J2SE Runtime Environment: License Agreement
Chapter 4. Installing and configuring the products for the migration
109
4. A progress window displays and then you see a window similar to
Figure 4-53. Click Finish to exit the window.
Figure 4-53 Installing Sun J2SE Runtime Environment: Installation Completed
110
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4.11.2 Installing Java Web Services Developer Pack 2.0
To install Java Web Services Developer Pack 2.0, follow these steps:
1. Run jwsdp-2_0-windows-i586.exe. A welcome window displays as shown in
Figure 4-54. Click Next.
Figure 4-54 Java Web Services Developer Pack 2.0 installation welcome window
Chapter 4. Installing and configuring the products for the migration
111
2. Read the license agreement, click APPROVE, and then click Next, as shown
in Figure 4-55.
Figure 4-55 Java Web Services Developer Pack 2.0 license agreement
112
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Click Browse to select the Java 2 SDK installation directory (Figure 4-56).
Figure 4-56 Java Web Services Developer Pack 2.0: Select SDK
Chapter 4. Installing and configuring the products for the migration
113
4. Enter the directory name or browse to the directory where IBM JDK 1.5.0 is
installed and click OK, as shown in Figure 4-57.
Figure 4-57 Java Web Services Developer Pack 2.0: Browse SDK directory
5. Select C:\Program Files\IBM \Java50 and click Next (Figure 4-58).
Figure 4-58 Java Web Services Developer Pack 2.0: Select SDK
114
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Select No Web Container and click Next, as shown in Figure 4-59.
Figure 4-59 Java Web Services Developer Pack 2.0: Select Web Container
Chapter 4. Installing and configuring the products for the migration
115
7. Enter the directory name or browse to the directory where Java Web Services
Developer Pack 2.0 is to be installed and click Next, as shown in Figure 4-60.
Figure 4-60 Java Web Services Developer Pack 2.0: Select directory
116
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. A window displays information as shown in Figure 4-61. Click Next.
Figure 4-61 Java Web Services Developer Pack 2.0: No Web Container confirmation
Chapter 4. Installing and configuring the products for the migration
117
9. Select Typical and click Next (Figure 4-62).
Figure 4-62 Installation configuration window
118
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.You see a window similar to Figure 4-63. You do not enter information here.
Just click Next.
Figure 4-63 Set HTTP Proxy Information window
Chapter 4. Installing and configuring the products for the migration
119
11.A window displays information about the installation features to be installed
(Figure 4-64). Click Next to continue the installation.
Figure 4-64 Installation features to be installed
12.When the installation is complete, click Next.
120
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
13.Click Next on subsequent windows until you see a window similar to
Figure 4-65.
Figure 4-65 Java Web Services Developer Pack 2.0: Register
Chapter 4. Installing and configuring the products for the migration
121
14.Clear Register with Java Web Services Developer Pack 2.0 and click Next
to see a window similar to Figure 4-66.
15.Click Finish to exit the wizard.
Figure 4-66 Java Web Services Developer Pack 2.0 window
4.12 Downloading Apache Ant 1.7.0
Apache Ant is a Java-based build tool. You can download Apache Ant 1.7.0
from:
http://ant.apache.org/bindownload.cgi
Download the binary distribution apache-ant-1.7.0-bin.zip and extract the archive
to C:\.
122
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4.13 Installation directories
The software that we installed is sufficient to carry out all the migrations that we
present in this book. As a summary, here is a list of the installed products and
their directories:
Rational Application Developer V7.0
C:\Program Files\IBM\SDP70
WebSphere Application Server V6.1 (Test environment)
C:\Program Files\IBM\SDP70\runtimes\base_v61
WebSphere Application Server V6.1 (Base installation)
C:\Program Files\IBM\WebSphere\AppServer
DB2 Universal Database V8.2
C:\Program Files\IBM\SQLLIB
Eclipse Web Tools Platform V1.5.2
C:\eclipse
XDoclet 1.2.3
C:\xdoclet-1.2.3
WebSphere Application Server Community Edition Eclipse Plugin 1.1.0.1
C:\eclipse
Java Web Services Developer Pack 2.0
C:\Sun\jwsdp-2.0
Apache Ant 1.7.0
C:\apache-ant-1.7.0
Chapter 4. Installing and configuring the products for the migration
123
124
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5
Chapter 5.
Common migration issues
This chapter discusses some of the most common migration issues that you
might come across when migrating from other J2EE platforms to WebSphere
Application Server V6.1.
Although the main idea behind Java and J2EE is portability and Write Once, Run
Anywhere (WORA), this is not always the case, because the unique way in which
each vendor implements the J2EE specification often leads to problems when
migrating a J2EE application. Vendors also implement features that are not
included in the J2EE specification. Thus, Sun provides the J2EE Compatibility
Test Suite (CTS), which consists of thousands of test cases based on the J2EE
specification. Sun uses the CTS test suite to verify that a specific J2EE
application server complies with the specification. This compliance ensures that
applications deployed on one J2EE application server will also run on another
vendor’s application server.
J2EE applications can also conflict with the J2EE specification. The J2EE
specification is sufficiently complex and can be difficult for developers to know all
the details. Developers can use tools, such as Rational Application Developer
V7.0 and the Java Application Verification Kit (AVK) for the enterprise, to verify
that an application is written according to the specifications.
In this chapter, we provide a list of some common migration issues.
© Copyright IBM Corp. 2007. All rights reserved.
125
5.1 J2EE application server compatibility
Although the J2EE specification covers an increasingly wider spectrum of
enterprise applications development, there is still the need for vendor-specific
features. If the vendor-specific features are used without proper planning, they
can cause migration problems. Small differences or bugs in the vendor’s
implementation of the J2EE specification might also cause compatibility
problems.
This section summarizes the following issues.
Using vendor-specific features
Class loader related issues
Deployment Descriptors
5.1.1 Using vendor-specific features
When faced with the choice of using a vendor-specific feature, you have the
option of not using it and accepting the limitations of the J2EE specification. This
option is good from a portability and migration point of view.
You can also decide to use the vendor-specific feature and accept the risk and
potential future migration costs. If you decide to proceed with this option, ensure
that you abstract away the implementation details, for example by designing
interfaces, not concrete classes.
WebSphere Application Server Community Edition V1.1.0.1
automatic key generation for CMPs
WebSphere Application Server Community Edition V1.1.0.1 includes four
vendor-specific features for creating primary keys automatically:
Using a SEQUENCE table
Uses a separate table that stores next key to use for the EJB. You can use
this feature if the database does not support automatic key generation.
Auto increment table
You can use this feature with databases that support automatic primary key
generation, for example, DB2 supports GENERATED ALWAYS AS
IDENTITY, and so forth.
SQL generator
You can use this feature with a provided SQL statement to generate the next
key.
126
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Custom generator
You can use this feature with a custom key generator the implements
org.tranql.pkgenerator.PrimaryKeyGenerator interface.
WebSphere Application Server V6.1 - Base
WebSphere Application Server V6.1 does not have an equivalent feature that we
can use, which means that you have to implement your own scheme for
generating the primary key. The Adventure Builder sample application includes
an example of this feature. It uses the PrimaryKeyGenerator class for generating
primary keys.
5.1.2 Class loader related issues
The Java class loader is responsible for locating and loading classes. Application
server class loaders are complex and so is the task of tracking down and solving
these issues. To further complicate matters, each J2EE application server uses a
custom implementation of class loaders because the J2EE specification does not
currently cover class loaders. In this section, we provide some information about
the class loader implementations and how they differ from the WebSphere
Application Server V6.1 implementation.
Most class loader issues when migrating applications are related to:
Class loader implementation
Each J2EE platform implements a class loader differently.
Shared libraries
These libraries are libraries that are made available to multiple applications or
the whole server, that are located in different places, and that are configured
differently from server to server.
Bundled libraries
Each platform is bundled with a unique set of frameworks and libraries, for
example Apache Xerces and Apache Xalan. The versions of these libraries
and the class loaders are different for each platform. Fixing these problems
might require major changes to the source code and packaging.
Chapter 5. Common migration issues
127
WebSphere Application Server Community Edition V1.1.0.1
Figure 5-2 shows a sample EAR Application Class Loader hierarchy.
Bootstrap
jre/lib/*.jar
Extensions
jre/lib/ext/*jar
System
bin/server.jar
jre/lib/tools.jar
geronimo/j2ee-server/1.1.1/car
J2EE specs
EJB, Web, RA containers
Transactions
Core server components
Application EAR
EJB JAR
Resource Adapter RAR
Any Dependencies from Deployment Plans
TranQL Resource Adapter
JDBC Driver
Application Datasource
Application WAR (from EAR)
WEB-INF/classes
WEB-INF/lib/*.jar
Application WAR2 (from EAR)
WEB-INF/classes
WEB-INF/lib/*.jar
Figure 5-1 EAR application class loader hierarchy
The class loaders with a white background are created by Java. Bootstrap and
Extensions class loaders load JVM Internal classes. The class loaders with
shaded background are created by WebSphere Application Server Community
Edition. The geronimo/j2ee-server/1.1/car configuration loads all of the critical
classes and services for J2EE applications. This is added automatically as a
dependency for J2EE applications.
WebSphere Application Server Community Edition uses MultiParent class loader
that allows for specifying multiple class loaders as parents to a class loader. For
example, Application WAR2 class loader has two parents, namely Application
EAR class loader and Application data source class loader.
128
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Additionally, you can change the normal class loading behavior by specifying:
Inverse class loading
Normally classes will be loaded from parent class loader if available before
checking the current class loader. With inverse class loading, this is reversed
and current class loader is always checked before looking in the parent.
Hidden classes
Packages or classes specified as hidden classes, even if they exist in a
parent class loader, are not exposed in the current class loader.
Non-overridable classes
Packages or classes specified as non-overridable classes are always loaded
from a parent class loader and are never loaded from the current class
loader.
WebSphere Application Server V6.1
The WebSphere Application Server V6 class loader consists of four components:
System class loader
Provided by the Java virtual machine. Responsible for loading classes from
the CLASSPATH, bootstrap, and extensions class paths.
WebSphere runtime class loaders
Loads the WebSphere Application Server V6 runtime classes. All classes in
the ws.ext.dirs class path are added to this class loader.
Application class loaders
Responsible for loading resources that are part of an EAR module, for
example JAR, EJB and WAR files.
Web module class loaders
The Web module class loader loads the classes in WEB-INF/classes. It is
possible to override this behavior and have the application class loader load
the classes.
Chapter 5. Common migration issues
129
Each class loader is a child of the parent class loader, as illustrated in Figure 5-2.
When a resource needs to be loaded, all class loaders by default ask the parent
class loader to locate it. If it cannot be found, the resource is loaded by the child
class loader. If none of the class loaders is able to find the resource, you receive
a ClassNotFoundException.
System class loaders
WebSphere runtime class loader
Application class loader
Application class loader
Web module class loader
Figure 5-2 WebSphere Application Server V6.1 class loader in default configuration
Class loader isolation policies
The WebSphere Application Server V6 application and Web module class
loaders can be configured to enable different packaging schemes. The default is
multiple.
Application class loader
The application class loader can be configured to use the following modes:
Single
When in single mode, the application class loader is shared by all modules in
the EAR application. For example, all JAR, WAR, and EJB modules have
visibility to all classes located in all modules.
Multiple
When in multiple mode, an application class loader is created for each
module in the EAR application, which means that the different modules are
isolated from each other.
Web module class loader
The Web module loads resources from the WEB-INF/lib and WEB-INF/classes
directories in the WAR file. This behavior is the default behavior and can be
130
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
overridden by setting the policy to Application. This policy makes the application
class loader load the resources from WEB-INF/lib and WEB-INF/classes, instead
of the Web module class loader.
Class loader modes
WebSphere Application Server V6.1 supports two different class loader modes:
Parent first
This mode is the default mode for all class loaders, and it is the J2EE and
Java standard. The loading of the resources is first delegated to the parent
class loader. If the parent class loader is unable to find the resource, the child
class loader tries to handle it.
Parent last
Using the parent last class loading policy makes the class loader work
opposite of the parent first mode. The resource is loaded from the application
or Web module class loader first. If the resource is not found, the loading is
delegated to the parent class loader.
Shared libraries
WebSphere Application Server V6 allows you to configure dependencies that are
shared by either all applications in the server or just one specific application
class loader. Shared libraries are configured using the administrative console
and can be specified at the application or server level.
Bundled libraries
WebSphere Application Server V6.1 contains some open source libraries that
are located in the server class path. If you are using the same libraries and there
is a version mismatch, you might receive one of the following errors:
java.lang.NoSuchMethodError
java.lang.ClassCastException
java.lang.NoClassDefFoundError
To fix these errors, you can try to experiment with different class loading policies,
such as parent last instead of parent first.
Some of the most common libraries that are located in the WebSphere
Application Server V6.1 server class path include:
WebSphere Application Server V6.1 includes the Jakarta Commons Logging
V1.2 (JCL), which is known to cause problems when migrating.
The following article describes how to solve JCL problems on WebSphere:
http://www.ibm.com/support/docview.wss?uid=swg27004610
Chapter 5. Common migration issues
131
Another common error is caused by Apache Xalan and Xerces, which are
usually bundled with application servers.
JDom is also bundled with WebSphere Application Server V6.
5.1.3 Deployment Descriptors
The J2EE specification does not cover all the aspects of application deployment
and configuration. This is why we have vendor-specific Deployment Descriptors.
Table 5-1 on page 133 lists both the J2EE and vendor-specific Deployment
Descriptors. Each application server uses a different set of files because they are
implemented differently and have different feature sets.
The biggest issues associated with Deployment Descriptors while migrating to
WebSphere Application Server V6 can be summarized include:
CMP to database schema mapping
WebSphere Application Server V6.1 uses a completely different way of
mapping CMPs to the database schema, compared to the other application
servers covered in this book. The only way of creating these files is by using
either Rational Application Developer V7.0 or the Java Application
Verification Kit.
The J2EE standard Deployment Descriptors are mapped to the WebSphere
Application Server V6.1 specific Deployment Descriptors with IDs, as
illustrated in Example 5-1 on page 133 and Example 5-2 on page 133. This
means that the ID in the WebSphere Application Server V6.1 specific
Deployment Descriptor must match the one in the J2EE standard Deployment
Descriptor.
WebSphere Application Server V6.1 validates the Deployment Descriptors
more strictly than other application server. This will lead to the following
problems when migrating:
– Deployment Descriptors will fail validation because the elements are not in
the proper order or the DTD is incorrect.
– JSPs will not compile.
132
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Example 5-1 shows how the standard J2EE ejb-jar.xml Deployment Descriptor
and WebSphere Application Server V6.1 are mapped with IDs.
Example 5-1 Excerpt from ejb-jar.xml
...
<resource-ref id="ResourceRef_1173653784123">
<res-ref-name>jms/activity/QueueConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
...
In Example 5-2, a resource reference with the ID ResourceRef_1173653784123
is mapped to a JNDI name pointing to a resource that is managed by WebSphere
Application Server V6.1.
Example 5-2 Excerpt from ibm-ejb-jar-bnd.xmi
...
<resRefBindings xmi:id="ResourceRefBinding_1173653784123"
jndiName="jms/activity/QueueConnectionFactory">
<bindingResourceRef
href="META-INF/ejb-jar.xml#ResourceRef_1173653784123"/>
</resRefBindings>
...
Table 5-1 lists the J2EE standard and vendor-specific Deployment Descriptors.
Table 5-1 J2EE and vendor-specific Deployment Descriptors and configuration files
Description
J2EE
specification
WebSphere Application Server V6
WebSphere Application
Server Community
Edition
EAR
application
application.xml
ibm-application-bnd.xmi
ibm-application-ext.xmi
geronimo-application.xml
WAR
application
web.xml
ibm-web-bnd.xmi
ibm-web-ext.xmi
geronimo-web.xml
EJB
application
ejb-jar.xml
ibm-ejb-jar-bnd.xmi
ibm-ejb-jar-ext.xmi
ibm-ejb-access-bean.xml
openejb-jar.xml
J2EE client
application
application-clie
nt.xml
ibm-application-client-bnd.xmi
ibm-application-client-ext.xmi
geronimo-application-clien
t.xml
Chapter 5. Common migration issues
133
Description
J2EE
specification
WebSphere Application Server V6
WebSphere Application
Server Community
Edition
Server
configuration
Not covered by
the J2EE
specification
Mainly located in
<was_home>\profiles\<profile_name>
\config\cells
Located under individual
configuration directories
under repository with
overridden attributes in
<wasce_home>/var/config
/config.xml
5.2 Application portability
In this section, we describe some of the migration issues that affect application
portability. Application portability, or the lack thereof, is perhaps the most
important issue from a migration point of view.
5.2.1 Application packaging
Packaging is important from a portability and migration point of view. Each
application is packaged differently. This, combined with the different class loader
implementations in each application server, can potentially create problems
when migrating. The application might run in the source environment but not in
WebSphere Application Server V6.1 - Base. To avoid problems, always follow
the J2EE specification, which contains specifications for application packaging.
An application is usually packaged into an EAR file that can consist of the
following modules:
EJB
Includes the EJB class files and Deployment Descriptors.
WAR
Web application module that includes Deployment Descriptors.
JAR
A JAR file can include common classes used by other modules and
Deployment Descriptors for a J2EE application client.
RAR
Resource Adapter archives is a JAR file including resource adapters for the
J2C architecture.
134
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Figure 5-3 illustrates the recommended way of packaging an application. The
EAR package consists of the following modules.
EJB module
The EJB module depends on Log4j, which is used for logging. It also depends
on some utility classes. Each dependency is declared in the
META-INF/manifest.mf file.
Web application module
The Web application module depends on Log4j, the utility library and the EJB
module. Each dependency is declared in the META-INF/MANIFEST.MF file.
Note: The way you package the application might be different, depending
on whether you are using Local or Remote EJB interfaces. If using Local
EJB interfaces, as in our example, the client must have access to all EJB
classes. If using Remote interfaces, you could optionally create a jar
containing only the client view of the EJBs.
Log4j.jar
Apache Log4j is a logging implementation used throughout the application.
Third-party libraries that are used by the EJB module or more than one
module should be placed in the application root.
utility.jar
This is a utility library that includes common application code. Code that is
used by more than one module should be located in this file.
Chapter 5. Common migration issues
135
EAR
META-INF/application.xml
Log4j.jar
utility.jar
EJB
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path:
log4j.jar
utility.jar
WAR
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path:
log4j.jar
utility.jar
ejb.jar
Figure 5-3 Recommended packaging structure of J2EE application
Tip: Always include the version number of libraries, frameworks, and
applications in either the manifest.mf or the name of the file. During our
migration process, we were unable to identify the version of many
frameworks. Knowing the version number is critical when getting support.
Migration issues
During the migration of the sample applications, we found the following
packaging-related issues:
In top-down rdb mapping of EJBs, table field names are changed sometimes.
So, it is always recommended to generate the tables from generated DDLs.
Proper access permission for tables is a must.
WebSphere Application Server Community Edition does not have concept of
service bus and destination queues. In WebSphere, we were required to
create bus and destination queue for each queue.
136
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Automatic primary key generation not supported by WebSphere Application
Server. We have used a custom key generator class to accomplish primary
key generation for certain CMP Beans.
The original source code had errors in HTML, for example, a missing start tag
for </tr> etc. We have disabled HTML validation in the IDE while migrating
one of the two sample applications.
Needed JCA adapter configuration of message beans in WebSphere.
JNDI name for data sources, EJBs and resource references were required to
be re-created.
While configuring JNDI names using WebSphere Application Server
Administrative Console, an accidental inclusion of an extra space in JNDI
names resulted in name not found exception.
In WebSphere Application Server, Web services require endpoint enablers.
So we had to create Web service from session bean again which resulted in
changes to service names and URLs.
Some code changes required to accommodate new Web services URL and
names that were different from the URLs to which the Web services were
bound to while running the EJB applications in WebSphere Application Server
Community Edition.
The Web Service Client code generated by JWSDP and RAD has used
different interface names. Some of the code that directly referenced the Web
Service Client interfaces were required to be modified accordingly.
5.2.2 Use of native code
Java allows the use of native code, for example written in C or C++, with the use
of Java Native Interface (JNI™). Using native code can potentially cause
problems when migrating to a different operating system.
5.2.3 Database-related issues
In our migration examples, we used an application that were developed for the
PointBase database engine from Sun and another application that was
developed on DB2. We migrated these to use DB2 Universal Database Express
Edition V8.2. In this section, we describe the issues that we encountered and the
solutions to them:
Migrating database schemas
Most of the issues we had with migrating database schemas were easy to
solve either by manually editing the DDL or SQL scripts or running them
Chapter 5. Common migration issues
137
through a tool. For issues related to MySQL to DB2 migration, see MySQL to
DB2 UDB Conversion Guide, SG24-7093, which you can find online at:
http://publib-b.boulder.ibm.com/Redbooks.nsf/RedbookAbstracts/sg247093.html
The more difficult issues were the following.
– Data type overflow
When moving one database to DB2 from PointBase, we had to change the
data type of one column from BOOLEAN to SHORT because DB2 does
not support the BOOLEAN data type.
– Automatic primary key generation
MySQL supports AUTO_INCREMENT columns. The DB2 equivalent for
this is the identity column. We had to change the schema to use identity
columns.
Mapping database schemas to CMPs
In our migration examples, we had to map CMPs to the existing database
schemas. This mapping is a complex task and requires the use of either
Rational Application Developer V7.0 or Java Application Verification Kit. In
theory, it is possible to manually edit XML and XMI Deployment Descriptors,
but we do not recommend trying this.
The database mapping is done with the EJB to RDB mapping tool, which
supports the following options:
– Top down
This will create a database schema from existing CMPs.
– Bottom up
By using the bottom up approach, you can generate CMPs from an
existing database schema.
– Meet-in-the-middle
This option is probably the one that you will want to use. It allows you to
automatically map the CMPs to database tables and columns. The tool
tries to match column and table names to the CMP. If the column or table
names do not match, you have the option of creating the mapping
manually using the Mapping Editor.
Primary key generation
WebSphere Application Server Community Edition V1.1.0.1 includes
vendor-specific EJB extensions that provide support for automatic primary
key generation, as we described in 5.1.1, “Using vendor-specific features” on
page 126. This feature was absent in WebSphere Application Server V6.1 Base and so it was required to write a custom class to generate the primary
keys.
138
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5.2.4 Java Message Service
The Java Message Service (JMS) messaging configuration in WebSphere
Application Server V6.1 - Base is different from that of WebSphere Application
Server Community Edition V1.1.0.1. The major differences are summarized in
the following list:
You cannot use the JMS default messaging engine provided by WebSphere
Application Server V6.1 - Base with listener ports.
We have two options to solve this problem:
– Use the JMS Activation Specification instead of listener ports.
– Use IBM WebSphere MQ or other supported JMS server instead of the
default messaging engine.
JMS messaging configuration
Before being able to configure JMS connection factories, queues and topics,
you have to configure the following components:
–
–
–
–
Service integration bus
Bus member
Bus destinations for the JMS queues and topics
JMS activation specification for JMS queues and topics
The steps required for configuring JMS messaging are described in detail in the
migration examples on each of the platform-specific chapters, as needed.
5.2.5 Java Naming and Directory Interface
Because WebSphere Application Server Community Edition V1.1.0.1 does not
support any global Java Naming and Directory Interface™ (JNDI) features
currently and only supports java:comp/env/ application local JNDI contexts,
which are configured using resource-ref tags there will not be any problems
when migrating applications to WebSphere Application Server V6.1 - Base.
Nevertheless, there are some differences in WebSphere Application Server V6.1
- Base related to JNDI that are mentioned here:
InitialContext factory
The InitialContext factory for WebSphere Application Server V6.1 - Base is:
com.ibm.websphere.naming.WsnInitialContextFactory
Example 5-4 shows how to look up a data source through JNDI.
Chapter 5. Common migration issues
139
Direct JDBC data source lookups are deprecated
If you use the JNDI name to look up a JDBC data source, you will get the
warning shown in Example 5-3. Instead of looking up the JNDI name, we
have to use a resource reference defined in the web.xml file.
Example 5-3 shows the warning message that WebSphere Application Server
V6.1 - Base displays when performing a direct lookup of a JDBC data source
through its JNDI name.
Restriction: The JNDI lookups only works with the IBM JDK.
Example 5-3 Warning message
00000042 ConnectionFac W
J2CA0294W: Deprecated usage of direct JNDI
lookup of resource jdbc/xpetstoreDS. The following default values are
used: [Resource-ref settings]
res-auth:
res-isolation-level:
res-sharing-scope:
loginConfigurationName:
loginConfigProperties:
[Other attributes]
1 (APPLICATION)
0 (TRANSACTION_NONE)
true (SHAREABLE)
null
null
res-resolution-control:
isCMP1_x:
isJMS:
999 (undefined)
false (not CMP1.x)
false (not JMS)
Example 5-4 demonstrates the correct way of finding a JDBC data source
through a JNDI lookup. The JSP only works on WebSphere Application Server
V6, because it relies on vendor-specific classes.
Note: The default IIOP port is 2809. It might be different in your environment.
Example 5-4 Looking up a JDBC data source through JNDI and a resource reference
<%@page import="javax.naming.*,java.util.Hashtable"%>
<%
String dataSource = "java:comp/env/jdbc/xpetstoreDS";
%>
Looking up data source <%= dataSource %><br/>
<%
try {
Hashtable env = new Hashtable();
140
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
Context initialContext = new InitialContext(env);
javax.sql.DataSource ds = (javax.sql.DataSource) initialContext
.lookup(dataSource);
%>
Success
<%
} catch (Exception e) {
out.write(e.getMessage());
e.printStackTrace();
}
%>
5.2.6 J2EE application clients
A J2EE application client is a stand-alone client running in a separate process
from the application server. The client is given access to resources in the
WebSphere Application Server V6 J2EE Client Container. The J2EE application
client can be used to communicate with EJBs or other resources deployed on the
application server. There are several use cases where J2EE application clients
are appropriate:
Alternative user interface for the application
Running unit tests
Administrative tasks
We do not cover migrating J2EE application clients in practice in this book. We
only provide an overview of the options provided by WebSphere Application
Server V6.
WebSphere Application Server V6.1 J2EE application clients are executed with
the following command:
<was_home>/bin/launchClient.bat client.ear
The script sets up all necessary class path and configuration variables and runs
the J2EE application client, which must be packaged as an EAR file.
Thin clients
Thin application clients provide a more lightweight alternative to J2EE application
clients. The thin clients access WebSphere through RMI-IIOP and do not have
access to all the services provided by WebSphere.
Chapter 5. Common migration issues
141
For example, JNDI lookups do not have access to java:comp/env. Instead, the
thin client must provide the fully qualified path, including the physical location, as
illustrated in Example 5-5.
Example 5-5 Thin client looking up an EJB deployed on a single server
...
String path =
"cell/nodes/nodeName/servers/serverName/relativeJndiName";
Object object = initialContext.lookup(path);
EJBHome ejbHome = (EJBHome)
javax.rmi.PortableRemoteObject.narrow(object, EJBHome.class);
...
To run thin clients, you need to install the J2EE and Java thin application client,
which is part of the WebSphere Application Server V6 installation package and
can be installed separately.
Refer to the WebSphere Application Server Information Center for more
information about how to run and develop thin clients:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.web
sphere.express.doc/info/exp/ae/tcli_developthin.html
5.3 J2EE 1.4 migration considerations
J2EE is evolving all the time, and new specifications and requirements are
defines periodically with a new J2EE specification. WebSphere Application
Server V6.1 - Base supports all of the J2EE 1.4 related technologies, but you can
still deploy J2EE 1.3 applications as well.
If you plan to maintain your applications, you should consider migrating them to
J2EE 1.4. This way, you can be up to date, and the changes in the next J2EE
specifications will be easier to carry out.
While the main changes of J2EE 1.4 are related to Web services, the
introduction of the JAX-RPC and SAAJ APIs and the new messaging bus
architecture supported by MDBs means that the remaining technologies and
APIs are not changing as much, and in some cases, there are only additions or
clarifications of ambiguities in the previous version.
This section provides an overview of the changes and new functionalities in the
main technologies of J2EE 1.4.
142
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5.3.1 Enterprise Java Beans
Enterprise Java Beans 2.1 adds new functions to the EJB QL language, a timer
service API to schedule tasks, and enhanced Message Driven Beans which can
support any messaging system, not just JMS. EJB 2.1 also includes better
support for Web services, through the JAX-RPC and JAXM APIs.
5.3.2 Java Server Pages
The new JSP 2.0 comes with the introduction of the JSP Standard Type Library
(JSTL) specification, an expression language and some clarifications about
ambiguities in the previous version. This last item is very important for migration
projects, because the ambiguities are caused by differences in the J2EE
implementations of the different vendors.
5.3.3 Servlets
There are no major changes in the Servlet 2.4 specification. Some clarifications
about the use of filters, the possibility of including servlets as welcome pages,
and the addition of two new servlet request events (ServletRequestListener and
ServletRequestAtrributeListener) are some of the changes in this version. It is
unlikely that these changes could become migration issues.
For a complete list of new features in J2EE 1.4 refer to:
http://www.jcp.org/en/jsr/detail?id=151
For deprecated functions, refer to:
http://java.sun.com/j2ee/1.4/docs/api/deprecated-list.html
Chapter 5. Common migration issues
143
144
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6
Chapter 6.
Migrating WebSphere
Application Server CE to
WebSphere Application
Server
This chapter leads you through the process of migrating a sample J2EE 1.4
application from WebSphere Application Server Community Edition V1.1.0.1 to
WebSphere Application Server V6.1 - Base. It breaks up the migration into a
series of sections and each section accomplishes a subtask that needs to be
carried out during the migration process.
The different sections that make up this chapter are:
Introduction to this chapter
Prerequisites and assumptions
Migrating the Plants by WebSphere sample application
© Copyright IBM Corp. 2007. All rights reserved.
145
6.1 Introduction to this chapter
This chapter describes the steps that are involved in migrating an existing J2EE
application from WebSphere Application Server Community Edition V1.1.0.1 to
WebSphere Application Server V6.1 - Base. To accomplish this migration, we
first describe the steps to download the application and build the application.
Then, we describe how to deploy it in WebSphere Application Server Community
Edition. Then, we discuss the steps that are required to migrate the application to
WebSphere Application Server V6 - Base.
The J2EE 1.4 application that we use to demonstrate this migration is the Plants
by WebSphere sample application that is a part of the sample applications that
come with WebSphere Application Server Community Edition.1 This application
also has the ability to communicate with the Greenhouse by WebSphere sample
application using Web services. However, we do not discuss the Greenhouse by
WebSphere application in this migration example.
6.2 Prerequisites and assumptions
In this section, we discuss the prerequisites and assumptions to help you
prepare and perform the migration.
First, we need to build a destination environment setup as described in
Chapter 4, “Installing and configuring the products for the migration” on page 45.
This should provide some initial background if you are not familiar with IBM
products.
You should be comfortable with J2SE 5.0 and also be familiar with basic J2EE
concepts like the Java runtime. He should be able to understand and run basic
SQL commands. Last but not least, the reader should be familiar with
WebSphere Application Server V6.1.
You need to install the following software before starting the migration.
J2SE 5.0
We use J2SE 5.0 because it is supported by WebSphere Application Server V6.1
- Base, and we need to make sure our applications work well in this JVM. The
WebSphere Application Server V6.1 - Base installation includes J2SE 5.0, and
you do not need to install additional JDKs on your computer.
1
146
The Plants by WebSphere application is a sample application, developed and configured using
WebSphere Studio Application Developer Version 5.0.1, that you can download from the
developerWorks Web site.
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Apache Maven 1.1
Apache Maven is a Java-based build tool. Maven enables us to build a project
using the Project Object Model. It does away with the need to write complex
scripts for building and simplifies the build process to a large extent when
compared to Apache Ant. It has enhanced features that make it a very good
choice for Java applications, which is required for building the Plants by
WebSphere application.
WebSphere Application Server V6.1 - Base
Before you start migrating to WebSphere Application Server V6.1 - Base, we
recommend that you play with sample applications shipped with the product and
also read publications listed in “Related publications” on page 495. We discuss
instructions on how to install and configure WebSphere Application Server V6.1 Base in Chapter 4, “Installing and configuring the products for the migration” on
page 45. You notice that the Plants by WebSphere application is also shipped
with WebSphere Application Server V6.1 - Base as a sample.
DB2 Universal Database Express Edition V8.2
WebSphere Application Server V6.1 - Base supports many databases, but we
have decided to use DB2 Universal Database Express Edition V8.2 for all our
applications. You can find instructions on how to install and configure DB2
Universal Database Express Edition V8.2 in 4.5, “Installing DB2 Universal
Database Express Edition V8.2” on page 87.
Application Server Toolkit V6.1
We will use Application Server Toolkit to import the EAR that is deployed on
WebSphere Application Server Community Edition and create an EAR that we
can deploy on WebSphere Application Server. We use Application Server Toolkit
V6.1 for testing the application before deployment into Websphere Application
Server Base. You can find instructions on how to install and configure Application
Server Toolkit in 4.6, “Installing WebSphere Application Server Toolkit V6.1” on
page 97.
6.3 Migrating the Plants by WebSphere sample
application
The Plants by WebSphere sample application incorporates the following
technologies:
Container-managed persistence (CMP) entity beans
Bean-managed persistence (BMP) entity beans
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
147
Stateless session beans
Stateful session beans
Servlets
JavaServer Pages (JSP) files and HTML
Container-managed relationships (CMR)
Java 2 platform, enterprise edition (J2EE) security
Java API for XML-based remote procedure call (JAX-RPC)
The Plants by WebSphere application is supported through a series of JSP
pages and HTML pages. These pages communicate with the following servlets:
AccountServlet, ShoppingServlet, ImageServlet, and AdminServlet. The servlets
use the various enterprise bean business methods, which in turn, access data
from the database as needed. In general, stateless session beans are used to
interface with the entity beans, in order to reduce the number of transactions.
Another application called Greenhouse is a plant supplier which can be used with
the Plants by WebSphere sample application. The Greenhouse application
processes back orders from the Plants by WebSphere application. The Web
service servlet is used to send and receive JAX-RPC requests between the
Plants by WebSphere application and the Greenhouse application.
Figure 6-1 shows the structure of the application.
PlantsByWebSphereEAR-1.1.1
PlantsByWebSphereWeb-1.1.1
PlantsGallery-1.1.1
Servlets
AccountServlet
ShoppingServlet
ImageServlet
AdminServlet
JSP Pages
Html files, images and
other static content
PlantsByWebSphereEJB-1.1.1
Stateless Session Beans
CMP Entity Beans
Stateful Session Beans
Catalog
Login
Mailer
ReportGenerator
Suppliers
Customer
Inventory
Login
Order
OrderItem
BackOrder
BackOrderStock
Supplier
ShoppingCart
BMP Entity Beans
ResetDB
Figure 6-1 Plants by WebSphere sample application structure
148
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6.3.1 Servlets
This section presents information about the servlets that the Plants by
WebSphere sample application uses.
AccountServlet
The AccountServlet servlet processes logging in, account registration, and
account updates. During a login, the servlet performs a Customer bean findBy
method. If the servlet finds the user ID, the servlet checks the password, and the
login occurs. If any problems occur, an error message displays to the customer.
The customer information is saved in the HTTP session. During registration, a
Login session bean creates a new Customer object. The customer information is
saved in the HTTP session. During an account update, a Login session bean
updates an existing user and the customer information in the HTTP session is
updated.
ShoppingServlet
The ShoppingServlet servlet processes the majority of interactions between the
browser and the enterprise beans. This interaction includes inventory, shopping
cart, and order functions. Selecting a shopping category to browse uses a
Catalog session bean, to find and display all of the relevant Inventory objects.
Displaying the details of an item is also performed using a Catalog session bean
to obtain information from an Inventory CMP entity bean.
Adding an item to the shopping cart creates a ShoppingCart stateful session
bean. A Catalog session bean obtains the Inventory data, and places the item in
the ShoppingCart bean. Viewing and updating the shopping cart is done using
the ShoppingCart stateful session bean.
After entering billing and shipping information, the ShoppingCart bean creates a
new Order CMP entity bean. Upon completing the checkout procedure, a Mailer
stateless session bean is created to send a confirmation e-mail, using the
JavaMail API.
ImageServlet
The ImageServlet servlet obtains and places product images into the database.
The servlet obtains images from the JSP pages and the HTML pages from the
database and serves back to the browser through the HTTP response.
AdminServlet
The AdminServlet servlet processes the requests from a user (browser) for
inventory back orders, database re-populate and Supplier configuration. During a
customer checkout procedure, the inventory quantity is checked. When the
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
149
inventory quantity reaches a minimum threshold, the Inventory bean creates a
new BackOrder CMP entity bean. Now an administrator can process this back
order in the Plants by WebSphere administrative pages.
When processing requests from the supplierconfig.jsp page, the AdminServlet
servlet creates a Suppliers stateless session bean, which is used to pass
requests to a Supplier CMP 2.0 bean. The Supplier configuration information
includes name, address, phone, and a Web service Web address. The
backorder requests are sent to the Supplier through a Web service located at this
Web address.
When processing re-populate requests from the help.jsp page, the AdminServlet
servlet creates a bean-managed persistence (BMP) bean called ResetDB. This
bean deletes all database tables and re-populates the tables with initial data
values from the pbw.properties properties file.
When processing requests for the backorder.jsp page, the servlet that is named
AdminServlet creates a BackOrderStock stateless session bean, which is used
to pass requests to a BackOrder CMP 2.0 bean. The AdminServlet backorder
requests (actions) include refresh, orderStock, and updateStock. The refresh
action initiates the getorderitems BackOrderStock method to retrieve the list of
backorder items. The orderStock action sends a JAX-RPC request from the
AdminServlet servlet to the Greenhouse supplier application sendOrder method.
The checkStatus action sends a JAX-RPC request from the servlet AdminServlet
to the Greenhouse supplier application checkOrderStatus method.
6.3.2 Enterprise beans
This section provides information about the enterprise beans that the Plants by
WebSphere sample application uses.
Catalog
Catalog is a stateless session bean. It is the primary access to the Inventory
container-managed persistence (CMP) entity bean. Stateless session beans
generally access entity bean data, while limiting the number of transactions
used. The Catalog session bean has business methods to obtain information
from one or more inventory beans. Methods exist to add and remove an
Inventory item. The Catalog session bean also has methods to modify existing
Inventory beans.
150
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Customer
Customer is a 2.0 CMP entity bean. It contains and manages the account data
needed for a customer. The Customer entity bean has methods for creating,
finding, and updating customer information, as well as verifying a password and
getting fields in the Customer entity bean.
Inventory
Inventory is a 2.0 CMP entity bean. This entity bean contains and manages
inventory item data. Methods are available for finding, creating, getting, and
setting data fields.
Login
Login is a stateless session bean. This session bean interfaces with the
Customer CMP entity bean to create and update customer accounts.
Mailer
Mailer is a stateless session bean. This session bean creates and sends an
order confirmation e-mail using the JavaMail API.
Order
Order is a CMP entity bean. This session bean contains and manages order
data. Methods are available for finding, creating, and getting data fields.
OrderItem
OrderItem is a CMP entity bean. This entity bean contains and manages a single
order item. Methods are available for finding, creating, and getting data fields.
ReportGenerator
ReportGenerator is a stateless session bean. This session bean generates
reports based on information found in orders. The ReportGenerator session
bean interfaces with the Order CMP entity bean. The reports consist of
top-selling items for a set date range, and top-selling zip codes for a set date
range.
ShoppingCart
ShoppingCart is a stateful session bean. This session bean maintains a list of
inventory items to purchase throughout the HTTP session. The ShoppingCart
session bean has business methods to add, remove, and update inventory
items. The ShoppingCart session bean also has a method to create a new Order
CMP entity bean when the customer is ready to complete a purchase.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
151
BackOrder
BackOrder is a CMP entity bean. This entity bean contains and manages
inventory backorder data. Methods are available for finding, creating, and getting
data fields.
BackOrderStock
BackOrderStock is a stateless session bean. This session interfaces with the
BackOrder CMP bean to create and process inventory backorder items.
Supplier
Supplier is a CMP entity bean. This entity bean contains and manages supplier
configuration data. Methods are available for finding, creating, and getting data
fields.
Suppliers
Suppliers is a stateless session bean. This session interfaces with the Supplier
CMP bean to create and process Supplier configuration information.
ResetDB
ResetDB is a BMP entity bean. This entity bean deletes all rows in the database
tables.
6.3.3 Migration approach
We decided to perform the migration by using the migration approach as
explained in 3.4.2, “Alternative 2: Developing the migration using Rational
Application Developer V7.0” on page 38.
The migration is performed in the following steps:
1. Verify that application works in its original environment. In this case, we
deploy and run the Plants by WebSphere application in WebSphere
Application Server Community Edition V1.1.0.1.
2. Import EAR file into Application Server Toolkit.
3. Analyze and fix problems reported.
4. Fill in the additional information required by WebSphere Application Server
V6.1.
5. Build Plants by WebSphere using Application Server Toolkit.
6. Deploy the application on WebSphere Application Server V6.1 and identify
and solve all problems reported.
152
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6.3.4 Installing the application in its source environment
After installing WebSphere Application Server Community Edition V1.1.0.1, the
next step is to deploy the sample application in our initial environment. This
section provide the steps to install and run Plants by WebSphere on WebSphere
Application Server Community Edition.
Getting the Plants by WebSphere application
Refer to Appendix A, “Additional material” on page 493 for details about how to
download the sample applications for WebSphere Application Server Community
Edition V1.1.0.1.
After you download the wasce_samples-1.1.0.1.zip file, extract its contents into
the wasce_samples-1.1.0.1 directory. In this book, we refer to this source
directory as <samples_home>. You can find the Plants by WebSphere
application in the <samples_home>/samples/applications/PlantsByWebSphere
directory. In this book, we refer to this directory as <plants_home>.
The <plants_home> directory includes the following files and subdirectories:
The plans subdirectory that includes the WebSphere Application Server
Community Edition specific deployment plans.
The PlantsByWebSphereEAR directory that includes the J2EE artifacts
specific to the EAR.
The PlantsByWebSphereEJB directory that includes the J2EE artifacts
specific to the EJB Module.
The PlantsByWebSphereWEB and PlantsGalleryWEB subdirectories that
include the J2EE artifacts and images, HTML files, and so forth that make up
the Web modules.
The sql directory that includes the DDL to create the database.
Remaining files that include the Maven specific files and the readme file.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
153
Creating the sample application database
To create the sample application database:
1. From a command line, start a DB2 CLP (command line processor) as follows:
cd <plants_home>/sql
db2cmd
2. Now, while you are in DB2 command prompt, execute the following
commands to create the Plants by WebSphere database and tables:
db2 create db PLANTSDB PAGESIZE 8192
db2 connect to PLANTSDB user db2admin using db2admin
db2 -tvf tables.ddl
db2 disconnect all
db2 update db config for PLANTSDB using logfilsiz 1000
db2 update db cfg for PLANTSDB using maxappls 100
db2stop
db2start
db2 connect to PLANTSDB user db2admin using db2admin
cd <db2_home>\bnd
db2 bind @db2cli.lst blocking all grant public
In these commands, <db2_home> refers to the path of the SQLLIB directory
created during the installation of DB2.
At this point, the database is empty and ready to get the data loaded. The
creation of initial data in the database is done by the application when it is
deployed.
154
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Creating a new connection pool and data source
After the database is created, you need to create a connection pool in
WebSphere Application Server Community Edition. Complete the following
steps:
1. If the server is not started, then start the server. Point your Web browser to
http://localhost:8080/console to open the Administrative Console login page.
2. Enter the user name and password (system and manager by default) to open
the Administrative Console as shown in the Figure 6-2.
Figure 6-2 Administrative Console
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
155
3. Click Database Pools in the left navigation plane to open the database pools
page.
4. In the Database Pools page in the Create a new database pool section, click
Using the Geronimo database pool wizard to open the wizard for creating
a database pool as shown in the Figure 6-3.
Figure 6-3 Database pools wizard
156
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Enter the name of the database pool as jdbc/PlantsByWebSphere and the
database type as DB2. Click Next to open a page similar to Figure 6-4.
Figure 6-4 Create database pool window
6. Complete the following fields:
JDBC Driver Class:
Driver JAR:
DB User Name:
DB Password:
Port:
Database:
Host:
com.ibm.db2.jcc.DB2Driver
com.ibm.db2/db2jcc/8.2/jar
com.ibm.db2/db2jcc_license_cu/8.2/jar
db2admin
db2admin
50000
PLANTSDB
localhost (because the DB2 instance is also on the
same machine)
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
157
7. Click Next to open a window as shown in Figure 6-5.
Figure 6-5 Database Pools window
8. Click Skip Test and Show Plan to see the plan in a text area. Copy this plan
to the <plants_home>/plan directory and into the pbwdbplan.xml file.
Change the value of the name tag inside the connectiondefinition-instance
tag to jdbc/PlantsByWebSphere from PlantsByWebSphere and save it.
You have to go through this additional step because WebSphere Application
Server Community Edition V1.1.0.1 seems to strip off jdbc/ from
jdbc/PlantsByWebSphere when you deploy using the Administrative Console
database pool wizard.
9. Use this plan to deploy the data source from the Install new Applications
window. The archive field should include the path of the tranql connector
default-connector, for example:
<wasce_home>\repository\tranql\tranql-connector\1.2\tranql-connector-1.2.rar)
The field also needs to include the plan field the path of the plan.
158
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Deploying the application in WebSphere Community Edition
To deploy the Plants by WebSphere application on WebSphere Application
Server Community Edition, follow these steps:
1. To deploy the Plants by WebSphere application on WebSphere Application
Server Community Edition, we need to first build it. To build the application:
a. Open the command line console and change the directory to
<plants_home>.
b. Enter maven to build the application. The built EAR will be available in the
<plants_home>\PlantsByWebSphereEAR\target directory.
2. Modify the pbwdeploy-plan.xml (Example 6-1) to have a dependency on the
data source that you created in the previous section, for example on
jdbc/PlantsByWebSphere/1.0/rar in this example. For this example, the
dependencies element needs to be changed.
Example 6-1 Modify pbwdeploy-plan.xml - dependency elements
<dep:dependencies>
<dep:dependency>
<dep:groupId>jdbc</dep:groupId>
<dep:artifactId>PlantsByWebSphere</dep:artifactId>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
3. To deploy the application, click Deploy New link in the left navigation pane of
the Administrative Console to show the Install New Applications page. In the
Archive field, enter the path of the EAR file, for example:
<plants_home>\PlantsByWebSphereEAR\target\PlantsByWebSphereEAR-1.1.1.ear
Also, in the Plan field, enter the path of the plan, for example:
<plants_home>\plans\pbwdeploy-plan.xml
Click Deploy to deploy the application.
4. To add security permissions, go to <wasce_home>\var\security and add the
line root=password to users.properties file.
5. Then, restart the server.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
159
6. Open http://localhost:8080/PlantsByWebSphere/ to open the Plants by
WebSphere sample application home page (shown in Figure 6-6).
Figure 6-6 Plants by WebSphere sample application home page
160
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Testing the application
Before you test the application, you need to populate the database tables. The
Plants by WebSphere sample application has the facility to do populate the
database tables.
To populate the data, follow these steps:
1. In the Plants by WebSphere home page, click Help in the top navigation bar
to open the Help main window as shown in Figure 6-7.
Figure 6-7 Help window for Plants by WebSphere window
2. Now, click (Re)Populate Database to open a prompt for the user name and
password. Enter the user name as root and the password as password. Then,
click OK to populate the database. Now you can use the application.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
161
3. From the Plants by WebSphere home page, click Flowers in the top
navigation bar to open the page shown in Figure 6-8.
Figure 6-8 Flowers page in the Plants by WebSphere application
162
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Next, click Baby Breath to open the window shown in Figure 6-9.
Figure 6-9 Baby Breath window
5. Click Add to cart to open the next window, following the Shopping Cart
window, and then click Checkout Now to open the Login or Register page.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
163
6. In the E-mail address field, enter [email protected] and in
the password field enter plants and click Sign in to open the checkout page
shown in Figure 6-10.
Figure 6-10 Checkout window
7. Complete the fields in the Checkout window and click Continue to go to the
Review Your Order page.
164
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. Now click Submit Order to go to the Order Completion page shown in
Figure 6-11.
Figure 6-11 Order Completion window
If you are able to come this far, then the application is working as expected.
6.3.5 Configuring the target environment
After following the steps that are given in the previous section, you can build and
deploy the sample application into WebSphere Application Server Community
Edition V1.1.0.1. In this section, we explain the steps involved in migrating this
application to WebSphere Application Server V6.1 - Base.
Note: If you have not created the database for the sample application, you
need to perform the steps in “Creating the sample application database” on
page 154 before you continue.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
165
Creating a new connection pool and data source
To create a new connection pool and data source, follow these steps:
1. Click Start → All Programs → IBM WebSphere → Application server
V6.1 → Profiles → AppSrv01 → Start the server to start the WebSphere
Application Server Base instance on your computer.
2. Click Start → All Programs → IBM WebSphere → Application server
V6.1 → Profiles → AppSrv01 → Administrative Console to open the
Administrative Console for the WebSphere Application Server Base instance.
3. When you see the login page, enter the user name that you want and click
Login to enter the Welcome page that is shown in Figure 6-12.
Figure 6-12 Welcome page
166
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Select Resources → JDBC → JDBC Providers from the left navigation
pane in the browser to open the JDBC Providers page shown in Figure 6-13.
Figure 6-13 JDBC providers page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
167
5. In the JDBC providers window, set the scope to the server level and click
New to open the Create new JDBC provider page, as shown in Figure 6-14.
Figure 6-14 Create a new JDBC provider page
168
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. In the “Create new JDBC provider” page, select the database type as DB2,
the provider type as DB2 Universal JDBC Driver Provider, and the
implementation type as Connection pool data source. Click Next to open the
database class path configuration page as shown in Figure 6-15.
Figure 6-15 Database class path information page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
169
7. Complete the field that denotes the value of the variable
DB2UNIVERSAL_JDBC_DRIVER_PATH with the path of the directory that includes
db2jcc.jar (for example, C:\Program Files\IBM\SQLLIB\java) and click Next to
open the summary page shown in Figure 6-16.
Figure 6-16 Summary page
170
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. In the Summary page, click Finish and you are taken back to the JDBC
providers page. Click Save to save the configuration changes that you have
made. Now, the new provider that you created is visible in the JDBC
providers page, as shown in Figure 6-17.
Figure 6-17 JDBC providers page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
171
9. From the left navigation pane, select Resources → JDBC → Data sources
to open the window shown in Figure 6-18.
Figure 6-18 Data sources page
172
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.Select Server scope and click New to go to open the page shown in
Figure 6-19.
11.In this page, complete the following fields:
Data source name:
JNDI name:
PlantsByWebSphereDatasource
jdbc/PlantsByWebSphere
Figure 6-19 Basic data source information page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
173
12.Click Next to open the next page shown in Figure 6-20.
13.In this page, under Specify a JDBC provider to support this data source, click
Select an existing JDBC provider. Select the JDBC provider that you just
created.
Figure 6-20 Create a data source (Step 2: Select JDBC provider) page
174
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
14.Click Next to open the database specific properties window (shown in
Figure 6-21).
15.In this page, complete the following fields:
Database name:
Driver type:
Server name:
Port number:
PLANTSDB
4
localhost
50000
The “Use this data source in container managed persistence (CMP)” option is
selected by default.
Figure 6-21 Database specific properties for the data source page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
175
16.Click Next to see the summary. Then, click Finish and save the
configuration. Now the data source is listed in the Data sources page as
shown in Figure 6-22.
Figure 6-22 Data sources page
176
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
17.From the left navigation pane, click Security → Secure administration,
applications and infrastructure to open a page as shown in Figure 6-23.
Figure 6-23 Secure administration, applications, and infrastructure page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
177
18.From the Secure administration page, expand the Java Authentication and
Authorization Service tree and select J2C authentication Data to open the
page shown in Figure 6-24.
Figure 6-24 J2C authentication data page
178
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
19.Click New to open a page similar to Figure 6-25.
Figure 6-25 New - General Properties page
20.Enter the alias, user ID, and password that you use to access the database.
In our example, we used PBW as the alias. The user ID and password are
db2admin and db2admin. You use the user ID and password to connect to
the database to create the tables. Click Apply and then Save to open a page
similar to the one shown in Figure 6-24.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
179
21.Now go back to the Data sources page by clicking Resources → JDBC →
Data sources and then clicking PlantsByWebSphereDatasource to open
the Data sources configuration details page (Figure 6-26).
Figure 6-26 Data source configuration details page
22.Now in the component-managed authentication alias drop-down menu, select
the alias that you just created (for example, blade19Node01/PBW) and click
Apply. You do this to configure this data source to use the user name and
password that you defined earlier while connecting to the database.
23.Click Save to save the changes. Test the connection using the Test
Connection button. If the process is successful, then the data source is
configured.
180
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Configuring Java mail
The Plants by WebSphere application makes use of the Java Mail API to send
e-mail messages. So, you need to configure WebSphere Application Server V6.1
- Base to provide the application with a MailSession object that the application
can use to send e-mails.
To configure Java mail, follow these steps:
1. Expand the mail section in the left navigation pane.
2. Click Mail Providers to open the Mail Providers page shown in Figure 6-27.
Notice that there is already a default mail provider available. So, you do need
not to create one.
Figure 6-27 Mail Providers page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
181
3. Click Mail sessions to open the Mail Sessions page as shown in Figure 6-28.
Figure 6-28 Mail Sessions page
182
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. In the Scope field, select the server scope. For our example, we selected
cell=blade19Node01Cell, Node=blade19Node01, and Server=server1.
Click New to open the mail session configuration page shown in Figure 6-29.
5. Complete the following fields:
Name: PlantsByWebSphere Mail Session
JNDI name: mail/PlantsByWebSphere
Mail transport host: <your mail server hostname>
Mail transport protocol: smtp
Mail from: [email protected]
6. Enable strict Internet address parsing.
7. Click Apply and Save the configuration.
Figure 6-29 Mail session configuration page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
183
Configuring J2EE security
In WebSphere Application Server Community Edition V1.1.0.1, we use a file
based user registry and a properties file realm for securing access to the Plants
by WebSphere application. WebSphere Application Server V6.1 - Base provides
an operating system based security realm as well as an LDAP based realm. You
can also create custom realms. We use the FileRegistrySample user registry that
is provided with WebSphere Application Server V6.1 - Base to secure access to
the migrated Plants by WebSphere application.
Note: The FileRegistrySample user registry is for demonstration purposes.
For production, it is not recommended that you use the FileRegistrySample to
implement security.
To configure the custom realm, follow these steps:
1. Create two files: users.prop and groups.prop
– In the users.prop file, add root:password:root:administrators:root.
– In the groups.prop file, add administrators:administrators:root:admin.
184
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. From the left navigation pane, click Security → Secure administration,
applications, and infrastructure to open the Configuration page as shown
in Figure 6-30.
3. Select Enable Administrative Security, and clear the Use Java 2 Security
check box.
4. Select Standalone custom registry from Available realm definitions and
click Set as current.
Figure 6-30 Configuration page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
185
5. Now click Configure to configure the stand-alone custom registry that you
selected and to open the page shown in Figure 6-31.
6. Select Automatically generated server identity and verify that the custom
registry class name text field includes the entry
com.ibm.websphere.security.FileRegistrySample. Then, click Apply.
Figure 6-31 Configuration page
186
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. Click Custom properties, and in the Custom Properties page, click New to
open a page similar to the one shown in Figure 6-32.
Figure 6-32 GroupsFile configuration page
8. In this page, complete the following fields:
Name: usersFile
value: C:\users.prop
Click Apply.
9. Repeat steps 7 and 8 with the following values:
Name: groupsFile
value: C:\groups.prop
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
187
10.Save the changes, and you see a page similar to Figure 6-33.
Figure 6-33 Custom properties page
11.Click Standalone custom registry to open a window similar to the one
shown in Figure 6-31 on page 186.
12.In the “Primary administrative user name” field, enter root and click OK. This
opens the Secure administration, applications, and infrastructure page.
13.Select Enable administrative security and clear Use Java 2 Security. In
available realm definitions, select Standalone Custom Registry → Set as
current.
188
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
14.Click Apply and then click Save to save to the master configuration to open a
window similar to that shown in Figure 6-34.
Figure 6-34 Security Configuration Wizard page
15.From the Start menu, click Start → All Programs → IBM WebSphere →
Application server V6.1 → Profiles → AppSrv01 → Stop the server.
6.3.6 Migrating the application
Application Server Toolkit V6.1 comes with WebSphere Application Server V6.1 Base. Application Server Toolkit is a stripped down IDE that is provided along
with the WebSphere Application Server Family for preparing and validating
application before deployment into the server. We describe the steps to install
the Application Server Toolkit V6.1 in 4.6, “Installing WebSphere Application
Server Toolkit V6.1” on page 97.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
189
We now import the application into Application Server Toolkit, perform the steps
that are required for migrating the application to WebSphere, and build the
application that will run on WebSphere Application Server V6.1 - Base. This
migration might also require some code changes to the application because of
some code that does not work on WebSphere Application Server V6.1 - Base.
The steps for migrating the application are:
1. Start the Application Server Toolkit V6.1. Press OK when you see the
workspace creation dialog box. When Application Server Toolkit boots, close
the welcome window to see the workbench.
2. Run the maven command from the <plants_home> directory to build the Plants
by WebSphere project and to generate an EAR file.
3. In Application Server Toolkit, click File → Import → EAR and click Next.
4. Select the EAR file from the file system using the Browse button and click
Finish (Figure 6-35).
Figure 6-35 Import window
190
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. This imports the application into the workspace and prompts you whether to
open the J2EE perspective. Click Yes and the application is shown in the
J2EE perspective as shown in Figure 6-36.
Figure 6-36 Project Explorer window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
191
6. From the left navigation pane, select and expand Dynamic Web Projects →
PlantsByWebSphereWeb-1.1.1. Right-click the src directory and select
Import. This opens the import dialog box as shown in Figure 6-37.
7. Select File system and click Next.
Figure 6-37 Select an import source
192
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. In the “From directory” field, enter the path to the source folder (for example,
<plants_home>\PlantsByWebSphereWEB\src\java), as shown in Figure 6-38.
Figure 6-38 File system window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
193
9. Now select com as shown in Figure 6-39. Click Finish.
Figure 6-39 File system window
194
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.Click EJB Projects → PlantsByWebSphereEJB-1.1.1 → ejbModule
(Figure 6-40).
Figure 6-40 Project explorer window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
195
11.Right-click ejbModule and select Import.
12.Select File system and then click Next (Figure 6-41).
Figure 6-41 Select window
196
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
13.In the “From directory” field, enter the path to the src folder (for example,
<plants_home>\PlantsByWebSphereEJB\src\java.
14.Next, select com as shown in Figure 6-42. Click Finish to import the source
into Eclipse.
Figure 6-42 File system window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
197
Resolving issues found by Application Server Toolkit
To resolve issues found by Application Server Toolkit, follow these steps:
1. Resolve any issues that Application Server Toolkit finds. To fix any build path
errors, add the EJB project PlantsByWebSphereEJB-1.1.1 to the build path of
the Web project PlantsByWebSphereWeb-1.1.1.
2. To resolve any JSP errors, turn off JSP syntax validation. Click Window →
Preferences → Validation as shown in Figure 6-43.
Figure 6-43 Validation window
198
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Making necessary changes to the code
Follow these steps to make changes to the code:
1. Now you need to make a few changes to the code. You need to change code
in the following files:
– com.ibm.websphere.samples.plantsbywebspherewar.Populate
– OrderItemBean
Example 6-2 and Example 6-3 show the modifications that you need to make
to these files.
You also need to modify the doPopulate method of Populate.java. To use the
new method, change addImage(id, image, catalog,servletContext) to
addImage(id, image, catalog);.
Example 6-2 The addImage method of Populate.java after modification
public static void addImage(String itemID, String fileName, Catalog
catalog) throws FileNotFoundException, IOException {
URL url =
Thread.currentThread().getContextClassLoader().getResource("images/" +
fileName);
Util.debug("URL: " + url);
fileName = url.getPath();
Util.debug("Fully-qualified Filename: " + fileName);
File imgFile = new File(fileName);
// Open the input file as a stream of bytes
FileInputStream fis = new FileInputStream(imgFile);
DataInputStream dis = new DataInputStream(fis);
int dataSize = dis.available();
byte[] data = new byte[dataSize];
dis.readFully(data);
catalog.setItemImageBytes(itemID, data);
}
Example 6-3 The ejbPostCreate of OrderItemBean.java after modification
public void ejbPostCreate(Order order, String orderID, String
inventoryID,
String name, String pkginfo, float price,
float cost,
int quantity, int category, String
sellDate)
throws javax.ejb.CreateException
{
this.setOrder(order);
}
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
199
2. After saving these changes, you need to build the application. It should build
without any errors.
Mapping resource references
To map resource references, follow these steps:
1. Now you need to map the resource references to the JNDI names of the
respective resources that you deployed on the server instance:
a. Double-click the Deployment Descriptor of the Web module
PlantsByWebSphereWeb-1.1.1 to open up the page in the Deployment
Descriptor Editor as shown in Figure 6-44.
b. Select the References tab.
c. Map all the resource references to the JNDI names of the actual resources
that you have configured on the server. Perform the following steps:
i. Select the first resource reference, for example
jdbc/PlantsByWebSphere. In the JNDI name field in the WebSphere
Bindings section, add the JNDI name of the resource in the server, for
example jdbc/PlantsByWebSphere.
ii. Select the next resource reference, for example
mail/PlantsByWebSphere. In the JNDI name field in the WebSphere
Bindings section, add the JNDI name of the resource in the server, for
example mail/PlantsByWebSphere.
200
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. After mapping the resource references, you need to map the EJB references
to the JNDI names of the EJBs or you need to give EJB links to the EJBs to
which they refer. Perform the following steps:
a. Double-click PlantsByWebSphereWeb-1.1.1 (the Deployment Descriptor
of the Web module) to open the page in the Deployment Descriptor Editor
as shown in Figure 6-44.
b. Select the References tab.
Figure 6-44 Project Explorer window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
201
c. Map all the EJB references to the JNDI names of the actual EJBs that will
be deployed on the server. Complete the following instructions:
i. Select the first EJB reference, for example, ejb/Login, and in the JNDI
name field of the WebSphere Bindings section, enter ejb/Login, as
shown in Figure 6-45.
ii. Similarly, enter the same JNDI names for all EJBs as the resource
reference name. Remember when you assign JNDI names to the
different EJBs to give the same names.
Table 6-1 provides the names that you use. Table 6-2 shows the
resource reference to JNDI name mapping.
Table 6-1 EJB, JNDI, and EJB Ref Names mapping
EJB Names
JNDI Names
EJB Ref Names
BackOrder
ejb/BackOrder
ejb/BackOrder
Customer
ejb/Customer
ejb/Customer
IdGenerator
ejb/IdGenerator
ejb/IdGenerator
Inventory
ejb/Inventory
ejb/Inventory
Order
ejb/Order
ejb/Order
OrderItem
ejb/OrderItem
ejb/OrderItem
Supplier
ejb/Supplier
ejb/Supplier
BackOrderStock
ejb/BackOrderStock
ejb/BackOrderStock
Catalog
ejb/Catalog
ejb/Catalog
Login
ejb/Login
ejb/Login
Mailer
ejb/Mailer
ejb/Mailer
ReportGenerator
ejb/ReportGenerator
ejb/ReportGenerator
ResetDB
ejb/ResetDB
ejb/ResetDB
ShoppingCart
ejb/ShoppingCart
ejb/ShoppingCart
Suppliers
ejb/Suppliers
ejb/Suppliers
Table 6-2 Resource reference to JNDI Name mappings
202
Resource-Reference
JNDI Name
plantsby/PlantsByWebSphereDataSource
jdbc/PlantsByWebSphere
jdbc/PlantsByWebSphere
jdbc/PlantsByWebSphere
mail/PlantsByWebSphere
mail/PlantsByWebSphere
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Figure 6-45 References window
3. Now open the EJB module’s Deployment Descriptor in the Deployment
Descriptor Editor and perform the following steps:
a. Open the overview tab of the Deployment Descriptor for the EJB module.
Go to WebSphere Bindings → JNDI CMP Connection Factory
Bindings and enter the JNDI Name as jdbc/PlantsByWebSphere and
container authorization type as per connection factory.
b. Open the Bean tab and select BackOrder. Go to the WebSphere Bindings
section and enter the JNDI name as ejb/BackOrder. Similarly, map JNDI
names for each of the beans. Follow the convention of adding ejb/ to the
name of the bean. Table 6-1 gives the EJB to JNDI Name mapping.
c. Finally, from the References tab match each of the EJB references to their
respective JNDI names. The EJB reference names are the same as the
JNDI names (shown in Table 6-1). Also map the resource references to
their respective JNDI names. Table 6-2 shows the resource reference to
JNDI name mapping.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
203
4. Now, you can generate the EJB to Database mappings. Right-click
PlantsByWebSphere EJB Module → EJB to RDB Mapping → Generate
Map as shown in Figure 6-46.
Figure 6-46 Generate Map window
204
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Select Create a new backend folder and click Next (Figure 6-47).
Figure 6-47 EJB to RDP Mapping window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
205
6. Select Meet-In-The-Middle approach and click Next, as shown in
Figure 6-48.
Figure 6-48 Create new EJB/RDB Mapping window
206
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. Click Next (Figure 6-49).
Figure 6-49 Select Connection window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
207
8. In the EJB to RDB Mapping window, from the left navigation pane, expand
DB2 UDB and select V8.2 option, as shown in Figure 6-50. Then, complete
the following fields:
Database: PLANTSDB
Host: localhost
Port number: 50000
User ID: db2admin
Password: db2admin
Click Test Connection.
9. If the connection is successful, then click Next
Figure 6-50 Connection Parameters window
208
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.Select DB2ADMIN schema and click Next, as shown in Figure 6-51.
Figure 6-51 Selective Database Import window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
209
11.Select Match By Name, and Type and click Finish, as shown in Figure 6-52.
Figure 6-52 Create new EJB/RDP Mapping window
210
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
This generates the EJB to RDB mappings and opens the Map.mapxmi file as
shown in Figure 6-53.
Figure 6-53 Project Explorer window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
211
12.Note that in the mapping file, Order EJB is not mapped to the ORDER1 table.
To map these two, drag and drop the icon that corresponds to the Order EJB
over the icon corresponding to the ORDER1 table. Right-click the icon that
corresponds to the ORDER1 table and select Match by Name. The table is
mapped to the EJB as shown in Figure 6-54.
Figure 6-54 Project Explorer window
212
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
13.Expand ORDERITEM from the Tables pane. Select ORDER_ORDERID
element and press the Delete button on the keyboard to delete the field.
Right-click ORDERITEM element and select Create and map database
elements from EJB elements (Figure 6-55).
This generates the foreign key relationship mappings.
Figure 6-55 Map database element window
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
213
14.In the left navigation pane, expand Enterprise Applications →
PlantsByWebSphereEAR-1.1.1 → PlantsByWebSphere. Double-click
PlantsByWebSphere to open the Deployment Descriptor Editor as shown in
Figure 6-56.
Figure 6-56 Application Deployment Descriptor page
15.Click Security to go to the Security page.
214
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
16.In the Security page, select SampAdmin. In the WebSphere Bindings
section, select Users/Groups. In the Users section, add the user root and in
the Groups section, add the group administrators as shown in Figure 6-57.
Figure 6-57 Security page
Exporting, deploying, and starting the application
Follow these steps to export, deploy, and start the Plants by WebSphere
application:
1. Right-click Enterprise application → Export to open the EAR Export
window. Enter the EAR application name and the Destination file name and
click Finish to export the migrated EAR. You can deploy this EAR file on
WebSphere without doing any additional configuration.
2. To deploy the EAR file open the Administrative Console.
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
215
3. Click Applications → Install New Application to open a window similar to
Figure 6-58.
Figure 6-58 Preparing for the application installation page
216
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Click Browse and select the EAR file that you want to deploy. Click Next.
5. In the Install New Application page, click Next (Figure 6-59).
Figure 6-59 Install New Application page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
217
6. Select the three modules, as shown in Figure 6-60. Then, click Next.
Figure 6-60 Install New Application page: Selecting the three modules
218
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. Click Finish to deploy the application (Figure 6-61). After deployment, click
Save link to save the changes to the master configuration.
Figure 6-61 Summary page
Chapter 6. Migrating WebSphere Application Server CE to WebSphere Application Server
219
8. From the left navigation pane, click Enterprise Applications to open the
window shown in Figure 6-62. Select PlantsByWebSphere and click Start to
start the application.
Figure 6-62 Enterprise Applications page
9. Open the Web browser and access the following Web page:
http://localhost:9080/PlantsByWebSphere/
10.You should be directed to the Plants by WebSphere home page. Now you
can go through the steps required to verify the application as documented in
the “Testing the application” on page 161.
220
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7
Chapter 7.
Developing the application
on WebSphere Application
Server Community Edition
This chapter takes you through the process of developing a J2EE 1.4 application
on WebSphere Application Server Community Edition V1.1.0.1 using Eclipse.
The different sections that make up this chapter are:
Introduction to this chapter
Prerequisites and assumptions
Developing Adventure Builder on WebSphere Application Server Community
Edition V1.1.0.1
Deploying the application on WebSphere Application Server Community
Edition V1.1.0.1
© Copyright IBM Corp. 2007. All rights reserved.
221
7.1 Introduction to this chapter
The application that we chose for demonstration is the Adventure Builder
application from Sun Microsystems, Inc. The application has been modified to
run on WebSphere Application Server Community Edition V1.1.0.1. You can find
information about how to obtain the source code for the application in
Appendix A, “Additional material” on page 493. You can build the application
using Ant.
In this chapter, we demonstrate the development of an EJB module and a Web
module using Eclipse. We also walk through the steps to create data sources
and JMS resources using the WebSphere Application Server Community Edition
Administrative Console.
7.2 Prerequisites and assumptions
This section describes the prerequisites and assumptions that need to be met in
order to follow the step-by-step demonstration for the development procedure.
The first requirement, the development environment must be set up on a system
as described in Chapter 4, “Installing and configuring the products for the
migration” on page 45. This chapter provides some initial background information
for those unfamiliar with IBM products.
You should be comfortable with J2SE 5.0 and also be familiar with basic J2EE
concepts like the Java runtime. You should be able to understand and run basic
SQL commands and should be familiar with WebSphere Application Server
Community Edition V1.1.0.1.
The following software needs to be installed before starting the development:
222
WebSphere Application Server Community Edition V1.1.0.1
DB2 Universal Database Express Edition V8.2
Eclipse Web Tools Platform
WebSphere Application Server Community Edition Eclipse Plugin 1.1.0.1
Apache Ant 1.7
Java Web Services Developer Pack 2.0
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7.3 Developing Adventure Builder on WebSphere
Application Server Community Edition V1.1.0.1
In this section, we discuss how to develop the Adventure Builder application on
WebSphere Application Server Community Edition V1.1.0.1.
7.3.1 About the Adventure Builder application
The Adventure Builder Reference application is a sample application from Sun
Microsystems, Inc. This sample application demonstrates how to use the
capabilities of the J2EE 1.4 platform to develop robust, scalable, portable, and
maintainable e-business applications and Web services.
The Adventure Builder application is composed of six EARs as given below:
ActivitySupplier consisting of one EJB module
AirlineSupplier consisting of one EJB module
LodgingSupplier consisting of one EJB module
Bank consisting of one EJB module
OrderProcessingCenter (OPC) consisting of two EJB modules
ConsumerWebsite consisting of one Web module
We demonstrate how to develop Adventure Builder by walking through the
creation of one of the EJB modules and the Web module using Eclipse Web
Tools Platform, XDoclet, WebSphere Application Server Community Edition
Eclipse Plugin, and Java Web Services Developer Pack 2.0.
Some important points to note about Adventure Builder include that it:
Uses a simple security model based on self-registration of users.
Accomplishes communication between modules using Web services.
The source for the Adventure Builder application is provided in the
adventure-src.zip file. (For information about how to obtain this file, see
Appendix A, “Additional material” on page 493.) Extract the source to a directory
of your choice. We refer to this directory as <adventure_src>. In our example, we
use C:\adventure1.0.1 as the source directory.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
223
7.3.2 Creating users for database access
The Adventure Builder application uses two users with the user names adventure
and adventurebuilder to access the database. To create new user accounts, use
the net user Windows command. Follow these steps:
1. Open a Command Prompt window.
2. To create the adventure account with the user ID adventure and the password
adventure, enter the following command:
net user adventure * /add
3. At the “Type a password for the user” prompt, enter adventure.
4. At the “Retype the password to confirm” prompt, re-enter the password. A
message displays when the command completes successfully. This step
completes the creation of the user adventure.
5. Similarly, create the adventurebuilder user with the user ID adventurebuilder
and the password adventurebuilder.
7.3.3 Database, data sources, and JMS resources
In this section, we discuss the steps to create a database, data sources, JMS
Queue Connection Factories, and queues.
Adventure Builder database
Adventure Builder database uses tables under two schema names, namely
ADVENTURE and ADVENTUREBUILDER. The SQL scripts necessary to create
the database tables are provided under <adventure_src>\src\SG247433\sql. Use
the following steps to create the Adventure Builder database:
1. Launch a DB2 CLP (Command Line Processor) by running the db2cmd
command using Start → Run.
2. Change the directory to <adventure_src>\src\SG247433\sql. Execute the
following commands:
db2
db2
db2
db2
db2
create db ADVNTRDB
connect to ADVNTRDB user db2admin using db2admin
-tvf adventure-catalog.sql
-tvf adventure-builder.sql
-tvf grant-permissions.sql
These commands create the database and tables, populate the database
with sample data, and grant necessary user permissions to the tables.
224
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Creating new connection pools and data sources
The ConsumerWebsite uses a data source jdbc/CatalogDB to access the tables
in the ADVENTURE schema. The five EJB applications use a data source
jdbc/adventure/AdventureDB to access the tables in the ADVENTUREBUILDER
schema.
Create the jdbc/CatalogDB data source using the following steps:
1. If the server is not started, start the WebSphere Application Server
Community Edition server by clicking Start → All Programs → IBM
WebSphere → Application Server Community Edition → Start the
server.
2. Point your Web browser to http://localhost:8080/console to open the
Community Edition Administrative Console login page.
3. Enter the user name and password (system and manager by default) to open
up the Administrative Console as shown in the Figure 7-1.
Figure 7-1 Administrative Console
Chapter 7. Developing the application on WebSphere Application Server Community Edition
225
4. Click Database Pools in the left navigation pane to open the database pools
page as shown in Figure 7-2.
Figure 7-2 Administrative Console - Database Pools
226
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. In the Database Pools page of the Create a new database pool section, click
Using the Geronimo database pool wizard to open the wizard for creating
a database pool as shown in Figure 7-3.
6. Complete the following fields for Database Pool:
Name of Database Pool:
Database Type:
CatalogDB
DB2
Figure 7-3 Administrative Console - Create Database Pool
Chapter 7. Developing the application on WebSphere Application Server Community Edition
227
7. Click Next to open a window similar to Figure 7-4.
Figure 7-4 Create Database Pool - Driver Configuration
228
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. Click Next to open the window as shown in Figure 7-5.
9. Complete the following fields for JDBC Driver Configuration:
JDBC Driver Class:
Driver JAR:
DB User Name:
DB Password:
Port:
Database:
Host:
com.ibm.db2.jcc.DB2Driver
com.ibm.db2/db2jcc/8.2/jar
com.ibm.db2/db2jcc_license_cu/8.2/jar
adventure
adventure
50000
ADVNTRDB
localhost (because the DB2 instance is also on the
same machine)
10.Complete the following fields for Connection Pool configuration:
JDBC Connect URL:
Pool Min Size:
Pool Max Size:
Blocking Timeout:
Idle Timeout:
jdbc:db2://localhost:50000/ADVNTRDB
0
10
5000
10
Figure 7-5 Create Database Pool - Pool Configuration
Chapter 7. Developing the application on WebSphere Application Server Community Edition
229
11.Click Skip Test and Show Plan to see the plan in a text area as shown in
Figure 7-6.
Figure 7-6 Create Database Pool - View Plan
12.Copy the text into a text editor and make the following changes:
a. Change the groupId under moduleId from console.dbpool to adventure.
b. Change the name under connectiondefinition-instance from CatalogDB
to jdbc/CatalogDB.
13.Save the file to disk. Use this plan to deploy the data source from the Deploy
New page. The archive field needs to include the path of the tranql connector
(default-connector), for example:
<wasce_home>\repository\tranql\tranql-connector\1.2\tranql-connector-1.2.rar
Also, the plan field needs to include the path of the plan.
230
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
14.To create jdbc/adventure/AdventureDB data source, follow steps 5 through 13
with the following changes:
a. In step 6, use Database Pool Name AdventureDB.
b. In step 9, use adventurebuilder for User Name and Password fields.
c. In step 12, change the groupId under moduleId from console.dbpool to
adventure and name under connectiondefinition-instance to
jdbc/adventure/AdventureDB.
When all the data sources are created, the Database Pools window in the
Administrative Console will look similar to Figure 7-7.
Figure 7-7 Administrative Console - Database Pools
Chapter 7. Developing the application on WebSphere Application Server Community Edition
231
Creating JMS resources
In this section, we create the JMS Queue Connection Factories and Queues
used by the Adventure Builder application. Table 7-1 shows the list of resources.
Table 7-1 Adventure Builder JMS resources
Resource Type
Resource Name
JNDI Name
Application EAR
javax.jms.QueueC
onnectionFactory
jms/activity/Queue
ConnectionFactory
jms/activity/Queue
ConnectionFactory
ActivitySupplier
javax.jms.Queue
jms/activity/Activity
Queue
jms/activity/Activity
Queue
ActivitySupplier
javax.jms.QueueC
onnectionFactory
jms/airline/QueueC
onnectionFactory
jms/airline/QueueC
onnectionFactory
AirlineSupplier
javax.jms.Queue
jms/airline/AirlineQ
ueue
jms/airline/AirlineQ
ueue
AirlineSupplier
javax.jms.QueueC
onnectionFactory
jms/lodging/Queue
ConnectionFactory
jms/lodging/Queue
ConnectionFactory
LodgingSupplier
javax.jms.Queue
jms/lodging/Lodgin
gQueue
jms/lodging/Lodgin
gQueue
LodgingSupplier
javax.jms.QueueC
onnectionFactory
jms/opc/QueueCo
nnectionFactory
jms/opc/QueueCo
nnectionFactory
OPC
javax.jms.Queue
jms/opc/OrderFiller
Queue
jms/opc/OrderFiller
Queue
OPC
javax.jms.Queue
jms/opc/CRMQueu
e
jms/opc/CRMQueu
e
OPC
javax.jms.Queue
jms/opc/WebServic
eBrokerQueue
jms/opc/WebServic
eBrokerQueue
OPC
javax.jms.Queue
jms/opc/WorkFlow
MgrQueue
jms/opc/WorkFlow
MgrQueue
OPC
Create the AirlineSupplier related JMS resources using the following steps:
1. If the server is not started, start the WebSphere Application Server
Community Edition server. Click Start → All Programs → IBM
WebSphere → Application Server Community Edition → start the server.
2. Point your Web browser to http://localhost:8080/console to open the
Administrative Console login page.
3. Enter the user name and password (system and manager by default) to open
up the Administrative Console as shown in the Figure 7-1 on page 225.
232
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Under Console Navigation, click JMS Resources to see the JMS Resources
page as shown in Figure 7-8.
Figure 7-8 Administrative Console - JMS Resources
Chapter 7. Developing the application on WebSphere Application Server Community Edition
233
5. Under Create a new JMS Resource Group section, click For ActiveMQ to
launch the wizard shown in Figure 7-9.
6. Complete the following fields to Configure Server Connection:
Resource Group Name:
ServiceUrl:
UserName:
Password:
airline-jms
tcp://localhost:61616
defaultUser
defaultPassword
Figure 7-9 Create JMS Resource Group - Server Configuration
234
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. Click Next to proceed to add JMS Resources as shown in Figure 7-10.
Figure 7-10 Create JMS Resource Group - Current Progress
Chapter 7. Developing the application on WebSphere Application Server Community Edition
235
8. Click Add Connection Factory (Figure 7-11).
Figure 7-11 Create JMS Resource Group - Connection Factory Type
236
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9. Select javax.jms.QueueConnectionFactory for JMS Factory Type. Click
Next to proceed to configure Connection Factory as shown in Figure 7-12.
Figure 7-12 Create JMS Resource Group - Configure Connection Factory
10.Complete the following fields for Connection Factory:
Connection Factory Name: jms/airline/QueueConnectionFactory
Transaction Support:
XA
Leave the Connection Pool Parameters blank to use default values.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
237
11.Click Next to see the Current Progress as shown in Figure 7-13.
Figure 7-13 Create JMS Resource Group - Current Progress
238
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
12.Click Add Destination to open a window shown in Figure 7-14.
Figure 7-14 Create JMS Resource Group - Destination Type
Chapter 7. Developing the application on WebSphere Application Server Community Edition
239
13.Select javax.jms.Queue for JMS Destination Type. Click Next to configure
the Destination as shown in Figure 7-15.
14.Complete the following fields for Destination:
Message Destination Name:
Physical Name:
jms/airline/AirlineQueue
jms/airline/AirlineQueue
Figure 7-15 Create JMS Resource Group - Configure Destination
240
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.Click Next to see the Current Progress (Figure 7-16).
Figure 7-16 Create JMS Resource Group - Current Progress
Chapter 7. Developing the application on WebSphere Application Server Community Edition
241
16.Click Show Plan to view the plan in a text area, as shown in Figure 7-17.
Figure 7-17 Create JMS Resource Group - View Plan
17.Copy the plan content to a text editor and make the following changes:
a. Change groupId under moduleId to adventure.
b. Change resourceadapter-name under resourceadapter-instance to
jms/airline/QueueConnectionFactory.
18.Save the plan to disk. Use this plan to deploy the JMS resources from the
Deploy New page in Administrative Console. The archive field needs to
include the path of activemq.rar, for example:
<wasce_home>\repository\geronimo\ge-activemq-rar\1.1.1\ge-activemq-rar-1.1.1.rar
The plan field needs to include the path of the saved plan.
This completes the creation of JMS Resources used by AirlineSupplier.
242
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
19.Create ActivitySupplier related JMS resources using steps 4 through 18 with
the following changes:
a. In step 6, use activity-jms for Resource Group Name.
b. In step 10, use jms/activity/QueueConnectionFactory for Connection
Factory Name.
c. In step 14, use jms/activity/ActivityQueue for Message Destination Name
and Physical Name.
d. In step 17, change groupId under moduleId to adventure. Change
resourceadapter-name under resourceadapter-instance to
jms/activity/QueueConnectionFactory.
20.Create LodgingSupplier related JMS resources using steps 4 through 18 with
the following changes:
a. In step 6, use lodging-jms for Resource Group Name.
b. In step 10, use jms/lodging/QueueConnectionFactory for Connection
Factory Name.
c. In step 14, use jms/lodging/LodgingQueue for Message Destination Name
and Physical Name.
d. In step 17, change groupId under moduleId to adventure. Change
resourceadapter-name under resourceadapter-instance to
jms/lodging/QueueConnectionFactory.
21.Create OrderProcessingCenter related JMS resources using steps 4 through
18 with the following changes:
a. In step 6, use opc-jms for Resource Group Name.
b. In step 10, use jms/opc/QueueConnectionFactory for Connection Factory
Name.
c. Repeat steps 12 through 15 four times with the following information as
Message Destination Name and Physical Name in step14:
•
•
•
•
jms/opc/OrderFillerQueue
jms/opc/CRMQueue
jms/opc/WebServiceBrokerQueue
jms/opc/WorkFlowMgrQueue
d. In step 17, change groupId under moduleId to adventure. Change
resourceadapter-name under resourceadapter-instance to
jms/opc/QueueConnectionFactory.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
243
When you have created all the JMS Resources, the JMS Resources page in the
Administrative Console looks similar to Figure 7-18.
Figure 7-18 Administrative Console - JMS Resources
244
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7.3.4 Building the Adventure Builder application from source
In this section, we describe how to build the Adventure Builder application from
the source in <adventure_src> using Ant. The directory for our source is
C:\adventure1.0.1.
Build the application using the following steps:
1. Open a Command Prompt window and run the following commands to set the
environment variables:
set JAVA_HOME=<java_home>
set WASCE_HOME=<wasce_home>
set ANT_HOME=<ant_home>
set
CLASSPATH=%CLASSPATH%;%WASCE_HOME%\repository\org\apache\geronimo\sp
ecs\geronimo-j2ee_1.4_spec\1.1.1\geronimo-j2ee_1.4_spec-1.1.1.jar
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%
2. Edit the following entries in <adventure_src>\src\build.properties:
wasce.home=<wasce_home>
jwsdp.home=<jwsdp_home>
3. Change to the <adventure_src>\src directory and run the following
commands:
ant cleanall
ant
This completes building the Adventure Builder application from the source. The
EAR files will be available in the following directories:
<adventure_src>\src\apps\activitysupplier\build\activitysupplier.ear
<adventure_src>\src\apps\airlinesupplier\build\airlinesupplier.ear
<adventure_src>\src\apps\lodgingsupplier\build\lodgingsupplier.ear
<adventure_src>\src\apps\bank\build\bank.ear
<adventure_src>\src\apps\opc\build\opc.ear
<adventure_src>\src\apps\consumerwebsite\build\consumerwebsite.ear
Chapter 7. Developing the application on WebSphere Application Server Community Edition
245
7.3.5 Configuring the workspace for Eclipse
In this section, we provide step-by-step instructions on how to configure the
workspace for application development using Eclipse Web Tools Platform.
Creating the workspace
To create the workspace:
1. From Windows Explore, open <eclipse_home> and double-click eclipse.exe
to launch Eclipse. This opens a Workspace Launcher dialog box as shown in
Figure 7-19.
Figure 7-19 Configure Eclipse: Workspace Launcher
246
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. Enter the Workspace directory and click OK to open the Welcome window
(Figure 7-20). In our example, we used C:\AdventureWS.
Figure 7-20 Configure Eclipse: Welcome window
Chapter 7. Developing the application on WebSphere Application Server Community Edition
247
3. Click the icon on the right of the window to go to the workbench shown in
Figure 7-21.
Figure 7-21 Configure Eclipse: Workbench
248
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Configuring a new JRE
After you have opened the workbench, you need to configure a new JRE. Follow
these steps:
1. In the menu bar, click Window → Preferences to launch the Preferences
window.
2. Click Java → Installed JREs as shown in Figure 7-22.
3. Click Add to launch Add JRE wizard.
Figure 7-22 Configure Eclipse: Preferences
Chapter 7. Developing the application on WebSphere Application Server Community Edition
249
4. In the Add JRE dialog box (Figure 7-23), complete the following fields:
JRE type: Standard VM
JRE name: IBMJDK150
JRE home directory: C:\Program Files\IBM\Java50\jre
5. Click OK.
Figure 7-23 Configure Eclipse: Add JRE
250
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
The Installed JRE page shows IBMJDK150 listed in Installed JREs as shown
in Figure 7-24.
Figure 7-24 Configure Eclipse: Select IBMJDK
6. Select IBMJDK150 to use IBM JDK 1.5.0 with this workspace.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
251
Configuring XDoclet
Next you need to configure XDoclet. Follow these steps:
1. Click XDoclet in the left panel to set XDoclet Runtime Preferences as shown
in Figure 7-25.
2. Complete the following fields:
Check Enable XDoclet Builder
XDoclet Home: C:\xdoclet-1.2.3
Version: 1.2.3
3. Click Apply and click OK to return to the workbench window.
Figure 7-25 Configure Eclipse: Configure XDoclet
252
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Configuring Server Runtime
Next, you need to configure Server Runtime. Follow these steps:
1. In the menu bar, click Windows → Preferences to open the Preferences
window.
2. Click Server → Installed Runtimes as shown in Figure 7-26. Then, click
Add.
Figure 7-26 Configure Eclipse: Server Runtimes
Chapter 7. Developing the application on WebSphere Application Server Community Edition
253
3. In the New Server Runtime wizard, click IBM → WebSphere Community
Edition Server v1.1, as shown in Figure 7-27. Then, click Next.
Figure 7-27 Configure Eclipse: New Server Runtime
254
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Complete the following fields, as shown in Figure 7-28:
– JRE
IBMJDK150
– Application Server Installation Directory
C:\Program Files\IBM\WebSphere\AppServerCommunityEdition
5. Click Finish and click OK to return to the workbench.
Figure 7-28 Configure WebSphere Application Server Community Edition Runtime
This completes the configuration of the workspace.
7.3.6 Developing the LodgingSupplier EJB application
In this section, we guide you through the development of the LodgingSupplier
EJB application using XDoclet and the WebSphere Application Server
Community Edition Eclipse Plugin. The plugin internally uses XDoclet to
generate boilerplate code. You can also annotate the code with XDoclet tags to
generate the J2EE Deployment Descriptors completely from the code.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
255
The LodgingSupplier EJB Application includes:
Stateless Session Bean (Exposed as a Web service)
Entity Bean with Container Managed Persistence (CMP)
Message Driven Bean
The steps involved in developing an application using the WebSphere
Application Server Community Edition Eclipse Plugin and XDoclet are:
1. Go to the <eclipse_home> directory and run eclipse.exe to launch Eclipse
and to open the Welcome window. Close the Welcome window to gain
access to the workspace.
2. Select File → New → Project to open the New Project window.
3. Select Enterprise Application Project as shown in Figure 7-29. Then, and
click Next.
Figure 7-29 Select a Wizard window
256
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Complete the following fields as shown in Figure 7-30:
Project Name:
Target Runtime:
Configurations:
LodgingSupplier
WebSphere Community Edition Server 1.1
<custom>
5. Select Use default.
6. Click Next.
Figure 7-30 Create EAR application
Chapter 7. Developing the application on WebSphere Application Server Community Edition
257
7. In the Project Facets window, select Community Edition Deployment and
EAR facets, as shown in Figure 7-31. Then, click Next.
Figure 7-31 Project Facets window
258
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. In the J2EE Modules to Add to the EAR window (Figure 7-32), click Next.
Figure 7-32 J2EE Modules to Add to the EAR
Chapter 7. Developing the application on WebSphere Application Server Community Edition
259
9. In the Geronimo Deployment Plan window, enter the following values as
shown in Figure 7-33:
Group Id
Artifact Id
Version
Artifact Type
adventure
lodgingsupplier
1.0
ear
Figure 7-33 Configure deployment plan
10.Click Finish to create the Enterprise Application Project.
260
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
11.The Workspace opens, as shown in Figure 7-34. In menu bar, select File →
New → Project.
Figure 7-34 Project Explorer
Chapter 7. Developing the application on WebSphere Application Server Community Edition
261
12.Select EJB → EJB Project as shown in Figure 7-35. Then, click Next.
Figure 7-35 Create and EJB project window
262
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
13.In the EJB Project dialog box, complete the following fields as shown in
Figure 7-36:
Project name
Target Runtime
Configurations
EAR Project Name
LodgingSupplier-EJB
WebSphere Community Edition Server v1.1
EJB Project with XDoclet
LodgingSupplier
14.Select Use default under “Project contents” and select Add project to an
EAR under “EAR Membership”.
15.Click Next.
Figure 7-36 New EJB Project window
Chapter 7. Developing the application on WebSphere Application Server Community Edition
263
16.In the Project Facets window, select all the facets and click Next as shown in
Figure 7-37.
Figure 7-37 Project Facets window
264
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
17.In the EJB Module window, clear the check box for the “Create an EJB Client
JAR module to hold the client interfaces and classes” option and click Next as
shown in Figure 7-38.
Figure 7-38 EJB Module
Chapter 7. Developing the application on WebSphere Application Server Community Edition
265
18.In the Geronimo Deployment Plan window, complete the following fields as
shown in Figure 7-39:
Group Id
Artifact Id
Version
Artifact Type
LodgingSupplier
LodgingSupplier-EJB
1.0
car
Figure 7-39 Geronimo Deployment Plan
266
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
19.Click Finish to create the LodgingSupplier-EJB project as shown in
Figure 7-40.
Figure 7-40 Project Explorer window
Chapter 7. Developing the application on WebSphere Application Server Community Edition
267
Creating the Enterprise Java Beans
To create the Enterprise Java Beans:
1. In the Project Explorer window, right-click ejbModule and select New →
Other to open the Select a wizard window.
2. Select EJB → XDoclet Enterprise Javabean and click Next.
3. In the Create an EnterpriseJavaBean window, select Session Bean and click
Next as shown in Figure 7-41.
Figure 7-41 Create an EnterpriseJavaBean window
268
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. In the EnterpriseJavaBean window, complete the following fields as shown in
Figure 7-42:
Java package
Class name
Superclass
com.sun.j2ee.blueprints.lodgingsupplier.powebservice
LodgingPOEndpointBean
java.lang.Object
5. Click Next.
Figure 7-42 Specify class file destination
Chapter 7. Developing the application on WebSphere Application Server Community Edition
269
6. Complete the following fields as shown in Figure 7-43:
EJB Name
JNDI Name
Display Name
Description
State Type
Transaction Type
LodgingPOEndpoint
LodgingPOEndpointBean
LodgingPOEndpointBean
An EJB Named LodgingPOEndpoint
Stateless
Container
7. Click Next.
Figure 7-43 Create an EnterpriseJavaBean
8. Click Finish to generate the EJB.
270
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9. To generate a Message Driven Bean, repeat step 1 on page 268, select
Message Driven Bean, and click Next.
10.In the Create an EnterpriseJavaBean window, complete the following fields
as shown in Figure 7-44:
Java package
Class Name
Super class
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean
LodgingMessageBean
java.lang.Object
11.Click Next.
Figure 7-44 Specify class file destination
Chapter 7. Developing the application on WebSphere Application Server Community Edition
271
12.Complete the following fields as shown in Figure 7-45:
EJB Name
Destination JNDI Name
Display Name
Description
Destination
Transaction Type
LodgingMessage
LodgingMessageBean
LodgingMessageBean
An EJB named Lodging Message
Queue
Container
13..Click Next.
Figure 7-45 Create an EnterpriseJavaBean
272
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
14.Click Finish to generate the EJB classes (Figure 7-46).
Figure 7-46 Specify modifiers, interfaces to implement, and method stubs to generate
Chapter 7. Developing the application on WebSphere Application Server Community Edition
273
The main workspace opens as shown in Figure 7-47.
Figure 7-47 Project Explorer window
274
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.To generate an Entity Bean, repeat step 1 on page 268. Select Container
Managed Entity Bean and click Next.
16.Complete the following fields as shown in Figure 7-48:
Java package com.sun.j2ee.blueprints.lodgingsupplier.purchaseorder.ejb
Class name LodgingOrderBean
Super class java.lang.Object
17.Click Next.
Figure 7-48 Specify class file destination
Chapter 7. Developing the application on WebSphere Application Server Community Edition
275
18.Complete the following fields as shown in Figure 7-49:
EJB Name
Schema
Display Name
Description
CMP Version
Usecase
LodgingOrder
LodgingOrder
LodgingOrderBean
An EJB named Lodging Order
2.x
Import attributes from table
19.Click Next.
Figure 7-49 ContainerManagedPersistence Entity Bean Wizard
276
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
20.In the JDBC Connection configuration window, click New as shown in
Figure 7-50.
Figure 7-50 New JDBC Connection
Chapter 7. Developing the application on WebSphere Application Server Community Edition
277
21.Complete the following fields as shown in Figure 7-51:
Database
JDBC driver class
Class location
Connection URL
ADVNTRDB
com.ibm.db2.jcc.DB2Driver
C:\Program
Files\IBM\SQLLIB\java\db2jcc.jar;C:\Program
Files\IBM\SQLLIB\java\db2jcc_license_cu.jar
jdbc:db2://9.42.170.178:50000/advntrdb
22.Click Next and click Finish to create the connection definition.
Figure 7-51 Connection Parameters window
278
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
23.Select ADVNTRDB and click Next as shown in Figure 7-52.
Figure 7-52 New JDBC Connection
Chapter 7. Developing the application on WebSphere Application Server Community Edition
279
24.In the CMP Attributes window, from the Table menu select
ADVENTUREBUILDER.LODGINGORDERBEAN, which is the table that is
associated with the EJB that you are creating now, as shown in Figure 7-53.
25.Click Next.
Figure 7-53 Define CMP attributes
280
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
26.Click Finish to create the CMP Entity Bean (Figure 7-54).
Figure 7-54 Specify modifiers, interfaces to implement, and method stubs generate
Chapter 7. Developing the application on WebSphere Application Server Community Edition
281
Figure 7-55 shows the created EJB.
Figure 7-55 Project Explorer
Importing the source code for the EJBs
You have now created the three EJBs that compose the application. We do not
discuss how to fill in the source code for these beans. Instead, we import the
source code from the <source dir>.
Here are the source files that you need to import by their package names:
com.sun.j2ee.blueprints.lodgingsupplier
JNDINames.java
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean
InvalidDocumentException
Invoice
LodgingMessageBean
LodgingMessageMdb
282
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
LodgingMessageUtil
ProcessingException
WebServiceBroker
com.sun.j2ee.blueprints.lodgingsupplier.powebservice
InvalidOrderException
LodgingOrder
LodgingPOEndpoint
LodgingPOEndpointBean
LodgingPOEndpointSession
OrderSubmissionException
com.sun.j2ee.blueprints.lodgingsupplier.purchaseorder.ejb
LodgingOrderBean
LodgingOrderCMP
LodgingOrderData
LodgingOrderLocal
LodgingOrderLocalHome
You also need to import the WebSphere Application Server Community Edition
specific deployment plan, because XDoclet only supports generation of the J2EE
Deployment Descriptor. So, the EJBs that you have imported are annotated to
generate the ejb-jar.xml file but not the openejb-jar.xml file. You need to import
the WebSphere Application Server Community Edition specific deployment plan
from the META-INF directory of the LodgingSupplier-EJB project that is included
in the source files that we provide with this book.
Because some of the EJBS in this module refer to the servicelocator utility jar,
you need to import this .jar file as well.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
283
To import the source code, complete the following steps:
1. Right-click LodgingSupplier project and select Import → J2EE Utility Jar.
2. Select the “Copy Utility Jars into an existing EAR from an external location”
option as shown in Figure 7-56 and click Next.
Figure 7-56 Utility Jar Import
284
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. In the External Jar directory field, enter the location of the parent directory for
the servicelocator.jar file, for example
C:\adventure1.0.1\src\components\servicelocator\build, as shown in
Figure 7-57.
4. In the Utility Jars and the web libraries section, select the servicelocator.jar
file and click Finish to import the jar.
Figure 7-57 Import dependent Utility Jars for J2EE Enterprise Applications
Chapter 7. Developing the application on WebSphere Application Server Community Edition
285
5. Now right-click LodgingSupplier-EJB and select Properties.
6. In Available dependent JARs, select servicelocator.jar. Then, click OK to
resolve all compilation errors (Figure 7-58).
Figure 7-58 J2EE Module Dependencies
Configuring Web Services
The Lodging Supplier Module exposes the LodgingPOEndpointBean as a Web
service. You can invoke the submitLodgingReservationDetails method through
the Web service. It also uses a Web service called WebServiceBroker. The
Lodging Supplier Module is, therefore, both a provider and consumer of Web
services. In the following sections, we explains how to expose the
LodgingPOEndpointBean as a Web service, as well as, how to generate a client
to invoke the WebServiceBroker service.
286
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Exposing a Stateless Session Bean as a Web Service
To expose the stateless session bean LodgingPOEndpointBean as a Web
service, perform the following steps:
1. Create a Service Endpoint Interface.
You need to decide the methods that you need to expose as a Web service
and then create an interface that extends java.rmi.Remote with those
methods. This interface is called the Service Endpoint Interface (SEI).
Example 7-1 shows the interface.
Example 7-1 Service Endpoint Interface - LodgingPOEndpoint.java
package com.sun.j2ee.blueprints.lodgingsupplier.powebservice;
import java.rmi.Remote;
import java.rmi.RemoteException;
/**
* Interface for the web service endpoint of lodging supplier that
receives PO
*/
public interface LodgingPOEndpoint extends Remote {
public String submitLodgingReservationDetails(String poXmlString)
throws InvalidOrderException, OrderSubmissionException,
RemoteException;
}
You expose the submitLodgingReservationDetails method in the Web
service.
2. Use the wscompile tool provided in the Sun JWSDP v2.0 to create the WSDL
file and the JAX-RPC mapping file. The wscompile tool takes an XML
configuration as input in which you specify which interface needs to be
exposed as a Web service. Example 7-2 shows this file.
Example 7-2 The po-jaxrpc-config.xml file
<configuration
xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
<service name="LodgingPurchaseOrderService"
targetNamespace="urn:LodgingPurchaseOrderService"
typeNamespace="urn:LodgingPurchaseOrderService"
packageName="com.sun.j2ee.blueprints.lodgingsupplier.powebservice">
<interface
name="com.sun.j2ee.blueprints.lodgingsupplier.powebservice.LodgingPOEnd
point"/>
Chapter 7. Developing the application on WebSphere Application Server Community Edition
287
<typeMappingRegistry />
</service>
</configuration>
Issue the following command to generate the mapping files:
wscompile -gen:server -d <generated> -mapping
<generated>\LodgingPurchaseOrderServiceMap.xml -cp
"<eclipse-workspace>\LodgingSupplier-EJB\build\classes;"
<configs>\po-jaxrpc-config.xml
In this command:
– <generated> is the directory to which the generated files need to be
stored.
– <eclipse-workspace> is the directory that includes your Eclipse
workspace.
– <configs> is the directory where you have created the configuration file
that you will input to wscompile. This configuration file will be similar to the
file in Example 7-2. The name of this file is po-jaxrpc-config.xml.
This command generates a jax-rpc mapping file called
LodgingPurchaseOrderServiceMap.xml and a WSDL file called
LodgingPurchaseOrderService.wsdl. Note that we specify the Service
Endpoint Interface in the po-jaxrpc-config.xml and wscompile uses this
information to generate the mapping files and the WSDL file.
Create a directory called wsdl in the META-INF directory of the
LodgingSupplier-EJB project in Eclipse. Next, import the WSDL file to the
META-INF/wsdl directory and the jax-rpc mapping file to the META-INF
directory of the LodgingSupplier-EJB project.
288
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Create a webservices.xml file with content as shown in Example 7-3 in the
META-INF directory of the LodgingSupplier-EJB project in Eclipse.
Example 7-3 The webservices.xml file
<?xml version="1.0" encoding="UTF-8"?>
<webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
version="1.1">
<description>desc</description>
<webservice-description>
<webservice-description-name>LodgingPurchaseOrderService</webservice-description-name
>
<wsdl-file>META-INF/wsdl/LodgingPurchaseOrderService.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/LodgingPurchaseOrderServiceMap.xml</jaxrpc-mapping-file
>
<port-component>
<description>port component description</description>
<port-component-name>LodgingPOIntfPort</port-component-name>
<wsdl-port
xmlns:LodgingPOns="urn:LodgingPurchaseOrderService">LodgingPOns:LodgingPOIntfPort</ws
dl-port>
<service-endpoint-interface>com.sun.j2ee.blueprints.lodgingsupplier.powebservice.Lodg
ingPOEndpoint</service-endpoint-interface>
<service-impl-bean>
<ejb-link>LodgingPOEndpoint</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
Chapter 7. Developing the application on WebSphere Application Server Community Edition
289
4. Modify ejb-jar.xml to link the EJB to the Web service as highlighted in
Example 7-4.
Example 7-4 The ejb-jar.xml file
<session id="Session_LodgingPOEndpoint">
<description><![CDATA[An EJB named LodgingPOEndpoint]]></description>
<display-name>LodgingPOEndpointBean</display-name>
<ejb-name>LodgingPOEndpoint</ejb-name>
<service-endpoint>
com.sun.j2ee.blueprints.lodgingsupplier.powebservice.LodgingPOEndpo
int
</service-endpoint>
<ejb-class>
com.sun.j2ee.blueprints.lodgingsupplier.powebservice.LodgingPOEndpo
intSession
</ejb-class>
After completing these steps, the LodgingPOEndpointBean Stateless Session
Bean is exposed as a Web service.
Generating a Web Service Client
To generate a client for the WebServiceBroker Web service, you need to obtain
its WSDL file. The WSDL file is in the OPC module of the Adventure Builder
application. You can import the WSDL file into the META-INF/wsdl directory of
the LodgingSupplier-EJB project in Eclipse.
You use the wscompile tool provided in the Sun JWSDP v2.0 to create the client
files required by WebSphere Application Server Community Edition V1.1.0.1.
The wscompile tool takes an XML configuration as input in which you specify the
path to the WSDL for the Web service for which you need to generate a client.
Example 7-5 shows this file.
Example 7-5 The webservicebroker-client-config.xml file
<?xml version="1.0" encoding="UTF-8"?>
<configuration
xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
<wsdl name="WebServiceBrokerClient"
location="file:wsdl/WebServiceBroker.wsdl"
packageName="com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean">
<typeMappingRegistry />
</wsdl>
</configuration>
290
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
In this example, the location is the relative path of the WSDL file from the
directory where you are executing wscompile. For example, suppose you
execute wscompile in C:\Adventure. Then, the path of the WSDL file will be
C:\Adventure\wsdl\WebServiceBroker.wsdl.
Next, you need to invoke wscompile with the configuration file as shown in
Example 7-5.
Issue the following command:
wscompile -gen:client -s generated
configs\webservicebroker-client-config.xml -source 1.1 -keep
-mapping generated\webservicebroker-mapping.xml
In this command:
configs\webservicebroker-client-config.xml is the relative path to the
config file from the directory where you are executing wscompile.
generated\webservicebroker-mapping.xml is the location where the
JAX-RPC mapping file will be generated.
This command results in the client code created in the generated directory. The
generated directory is also relative to the directory where you are executing
wscompile. You need to create the regenerated command before calling the
wscompile command.
Next, you need to import the generated source files from Eclipse into the
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean package. Actually, you
need to import only two of those files, namely BrokerServiceIntf.java and
WebServiceBroker.java because WebSphere Application Server Community
Edition V1.1.0.1 uses dynamic proxies to invoke the Web service. You also need
to import the JAX-RPC mapping file into the META-INF directory of the
LodgingSupplier-EJB project in Eclipse.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
291
Adding the dependencies to the application
Finally, you need to add some dependencies to the geronimo-application.xml file,
as shown in Example 7-6.
Example 7-6 The geronimo-application.xml file
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>adventure</dep:groupId>
<dep:artifactId>lodgingsupplier</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>ear</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>geronimo</dep:groupId>
<dep:artifactId>tomcat</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>car</dep:type>
</dep:dependency>
<dep:dependency>
<dep:groupId>adventure</dep:groupId>
<dep:artifactId>AdventureDB</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
<dep:dependency>
<dep:groupId>adventure</dep:groupId>
<dep:artifactId>lodging-jms</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
<dep:hidden-classes />
<dep:non-overridable-classes />
</dep:environment>
</application>
Deploying the LodgingSupplier Module on the Server
To deploy the LodgingSupplier Module on the server, right-click the
LodgingSupplier project in Eclipse and export it as an EAR to a location of your
choice. In our example, we exported this EAR to
<adventure_src>\src\SG247433\build\lodgingsupplier.ear. Deploy this EAR from
292
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Deploy New page in the WebSphere Application Server Community Edition
Administrative Console.
7.3.7 Developing the ConsumerWebsite application
This section explains how to develop a Web application using Eclipse Web Tools
Platform and XDoclet.
Creating Web project
Perform the following steps to create the Web project:
1. From the menu bar, click File → New → Project to launch New Project
wizard.
2. Click Web → Dynamic Web Project and click Next as shown in Figure 7-59.
Figure 7-59 Create Web project: Wizard
Chapter 7. Developing the application on WebSphere Application Server Community Edition
293
3. Complete the following fields as shown in Figure 7-60:
Project name
Target Runtime
Configurations
EAR Project Name
adventure
WebSphere Community Edition Server v1.1
<custom>
consumerwebsite
4. Under “Project contents” select Use default. Under “EAR Membership” select
Add project to an EAR.
5. Click Next.
Figure 7-60 Dynamic Web Project : Settings
294
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. In the Project Facets window, select Community Edition Deployment and
click Save as shown in Figure 7-61.
Figure 7-61 Create Web Project - XDoclet Configuration
Chapter 7. Developing the application on WebSphere Application Server Community Edition
295
7. In the Save Preset dialog box, complete the following fields, as shown in
Figure 7-62:
Name
Description
Dynamic Web Project with XDoclet for WASCE
Dynamic Web Project with XDoclet for WASCE
8. Click OK to save the configuration and return to the Project Facets window.
Figure 7-62 Create Web Project -New XDoclet Configuration
296
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9. Select the configuration Dynamic Web Project with XDoclet for WASCE
and click Next as shown in Figure 7-63.
Figure 7-63 Create Web Project - Select XDoclet Configuration
Chapter 7. Developing the application on WebSphere Application Server Community Edition
297
10.In the Web Module settings window, click Next (Figure 7-64).
Figure 7-64 Create Web Project - Web Module settings
298
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
11.In the Deployment Plan window, complete the following fields as shown in
Figure 7-65:
Group Id
Artifact Id
Version
Artifact Type
adventure
adventure
1.0
war
12.Click Finish to complete the creation of Web project.
Figure 7-65 Create Web Project - Deployment Plan Configuration
Chapter 7. Developing the application on WebSphere Application Server Community Edition
299
13.If a license agreement displays, read it and click I Agree to continue
(Figure 7-66).
Figure 7-66 Sun’s License Agreement
300
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
14.If a dialog box displays to confirm opening the J2EE perspective, select
Remember my decision and click Yes, as shown in Figure 7-67.
Figure 7-67 Switch to J2EE perspective
The J2EE perspective displays as shown in Figure 7-68.
Figure 7-68 Eclipse - J2EE Perspective
Chapter 7. Developing the application on WebSphere Application Server Community Edition
301
7.3.8 Creating a servlet
Perform the following steps to create a servlet:
1. In the Project Explorer, double-click adventure and then click the plus sign (+)
to expand Deployment Descriptor: adventure as shown in Figure 7-72.
2. Right-click Servlets, and then elect New → Servlet.
Figure 7-69 Create Servlet - Launch Wizard
302
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. In the Create Servlet wizard, complete the following fields as shown in
Figure 7-70:
Project
Folder
Java package
Class name
Superclass
adventure
\adventure\src
com.sun.j2ee.blueprints.waf.controller.web
MainServlet
javax.servlet.http.HttpServlet
4. Select the “Generate an annotated servlet class” option.
5. Click Next.
Figure 7-70 Create Servlet - class file destination
Chapter 7. Developing the application on WebSphere Application Server Community Edition
303
6. Complete the following fields as shown in Figure 7-71:
Name
Description
MainServlet
web tier entry point servlet
7. Under Initialization Parameters, click Add.
Figure 7-71 Create Servlet - Deployment Descriptor specific information
304
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. In the Initialization Parameters dialog box, complete the following fields as
shown in Figure 7-72:
Name
Value
Description
default_locale
en_US
Default locale
9. Click OK.
Figure 7-72 Create Servlet - Add Initialization Parameters
Chapter 7. Developing the application on WebSphere Application Server Community Edition
305
10.Under URL Mappings, select /MainServlet and click Edit as shown in
Figure 7-73.
Figure 7-73 Create Servlet - Deployment Descriptor specific information
11.In the URL Mappings dialog box, change the pattern to *.do and click OK
(Figure 7-74).
Figure 7-74 Create Servlet - URL Mapping
306
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
12.Click Next as shown in Figure 7-75.
Figure 7-75 Create Servlet - Deployment Descriptor specific information
Chapter 7. Developing the application on WebSphere Application Server Community Edition
307
13.Accept the defaults in the next window, and click Finish to complete the
Servlet generation (Figure 7-76).
Figure 7-76 Create Servlet - Interfaces and Stubs to generate
308
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
The generated Java source are shown in the editor, as shown in Figure 7-77.
Figure 7-77 Create Servlet - Generated code
Example 7-7 shows the JavaDoc comment generated for use with XDoclet.
Example 7-7 Servlet annotation
/**
* Servlet implementation class for Servlet: MainServlet
*
* @web.servlet
*
name="MainServlet"
*
display-name="MainServlet"
*
description="web tier entry point servlet"
*
* @web.servlet-mapping
*
url-pattern="*.do"
*
* @web.servlet-init-param
Chapter 7. Developing the application on WebSphere Application Server Community Edition
309
*
*
*
*
*/
name="default_locale"
value="en_US"
description="Default locale"
14.Double-click Deployment Descriptor: adventure to open the web.xml file
Deployment Descriptor shown in Figure 7-78.
Figure 7-78 Deployment Descriptor
310
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
When XDoclet Builder processes the annotation shown in Example 7-7, the XML
related servlet and servlet-mapping is added to web.xml, as shown in
Example 7-8.
Example 7-8 Deployment Descriptor
<servlet>
<description><![CDATA[web tier entry point
servlet]]></description>
<display-name>MainServlet</display-name>
<servlet-name>MainServlet</servlet-name>
<servlet-class>com.sun.j2ee.blueprints.waf.controller.web.MainServlet</
servlet-class>
<init-param>
<description><![CDATA[Default locale]]></description>
<param-name>default_locale</param-name>
<param-value>en_US</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>MainServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
Chapter 7. Developing the application on WebSphere Application Server Community Edition
311
Creating a filter class
Use the following steps to create a filter class:
1. From the Project Explorer, right-click Java Resources: src.
2. Click New → Class as shown in Figure 7-79.
Figure 7-79 Create Filter - Add a Class
312
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Complete the following fields as shown in Figure 7-80:
Source folder
Package
Name
adventure/src
com.sun.j2ee.blueprints.signon.web
SignOnFilter
4. Click Add.
Figure 7-80 New Java Class wizard
Chapter 7. Developing the application on WebSphere Application Server Community Edition
313
5. In the Choose Interface dialog box, enter javax.servlet.Filter to see the
interface added and click OK as shown in Figure 7-81.
Figure 7-81 Implemented Interfaces Selection
314
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Click Finish to complete the code generation, as shown in Figure 7-82.
Figure 7-82 Create a new Java class
Chapter 7. Developing the application on WebSphere Application Server Community Edition
315
The generated code opens in the editor as shown in Figure 7-83.
Figure 7-83 Generated code
7. Add the JavaDoc comment provided in Example 7-9.
Example 7-9 Filter annotation
/**
* @web.filter
*
name="SignOnFilter"
*
* @web.filter-mapping
*
name="SignOnFilter"
*
url-pattern="/*"
*/
316
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. Press Ctrl+S to save the file. At this step, XDoclet regenerates the web.xml.
Click the web.xml tab to see the contents as shown in Figure 7-84.
Figure 7-84 Deployment Descriptor
Notice that XDoclet Builder added the XML shown in Example 7-10 to web.xml.
Example 7-10 Deployment Descriptor
<filter>
<filter-name>SignOnFilter</filter-name>
<filter-class>com.sun.j2ee.blueprints.signon.web.SignOnFilter</filter-c
lass>
</filter>
<filter-mapping>
<filter-name>SignOnFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Chapter 7. Developing the application on WebSphere Application Server Community Edition
317
Creating a listener
Perform the following instructions to create a listener:
1. Proceed to add a Java class as shown in Figure 7-79 on page 312.
2. Create a Java class SignOnNotifier under the package
com.sun.j2ee.blueprints.consumerwebsite. Refer to Figure 7-80 on page 313.
3. Add the interface javax.servlet.http.HttpSessionAttributeListener. Refer to
Figure 7-81 on page 314. When completed, the generated code opens in the
editor as shown in Figure 7-85.
Figure 7-85 Add Listener - Generated code
318
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Add the JavaDoc comment shown in Example 7-11 to the source file.
Example 7-11 Listener annotation
/**
* @web.listener
*/
5. Press Ctrl+S to save the source file. At this step, XDoclet Builder regenerates
web.xml. Click the web.xml tab to see the contents shown in Figure 7-86.
Figure 7-86 Deployment Descriptor
Chapter 7. Developing the application on WebSphere Application Server Community Edition
319
Notice that XDoclet adds the XML shown in Example 7-12 to web.xml.
Example 7-12 Deployment Descriptor
<listener>
<listener-class>
com.sun.j2ee.blueprints.consumerwebsite.SignOnNotifier
</listener-class>
</listener>
Importing existing source
Instead of adding other servlets, filters, and listeners using the steps that have
have describe previously, you can import the source code provided in
<adventure_src>\src\SG247433. Import the Java source code using these steps:
1. From the menu bar, click File → Import to launch the Import wizard as shown
in Figure 7-87.
2. Click General → File System. Click Next.
Figure 7-87 Import - Select type
320
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Complete the following fields as shown in Figure 7-88:
– From directory
<adventure_src>\src\SG247433\consumerwebsite\adventure\src
In our example, we used
C:\adventure1.0.1\src\SG247433\consumerwebsite\adventure\src.
– Into folder
adventure\src\
4. Select the “Overwrite existing resources without warning” option and the
“Create selected folders only” option.
5. Expand src by clicking the plus sign (+) in front of it. Select com, and click
Finish to complete the import of Java code.
Figure 7-88 Import resources
Chapter 7. Developing the application on WebSphere Application Server Community Edition
321
Import the Web resources using the following steps:
1. Click File → Import to launch the Import wizard as shown in Figure 7-87.
2. Click General → File System. Click Next.
3. Complete the following fields as shown in Figure 7-89:
– From directory
<adventure_src>\src\SG247433\consumerwebsite\adventure\web
In our example, we used
C:\adventure1.0.1\src\SG247433\consumerwebsite\adventure\web.
– Into folder
adventure/WebContent
4. Select the “Overwrite existing resources without warning” option and the
“Create selected folders only” option.
322
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Click Finish complete the import of Web resources.
Figure 7-89 Import sources - Web resources
Chapter 7. Developing the application on WebSphere Application Server Community Edition
323
Disabling HTML validation
Disable HTML validation for the project using the following steps:
1. In the Project Explorer, right-click adventure and select Properties as shown
in Figure 7-90.
Figure 7-90 Project Explorer window
324
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. In the left pane, click Validation. Under Validation, select the “Override
validation preferences” option and clear the check boxes for HTML Syntax
Validator as shown in Figure 7-91.
Figure 7-91 Properties for adventure
3. Click Apply and click OK to return to the workbench.
Generating Web Services Client Code
The ConsumerWebsite application uses Web Services
OpcOrderTrackingService and OpcPurchaseOrderService provided by the OPC
application. To access these Web services, you need to generate the Web
service client code.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
325
To generate the Web service client code for OpcOrderTrackingService and
OpcPurchaseOrderService, use the following steps:
1. In the Project Explorer, click adventure → WebContent → WEB-INF →
wsdl. Double-click OpcOrderTrackingService.wsdl to open the file as
shown in Figure 7-92.
Figure 7-92 Generate Web Service Client - Select wsdl
326
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. Click the Source tab to view the source as shown in Figure 7-93.
Figure 7-93 Generate Web Service Client
3. Towards the end of the file, change REPLACE_WITH_ACTUAL_URL to
http://someurl (which is any properly formatted URL) and press Ctrl+S to
save the file.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
327
4. Under Project Explorer, double-click OpcPurchaseOrderService.xml to
open the file. Click the Source tab to view the source as shown in Figure 7-94.
Figure 7-94 Generate Web Service Client
5. Towards the end of the file, change REPLACE_WITH_ACTUAL_URL to
http://someurl (which is any properly formatted URL) and press Ctrl+S to
save the file.
328
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Click OpcOrderTrackingService.xml. In the menu bar, click File → New →
Other to launch Select a wizard window.
7. Click Web Services → Web Services Client. Click Next as shown in
Figure 7-95.
Figure 7-95 Generate Web Service Client
Chapter 7. Developing the application on WebSphere Application Server Community Edition
329
8. Complete the following fields as shown in Figure 7-96:
Service definition
Client type
/adventure/WebContent/WEB-INF/wsdl
/OpcOrderTrackingServicel.wsdl
Java Proxy
9. Select the “Overwrite files without warning” option.
10.Click Next.
Figure 7-96 Generate Web Service Client - OpcOrderTrackingService
330
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
11.Complete the following fields as shown in Figure 7-97:
Output folder
/adventure/src
12.Select the “Define custom mapping for namespace to package” option.
13.Click Next.
Figure 7-97 Generate Web Service Client - Web Service Proxy Page
Chapter 7. Developing the application on WebSphere Application Server Community Edition
331
14.Click Add and http://default.namespace displays in the mapping pairs.
Change http://default.namespace to urn:OpcOrderTrackingService and
default.javapackage to com.sun.j2ee.blueprints.consumerwebsite.actions.
Refer to Figure 7-98.
Figure 7-98 Web Service Client Namespace to Package Mapping
332
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.Click Finish to complete Web Service Client generation for
OpcOrderTrackingService (Figure 7-99).
Figure 7-99 Web Service Client Namespace to Package Mapping
Chapter 7. Developing the application on WebSphere Application Server Community Edition
333
16.In the Project Explorer, click OpcPurchaseOrderService.xml. Click File →
New → Other.
17.Click Web Services → Web Service Client and click Next.
18.Complete the following fields as shown in Figure 7-100:
Service definition
Client type
/adventure/WebContent/WEB-INF/wsdl
/OpcOrderTrackingServicel.wsdl
Java Proxy
19.Select the “Overwrite files without warning” option.
20.Click Next.
Figure 7-100 Generate Web Service Client - OpcPurchaseOrderService
21.Complete the following fields as shown in Figure 7-97 on page 331:
Output folder
/adventure/src
22.Select the “Define custom mapping for namespace to package” option.
23.Click Next.
334
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
24.Click Add and http://default.namespace displays in the mapping pairs.
Change http://default.namespace to urn:OpcOrderTrackingService and
default.javapackage to com.sun.j2ee.blueprints.consumerwebsite.actions.
The window looks similar to Figure 7-101.
Figure 7-101 Web Service Client Namespace to Package Mapping
25.Click Finish to complete Web Service Client generation for
OpcPurchaseOrderService.
This completes the generation of Web Service Client code for the two Web
services used by the ConsumerWebsite application.
Adding resource and service references
Resource and service references are added using the
web-resources-env-refs.xml file. This file is placed in the WEB-INF directory.
XDoclet Builder merges the contents of this file.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
335
The application uses one resource reference, namely jdbc/CatalogDB, and two
service references to the Web services, namely
service/OpcPurchaseOrderService and service/OpcOrderTrackingService. You
need to map the resource reference to the data source and the service
references to the Web service URLs in the geronimo-web.xml deployment plan.
You map the resource reference using these steps:
1. In Project Explorer, click adventure → WebContent → WEB-INF.
Double-click geronimo-web.xml to open the deployment plan as shown in
Figure 7-102.
2. Click the Naming tab.
Figure 7-102 Adventure Deployment Plan
336
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Under Resource References, click Add (Figure 7-103).
Figure 7-103 Adventure Deployment Plan - Add Resource References
Chapter 7. Developing the application on WebSphere Application Server Community Edition
337
4. Complete the following fields as shown in Figure 7-104:
Reference Name
Resource Link™
jdbc/CatalogDB
jdbc/CatalogDB
5. Click Finish.
Figure 7-104 Add Resource Reference
6. Press Ctrl+S to save the change.
338
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Map the service references using the following steps:
1. Click the Source tab to view the geronimo-web.xml content as shown
Figure 7-105.
Figure 7-105 Adventure Deployment Plan - Source
Chapter 7. Developing the application on WebSphere Application Server Community Edition
339
2. Add the xml shown in Example 7-13 to geronimo-web.xml after the
context-root tag.
Example 7-13 service references in geronimo-web.xml
<nam:service-ref>
<nam:service-ref-name>service/OpcPurchaseOrderService</nam:service-refname>
<nam:port>
<nam:port-name>PurchaseOrderIntfPort</nam:port-name>
<nam:protocol>http</nam:protocol>
<nam:host>localhost</nam:host>
<nam:port>8080</nam:port>
<nam:uri>/webservice/PoEndpointBean</nam:uri>
</nam:port>
</nam:service-ref>
<nam:service-ref>
<nam:service-ref-name>service/OpcOrderTrackingService</nam:service-refname>
<nam:port>
<nam:port-name>OrderTrackingIntfPort</nam:port-name>
<nam:protocol>http</nam:protocol>
<nam:host>localhost</nam:host>
<nam:port>8080</nam:port>
<nam:uri>/webservice/OtEndpointBean</nam:uri>
</nam:port>
</nam:service-ref>
3. Press Ctrl+S to save the changes.
These steps map service/OpcOrderTrackingService to
http://localhost:8080/webservice/OtEndpointBean and
service/OpcPurchaseOrderService to
http://localhost:8080/webservice/PoEndpointBean.
340
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Modifying Application Deployment Descriptor and Plan
When the Web project is generated, the context-root of the application is set by
default to the name of the project, that is adventure. You will change the
context-root to ab in the EAR Deployment Descriptor that is application.xml. You
change the moduleId of the EAR to adventure/consumerwebsite/1.0/ear and add
dependencies to data source and axis in the EAR deployment plan.
Change the context-root in Deployment Descriptor using the following steps:
1. In the Project Explorer, click consumerwebsite → EarContent → META-INF.
Double-click application.xml to open the file as shown Figure 7-77.
Figure 7-106 Consmerwebsite Deployment Descriptor
2. Click application → module → web → context-root. Change the
context-root value to ab. Press Ctrl+S to save the change.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
341
Make changes to the deployment plan using the following steps:
1. Double-click geronimo-application.xml to open the file as shown
Figure 7-107.
Figure 7-107 Consumerwebsite - Deployment Plan
2. Complete the following fields:
Group Id
Artifact Id
Version
Type
adventure
consumerwebsite
1.0
ear
3. Press Ctrl+S to save the file.
342
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Adding dependencies
To add dependencies, follow these steps:
1. Click the Source tab to switch to the source view as shown in Figure 7-108.
Figure 7-108 Consumerwebsite - Dependencies
Chapter 7. Developing the application on WebSphere Application Server Community Edition
343
2. Add the XML code shown in Example 7-14 to geronimo-application.xml after
the moduleId tag.
Example 7-14 Dependencies in geronimo-application.xml
<sys:dependencies>
<sys:dependency>
<sys:groupId>adventure</sys:groupId>
<sys:artifactId>CatalogDB</sys:artifactId>
<sys:type>rar</sys:type>
</sys:dependency>
<sys:dependency>
<sys:groupId>geronimo</sys:groupId>
<sys:artifactId>axis</sys:artifactId>
<sys:type>car</sys:type>
</sys:dependency>
</sys:dependencies>
</sys:environment>
3. Press Ctrl+S to save the changes.
This completes the modification required for the application deployment plan.
Deploying the ConsumerWebsite application on the server
To deploy the ConsumerWebsite application on the server, right-click the
consumerwebsite project in Eclipse and export it as an EAR to a location of
your choice. In our example, we exported this EAR to
<adventure_src>\src\SG247433\build\consumerwebsite.ear. Deploy this EAR
using Deploy New page in the WebSphere Application Server Community
Edition Administrative Console.
344
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7.4 Deploying the application on WebSphere
Application Server Community Edition V1.1.0.1
In the previous sections, we created the database, data sources, and JMS
resources necessary to deploy the EAR files. We demonstrated how you can
build the EAR files using the source code provided with this book. (For
information about how to obtain this source code, see Appendix A, “Additional
material” on page 493.) We also discussed how to create an EJB application and
a Web application using Eclipse Web Tools Platform and XDoclet.
In this section, we discuss how to deploy the Adventure Builder application on
WebSphere Application Server Community Edition V1.1.0.1 server and using the
application.
You deploy the EAR files using Deploy New page in the WebSphere Application
Server Community Edition Administrative Console. Table 7-2 lists our example of
the paths to the EAR files.
Table 7-2 Path to EAR files
Application
Path to EAR files
ActivitySupplier
<adventure_src>\src\apps\activitysupplier\build\activitysupplier.ear
AirlineSupplier
<adventure_src>\src\apps\airlinesupplier\build\airlinesupplier.ear
LodgingSupplier
<adventure_src>\src\SG247433\build\lodgingsupplier.ear
Bank
<adventure_src>\src\apps\bank\build\bank.ear
OPC
<adventure_src>\src\apps\opc\build\opc.ear
ConsumerWebsite
<adventure_src>\src\SG247433\build\consumerwebsite.ear
After you deploy the EAR files, the Adventure Builder application is accessible at
http://localhost:8080/ab.
Chapter 7. Developing the application on WebSphere Application Server Community Edition
345
346
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8
Chapter 8.
Migrating Adventure Builder
to WebSphere Application
Server
This chapter discusses how to migrate Adventure Builder from WebSphere
Application Server Community Edition to WebSphere Application Server V6.1 Base. It details each step, so that you can apply the process to the migration of
your own applications.
© Copyright IBM Corp. 2007. All rights reserved.
347
8.1 The sample application
The sample application that we use in this chapter was developed in 7.3,
“Developing Adventure Builder on WebSphere Application Server Community
Edition V1.1.0.1” on page 223.
8.2 Overview of the migration process
Migrating the Adventure Builder application consists of the following steps:
1. Installing the prerequisite software
2. Importing applications with EJB modules into IDE
3. Creating Web services for all modules
4. Fixing the Service References
5. Fixing the environment variables entries
6. Fixing the code
7. Preparing to deploy and export EAR files
8. Exporting DDL files
9. Importing the ConsumerWebsite application that includes the Web module
8.2.1 Installing the prerequisite software
To migrate the Adventure Builder application, you must install the following
software:
Rational Application Developer V7.0 (see 4.3, “Installing Rational Application
Developer V7.0” on page 64)
DB2 Universal Database Express Edition V8.2 (see 4.5, “Installing DB2
Universal Database Express Edition V8.2” on page 87)
WebSphere Application Server V6.1 - Base (see 4.2, “Installing WebSphere
Application Server V6.1” on page 47)
348
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8.2.2 Importing applications with EJB modules into IDE
We work with the application using Rational Application Developer V7.0, an
Eclipse-based integrated development environment (IDE).
The Adventure Builder application is packaged in our additional material. You
need to download the adventurebuilder-src.zip file as described in Appendix A,
“Additional material” on page 493. Throughout this book, we refer to the directory
where you download the Adventure Builder source files as <adventure_src>. In
our example, we use the C:\AdventureBuilder_WAS_CE directory.
There are six EAR files located in the Adventure Builder directory. Those EAR
files are:
ActivitySupplier consisting of one EJB module
AirlineSupplier consisting of one EJB module
LodgingSupplier consisting of one EJB module
Bank consisting of one EJB module
Order Processing Center (OPC) consisting of two EJB modules
ConsumerWebsite consisting of one Web module
Initially, you need to migrate five EAR files that correspond to the EJB modules.
To do so, complete the following steps:
1. Start the Rational Application Developer V7.0.
2. Press OK when you see the workspace creation dialog box.
3. Close the Welcome window to see the workbench. Note that the Welcome
window displays only when you start the workspace for the first time.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
349
Importing Activity Supplier
To import the Activity Supplier, follow these steps:
1. From the Rational Application Developer V7.0 menu bar, click File → Import.
2. In Import window, select J2EE → EAR file and click Next as shown in
Figure 8-1.
Figure 8-1 Import an EAR file window
350
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Select the activitysupplier.ear file from the <adventure_src> directory using
the Browse button. Accept the EAR project name and Target run time as
default and click Finish. Refer to Figure 8-2.
Figure 8-2 Enterprise Application Import
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
351
4. This imports the application into the workspace and prompts you to open the
J2EE perspective. Click Yes.
5. In the J2EE perspective, from the left navigation pane, select, and expand the
activitysupplier-ejb project as shown in Figure 8-3.
Figure 8-3 J2EE Perspective with Project Explorer view
352
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. You need to regenerate all the Web services (which you generated while
developing the application) from the session beans in all the projects. Thus,
you delete the Web services client code, WSDL files, mapping files, and
webservices.xml file that you generated previously.
Delete the selected files from the activitysupplier-ejb project as shown in
Figure 8-4.
Figure 8-4 Delete Web services client, wsdl and mapping files
There will be errors in
com.sun.j2ee.blueprints.activitysupplier.pomessagebean.ActivityMessageBean
class. You will correct these errors later after the service references are added.
7. Now you need to map the resource references to the JNDI names of the all
resources like data sources, queues, EJBs and queue connection factories.
For this, open the openejb-jar.xml (deployment plan for WebSphere
Application Server Community Edition) and check all JNDI references and
accordingly modify the Deployment Descriptor of activitysupplier-ejb.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
353
8. Double-click Deployment Descriptor:ActivitySupplierJAR to open the
Deployment Descriptor Editor. Complete the following steps to map all
references:
a. To map the data source reference:
i. Select the Overview tab (Figure 8-5) of the Deployment Descriptor
(ejb-jar.xml).
ii. Scroll down to find the JNDI - CMP Connection Factory Binding
section.
iii. Add the JNDI name as jdbc/adventure/AdventureDB.
Figure 8-5 EJB Deployment Descriptor - JNDI CMP mapping
354
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
b. To map the EJB JNDI names:
i. Go to Bean tab of the Deployment Descriptor. You can refer to
Table 8-1 on page 356 for details of Bean names and JNDI Names.
ii. In the CMP fields section, add one CMP field generatedPkField of type
java.lang.Long. Make it a key field for this bean. This step is required
because Adventure Builder uses auto primary key generation.
iii. In the WebSphere Bindings section for ActivityDetailsEB, add the JNDI
name as ejb/local/activitysupplier/ActivityDetails (refer to
open-ejb-jar.xml) as shown in Figure 8-6.
Figure 8-6 EJB Deployment Descriptor - JNDI names for EJBs
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
355
iv. Select ActivityPurchaseOrderEB. In the WebSphere Bindings
section, add the JNDI name as
ejb/local/activitysupplier/ActivityPurchaseOrder (refer to
open-ejb-jar.xml).
v. Select ActivityPOEndpointBean. In the WebSphere Bindings section
add the JNDI name as ActivityPOEndpointBean (refer
open-ejb-jar.xml).
Table 8-1 JNDI Name for EJBs
Bean Type
Bean Name
JNDI Name
Add New
CMP Field
Entity
ActivityDetailsEB
ejb/local/activitysupplier/
ActivityDetails
Yes
Entity
ActivityPurchaseOrderEB
ejb/local/activitysupplier/
ActivityPurchaseOrder
No
Session
ActivityPOEndpointBean
ActivityPOEndpointBean
No
vi. Select ActivityMessageEJB. You need to add Activation
Configuration and JCA Adapter binding for the message bean
according to Table 8-2.
vii. In the Activation Configuration section click Add. Select
destinationType in name field and javax.jms.Queue in value field.
viii.Click Add again. Now enter destination in the name field and
jms/activity/ActivityQueue in the value field.
ix. In the WebSphere binding section, select JCA Adapter. enter
jms/activity/ActivityActivation as the Activation Spec JNDI name
and jms/activity/ActivityQueue as the Destination JNDI name.
Table 8-2 Activation configuration for ActivityMessageEJB
Message Driven
Bean Name
destinationType
destination
Activation Spec
JNDI Name
Destination
JNDI Name
ActivityMessageEJB
javax.jms.Queue
jms/activity/Activ
ityQueue
jms/activity/Activ
ityActivation
jms/activity/Activ
ityQueue
356
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
After completing the steps, the window looks similar to Figure 8-7.
Figure 8-7 Activation Specification for message beans
c. To map the Resource References:
i. Go to the References tab of the Deployment Descriptor. Refer to
Table 8-3 for all references and mappings.
ii. Expand ActivityPurchaseOrderEB. Select
ejb/local/activitysupplier/ActivityDetails. In WebSphere binding
section add JNDI name as ejb/local/activitysupplier/ActivityDetails for
this resource reference.
iii. Expand ActivityPOEndpoint bean. Select ResourceRef
jms/activity/QueueConnectionFactory. In WebSphere binding
section, add JNDI name as jms/activity/QueueConnectionFactory for
this resource reference.
iv. Select ResourceEnvRef jms/activity/ActivityQueue. In WebSphere
binding section, add JNDI name as jms/activity/ActivityQueue for this
resource reference.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
357
v. Expand ActivityMessageEJB. Select
ejb/local/activitysupplier/ActivityPurchaseOrder. In WebSphere
binding section add JNDI name as
ejb/local/activitysupplier/ActivityPurchaseOrder for this resource
reference.
Table 8-3 JNDI Names for all resource references
Bean Name
Resource Ref Name
JNDI Name
ActivityPurchaseOrderEB
ejb/local/activitysupplier/ActivityDetails
ejb/local/activitysupplier/ActivityDetails
ActivityPOEndpoint bean
jms/activity/QueueConnectionFactory
jms/activity/QueueConnectionFactory
jms/activity/ActivityQueue
jms/activity/ActivityQueue
ejb/local/activitysupplier/ActivityPurchase
Order
ejb/local/activitysupplier/ActivityPurchase
Order
ActivityMessageEJB
vi. You will not touch service references now. When you create all Web
services, then you will modify these service references also.
d. Save the changes in Deployment Descriptor and close it.
9. Because of adding a new CMP field in the ActivityDetailsEB, you need to
make few changes in the code:
a. From Outline view of
com.sun.j2ee.blueprints.activitysupplier.purchaseorder.ejb.ActivityDetails
LocalHome interface in activitysupplier-ejb project. Select
create(java.lang.Long generatedPkField) method, right-click Delete.
b. Add a static final field DATA_SOURCE_NAME with value
jdbc/adventure/AdventureDB in
com.sun.j2ee.blueprints.activitysupplier.JNDINames class as follows:
public static final String DATA_SOURCE_NAME =
"jdbc/adventure/AdventureDB";
c. We created a new class PrimaryKeyGenerator.java in package
com.sun.j2ee.blueprints.activitysupplier package to automatically
generate the value for the generatedPkField in ActivitySupplierEB.
358
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Example 8-1 shows code for this class.
Example 8-1 PrimaryKeyGenerator.java
package com.sun.j2ee.blueprints.activitysupplier;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
public class PrimaryKeyGenerator {
public static Long generatePrimaryKey(DataSource ds,String query){
Connection conn = null;
Long pk = null;
Statement stmt = null;
try {
conn = ds.getConnection();
stmt = conn.createStatement();
stmt.executeQuery(query);
ResultSet rs = stmt.getResultSet();
rs.next();
pk = rs.getLong(1);
} catch (SQLException e) {
e.printStackTrace();
try {
stmt.close();
conn.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} finally {
try {
stmt.close();
conn.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return new Long(pk.longValue() + 1);
}
}
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
359
d. Now modify the ejbCreate(String id, Calendar start, Calendar end,
int count) method in the
com.sun.j2ee.blueprints.activitysupplier.purchaseorder.ejb.ActivityDetails
Bean class to set the generatedPkField. The modified ejbcreate method
looks similar to that shown in Example 8-2.
Example 8-2 The ejbCreate for ActivityDetailsBean.java
public Object ejbCreate(String id, Calendar start, Calendar end, int
count)
throws CreateException {
setActivityId(id);
setStartDate(start.getTimeInMillis());
setEndDate(end.getTimeInMillis());
setHeadCount(count);
try {
String query = "select max(generatedpkfield) from
ACTIVITYDETAILSBEAN";
InitialContext ic = new InitialContext();
javax.sql.DataSource ds = (DataSource) ic
.lookup(JNDINames.DATA_SOURCE_NAME);
setGeneratedPkField(PrimaryKeyGenerator.generatePrimaryKey(ds,query));
} catch (NamingException ne) {
System.out.println(ne);
}
return null;
}
e. Press Ctrl+Shift+O to add the required import statements.
10.Now, you can generate the EJB to Database mappings:
a. Right-click activitysupplier-ejb project → EJB to RDB Mapping →
Generate Map.
b. Click Next. Default is create new back-end folder.
c. Select Topdown mapping approach and click Next.
360
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
d. Enter the following values as shown in Figure 8-8 and click Finish.
Target Database
Database name
Schema name
DB2 UDV V8.2
ADVNTRDB
AdventureBuilder
Figure 8-8 Create new EJB/RDB Mapping window
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
361
Importing the airline supplier EAR file
To import the airline supplier EAR file, follow these steps:
1. In Rational Application Developer V7.0, click File → Import. Select J2EE →
EAR file.
2. Select the airlinesupplier.ear file from the <adventure_src> directory using the
Browse button. Accept the default EAR project name and target runtime.
Click Finish to import the application into the workspace. Refer to Figure 8-9.
Figure 8-9 Enterprise Application Import of AirlineSupplier
3. From the left navigation pane, select and expand airlinesupplier-ejb project.
362
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. You need to regenerate the Web service from the airline session bean. Thus,
you delete the Web services client code, WSDL files, mapping files, and
webservices.xml file. Delete the selected files from the airlinesupplier-ejb
project as shown in Figure 8-10.
Figure 8-10 Delete Web services client, WSDL, and mapping files
5. There will be errors in the
com.sun.j2ee.blueprints.airlinesupplier.pomessagebean.AirlineMessageBean
class. You will correct these errors later after the service references are
added.
6. Now you need to map the resource references to the JNDI names of the all
resources such as data source, queues, EJBs, and queue connection factory.
For this, open the openejb-jar.xml (deployment plan for WebSphere
Application Server Community Edition). Look for all JNDI references and
modify the Deployment Descriptor of airlinesupplier-ejb accordingly.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
363
7. Double-click Deployment Descriptor:AirlineSupplierJAR to open the page
in the Deployment Descriptor Editor. Complete the following steps to map all
references:
a. To map the data source reference:
i. Select the Overview tab of the Deployment Descriptor (ejb-jar.xml).
ii. Scroll down to find the JNDI - CMP Connection Factory Binding
section.
iii. Add JNDI name as jdbc/adventure/AdventureDB as shown in
Figure 8-5 on page 354.
b. To map EJB JNDI names:
i. Click the Beans tab of the Deployment Descriptor.
ii. In WebSphere Bindings section for AirlineOrderEB, add the JNDI name
as ejb/local/airlinesupplier/AirlineOrder (refer open-ejb-jar.xml).
iii. Select AirlinePOEndpointBean. In the WebSphere Bindings section,
add the JNDI name as AirlinePOEndpointBean (refer open-ejb-jar.xml).
Table 8-4 JNDI Names for EJBs
Bean Type
Bean Name
JNDI Name
Add New
CMP Field
Entity
AirlineOrderEB
ejb/local/airlinesupplier/AirlineOrder
No
Session
AirlinePOEndpointBean
AirlinePOEndpointBean
No
iv. Select AirlineMessageEJB. You need to add Activation Configuration
and JCA Adapter binding for the message bean.
v. In the Activation Configuration section, click Add. Select
destinationType in name field and javax.jms.Queue in value field.
vi. Click Add again. Now enter destination in the name field and
jms/airline/AirlineQueue in the value field.
vii. In WebSphere binding section, select JCA Adapter. Enter
jms/airline/AirlineActivation as the Activation Spec JNDI name
and jms/airline/AirlineQueue as the Destination JNDI name.
Table 8-5 Activation configuration for AirlineMessageEJB
Message Driven
Bean Name
destinationType
destination
Activation Spec
JNDI Name
Destination JNDI
Name
AirlineMessageEJB
javax.jms.Queue
jms/airline/AirlineQu
eue
jms/airline/AirlineAct
ivation
jms/airline/AirlineQu
eue
364
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
viii.Complete steps for message bean. You see a window similar to
Figure 8-11.
Figure 8-11 JNDI names for EJBs
c. Map Resource References:
i. Click the References tab of the Deployment Descriptor.
ii. Expand AirlinePOEndpoint bean and use Table 8-6. Select resource
reference jms/airline/QueueConnectionFactory. In the WebSphere
binding section, add JNDI name as
jms/airline/QueueConnectionFactory for this resource reference.
iii. Select resource reference jms/airline/AirlineQueue. In the WebSphere
binding section, add JNDI name as jms/airline/AirlineQueue for this
resource reference.
iv. Expand AirlineMessageEJB. Select resource reference
ejb/local/airlinesupplier/AirlineOrder. In WebSphere binding section,
add JNDI name as ejb/local/airlinesupplier/AirlineOrder for this
resource reference.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
365
Table 8-6 JNDI names for Resource references
Bean Name
Resource Ref Name
JNDI Name
AirlinePOEndpoint bean
jms/airline/QueueConnectionFactory
jms/airline/QueueConnectionFactory.
jms/airline/AirlineQueue
jms/airline/AirlineQueue
ejb/local/airlinesupplier/AirlineOrder
ejb/local/airlinesupplier/AirlineOrder
AirlineMessageEJB
8. To generate EJB to database mapping, follow all the steps with the same
values as mentioned in step 10 on page 360.
Importing the bank EAR file
To import the bank EAR file, follow these steps:
1. In Rational Application Developer V7.0, click File → Import. Select J2EE →
EAR file.
2. Select the bank.ear file from the <adventure_src> directory using the Browse
button. Accept the default EAR project name and Target run time. Click
Finish to import the application into the workspace. Refer to Figure 8-12.
Figure 8-12 Enterprise application import of bank
366
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. From the left navigation pane, select and expand bank-ejb project.
4. You need to regenerate the Web service from the session bean in the bank
project. Thus, you delete the Web services client code, WSDL files, mapping
files and webservices.xml file. Delete the selected files from the bank-ejb
project as shown in Figure 8-13.
Figure 8-13 Delete wsdl and mapping files
5. This project has only one session bean, and there are no entity or message
beans. Now, you need to map the resource references to the JNDI names of
ejbs. Open the openejb-jar.xml (deployment plan for WebSphere Application
Server Community Edition). Look for all JNDI references and modify the
Deployment Descriptor of bank-ejb accordingly.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
367
6. Double-click Deployment Descriptor:BankJAR to open the page in the
Deployment Descriptor editor. Complete the following steps to map all
references.
a. To map EJB JNDI names:
i. Click Beans tab of the Deployment Descriptor.
ii. Select CreditCardEndpointBean. In WebSphere Bindings section,
add the JNDI name as CreditCardEndpointBean (refer to
open-ejb-jar.xml).
Table 8-7 JNDI names for EJBs
Bean Type
Bean Name
JNDI Name
Session
CreditCardEndpointBean
CreditCardEndpointBean
iii. Save the Deployment Descriptor.
Importing the order processing center module files
In the OPC order module, there are two EJB projects:
opc-ejb
processmanager-ejb
To import these files, follow these steps:
1. In Rational Application Developer V7.0, click File → Import. Select J2EE →
EAR file.
368
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. Select the opc.ear file from the <adventure_src> directory using the Browse
button. Accept the default EAR project name and Target run time. Click
Finish to import the application into the workspace. Refer to Figure 8-14.
Figure 8-14 Enterprise application import of OPC
3. From the left navigation pane, select and expand opc-ejb project.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
369
4. You need to regenerate the Web service from the session beans in OPC
projects. Thus, you delete the Web services client code, WSDL files, mapping
files, and webservices.xml file. Delete the selected files from the opc-ejb
project as shown in Figure 8-15 and Figure 8-16.
Figure 8-15 Delete Web services client classes
370
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Figure 8-16 Delete Web services client, WSDL, and mapping files
5. There will be errors in multiple packages. You will correct these errors later
after the service references are added.
6. Now you need to map the resource references to the JNDI names of the all
resources such as data source, queues, EJBs, and queue connection factory.
Open the openejb-jar.xml (deployment plan for WebSphere Application
Server Community Edition). Look for all JNDI references and modify the
Deployment Descriptor of activitysupplier-ejb accordingly.
7. Double-click Deployment Descriptor:OrderProcessing CenterJAR to open
the page in the Deployment Descriptor editor. Complete the following steps to
map all references:
a. To map the data source reference:
i. Select the Overview tab of the Deployment Descriptor (ejb-jar.xml).
ii. Scroll down to find the JNDI - CMP Connection Factory Binding
section.
iii. Add JNDI name as jdbc/adventure/AdventureDB.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
371
b. To map EJB JNDI names:
i. Click the Beans tab of the Deployment Descriptor.
ii. Add the JNDI mappings listed in Table 8-8 for entity and session beans.
Table 8-8 JNDI Names for EJBs
Bean Type
Bean Name
JNDI Name
Add New CMP
Field
Entity
ActivityEB
ejb/local/opc/po/Activity
Yes
Entity
AddressEB
ejb/local/opc/po/Address
Yes
Entity
ContactInfoEB
ejb/local/opc/po/ContactInfo
Yes
Entity
CreditCardEB
ejb/local/opc/po/CreditCard
Yes
Entity
LodgingEB
ejb/local/opc/po/Lodging
Yes
Entity
PurchaseOrderEB
ejb/local/opc/po/PurchaseOrder
No
Entity
TransportationEB
ejb/local/opc/po/Transportation
Yes
Session
BrokerServiceBean
BrokerServiceBean
No
Session
OtEndpointBean
OtEndpointBean
No
Session
PoEndpointBean
PoEndpointBean
No
iii. There are six entity beans for which you need to add a new CMP field,
listed in Table 8-8. In the CMP fields section of each of these six entity
beans, add one CMP field generatedPkField of java.lang.Long type.
Make it a key field for this bean. This step is required because
WebSphere Application Server Community Edition uses auto primary
key generation.
iv. Now add activation configuration and JCA Adapter binding for the
message beans as shown in Table 8-9.
Table 8-9 Activation configuration for Message beans in OPC
Message Driven
Bean Name
destinationType
destination
Activation Spec
JNDI Name
Destination JNDI
Name
WorkFlowManager
Bean
javax.jms.Queue
jms/opc/WorkFlowM
grQueue
jms/opc/WorkFlowM
grActivation
jms/opc/WorkFlowM
grQueue
OrderFillerBean
javax.jms.Queue
jms/opc/OrderFillerQ
ueue
jms/opc/OrderFillerA
ctivation
jms/opc/OrderFillerQ
ueue
BrokerRequestorBe
an
javax.jms.Queue
jms/opc/WebService
BrokerQueue
jms/opc/WebService
BrokerActivation
jms/opc/WebService
BrokerQueue
CRMBean
javax.jms.Queue
jms/opc/CRMQueue
jms/opc/CRMActivati
on
jms/opc/CRMQueue
372
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
c. To map Resource References:
i. Click the References tab of the Deployment Descriptor.
ii. For each bean, select a resource reference, if any. Enter the JNDI
name in WebSphere binding section. Use resources reference and
their JNDI names shown in Table 8-10.
Table 8-10 JNDI names for Resource References
Bean Name
Resource Ref Name
JNDI Name
ContactInfoEB
ejb/local/Address
ejb/local/opc/po/Address
PurchaseOrderEB
ejb/local/CreditCard
ejb/local/opc/po/CreditCard
ejb/local/ContactInfo
ejb/local/opc/po/ContactInfo
ejb/local/Activity
ejb/local/opc/po/Activity
ejb/local/Lodging
ejb/local/opc/po/Lodging
ejb/local/Transportation
ejb/local/opc/po/Transportation
jms/opc/QueueConnectionFactory
jms/opc/QueueConnectionFactory
jms/opc/WorkFlowMgrQueue
jms/opc/WorkFlowMgrQueue
ejb/local/processmanager/ProcessManager
ejb/local/processmanager/ProcessManager
ejb/local/purchaseorder/PurchaseOrder
ejb/local/opc/po/PurchaseOrder
jms/opc/QueueConnectionFactory
jms/opc/QueueConnectionFactory
jms/opc/WorkFlowMgrQueue
jms/opc/WorkFlowMgrQueue
ejb/local/processmanager/ProcessManager
ejb/local/processmanager/ProcessManager
ejb/local/purchaseorder/PurchaseOrder
ejb/local/opc/po/PurchaseOrder
jms/opc/QueueConnectionFactory
jms/opc/QueueConnectionFactory
jms/opc/OrderFillerQueue
jms/opc/OrderFillerQueue
jms/opc/CRMQueue
jms/opc/CRMQueue
jms/opc/QueueConnectionFactory
jms/opc/QueueConnectionFactory
jms/opc/WebServiceBrokerQueue
jms/opc/WebServiceBrokerQueue
mail/MailSession
mail/MailSession
BrokerServiceBean
OtEndPointBean
PoEndPointBean
WorkFlowMgrBean
OrderFillerBean
CRMBean
d. Save the changes in Deployment Descriptor and close it.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
373
8. Because you are adding a new CMP Key field (generatedPkField of
java.lang.Long type) in the six entity beans, you need to make few changes in
the code:
a. Delete the create (java.lang.Long generatedPkField) method from the
following interfaces in com.sun.j2ee.blueprints.opc.purchaseorder.ejb
package:
•
•
•
•
•
•
ActivityLocalHome
AddressLocalHome
ContactInfoLocalHome
CreditCardLocalHome
LodgingLocalHome
TransportationLocalHome
b. Add a static final field DATA_SOURCE_NAME with value
"jdbc/adventure/AdventureDB" in
com.sun.j2ee.blueprints.opc.purchaseorder.ejb.JNDINames class as
follows:
public static final String DATA_SOURCE_NAME =
"jdbc/adventure/AdventureDB";
c. We created a new class PrimaryKeyGenerator.java in package
com.sun.j2ee.blueprints.opc.purchaseorder.ejb package to generate the
value for the generatedPkField automatically in all the six entity beans.
Example 8-1 on page 359 shows the code for PrimaryKeyGenerator.java.
You just need to modify the package declaration in this code example.
d. Now modify the ejbCreate(parameters list) method in all the six entity
bean class to set the generatedPkField. Put the code in Example 8-3
before “return null;” in the ejbCreate() method of each EJB. Replace
table_name in query field with the beanclassname because you we will
use top-down RDB mappings. Thus, the table name is the same as the
entity bean class name. Press Ctrl+Shift+O each time to add the import
statements required. For DataSource class, use javax.sql.DataSource.
Example 8-3 Section of ejbCreate method of EJBs
try {
String query = "select max(generatedpkfield) from table_name";
InitialContext ic = new InitialContext();
javax.sql.DataSource ds = (DataSource) ic
.lookup(JNDINames.DATA_SOURCE_NAME);
setGeneratedPkField(PrimaryKeyGenerator.generatePrimaryKey(ds,query));
} catch (NamingException ne) {
System.out.println(ne);
}
374
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9. Now, generate the EJB to Database mappings. To generate EJB to a
database mapping, follow all the steps with the same values as mentioned in
step 10 on page 360 for the opc-ejb module.
Importing the processmanager-ejb project
There are no code changes in the processmanager-ejb project. No Web services
are created or referred in this project. You only need to give JNDI names for
EJBs, data sources and some references:
1. Double-click Deployment Descriptor:ProcessManagerJAR to open the
Deployment Descriptor Editor. Complete the following steps to map all
references:
a. To map the data source reference:
i. Select the Overview tab of the Deployment Descriptor (ejb-jar.xml).
ii. Scroll down to find the JNDI - CMP Connection Factory Binding
section.
iii. Add JNDI name as jdbc/adventure/AdventureDB as shown in
Figure 8-5 on page 354.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
375
b. To map the EJB JNDI names:
i. Click the Beans tab of the Deployment Descriptor.
ii. In WebSphere Bindings section for ManagerEB, add the JNDI name as
ejb/local/processmanager/Manager (refer open-ejb-jar.xml).
iii. Select ProcessManagerSB. In the WebSphere Bindings section, add
the JNDI name as ejb/local/processmanager/ProcessManager (refer
open-ejb-jar.xml).
Table 8-11 JNDI names for EJBs
Bean Type
Bean Name
JNDI Name
Entity
ManagerEB
ejb/local/processmanager/Manager
Session
ProcessManagerSB
ejb/local/processmanager/ProcessManager
c. To map Resource References:
i. Click the References tab of the Deployment Descriptor.
ii. Expand ProcessManagerSB. Select
ejb/local/processmanager/Manager. In the WebSphere binding
section, add JNDI name as ejb/local/processmanager/Manager for this
resource reference.
Table 8-12 JNDI names for Resource references
Bean Name
Resource Ref Name
JNDI Name
ProcessManagerSB
ejb/local/processmanager/Manager
ejb/local/processmanager/Manager
2. Save the Deployment Descriptor after all changes.
3. To generate EJB to database mapping, follow all the steps with the same
values as mentioned in step 10 on page 360.
376
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Importing the lodging supplier EAR files
The lodging supplier project EJBs are created using XDoclet. So, you need to
enable XDoclet support in RAD. (See 4.9, “Downloading XDoclet 1.2.3” on
page 108.)
To import the lodging supplier EAR files, follow these steps:
1. From the menu bar, to enable XDoclet support in RAD navigate to
Windows → Preferences. Scroll down in Preferences window and click
Xdoclet.
2. Click Apply and then Click OK to save the changes (Figure 8-17).
Figure 8-17 Enabling XDoclet support for workspace1
1
Copyright (c) 2000-2004, XDoclet Team, All rights reserved.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
377
3. In RAD, go to File → Import. Select J2EE → EAR file.
4. Select the lodgingsupplier.ear file from the <adventure_src> directory using
the Browse button. Accept the EAR project name and Target run time as
default. Click Finish to import the application into the workspace. Refer to
Figure 8-18.
Figure 8-18 Enterprise Application Import of Lodging Supplier
5. From the left navigation pane, select and expand LodgingSupplier-EJB
project.
378
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. You need to regenerate the Web service from the session beans in
LodgingSupplier-EJB project. Thus, you delete the Web services client code,
WSDL files, and mapping files and webservices.xml file. Delete the selected
files from the LodgingSupplier-EJB project as shown in Figure 8-19.
Figure 8-19 Deleting Web services client, WSDL, and mapping files
7. There will be errors in the
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean.LodgingMessageB
ean class. You will correct these errors later after the service references are
added.
8. Now you need to map the resource references to the JNDI names of the all
resources such as data source, queues, EJBs, and queue connection factory.
For this, open the openejb-jar.xml (deployment plan for WebSphere
Application Server Community Edition). Look for all JNDI references and
modify the Deployment Descriptor of LodgingSupplier-EJB accordingly.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
379
9. Double-click Deployment Descriptor:LodgingSupplier-EJB to open the
page in the Deployment Descriptor Editor. Complete the following steps to
map all references:
a. To map data source reference:
i. Select the Overview tab of the Deployment Descriptor (ejb-jar.xml).
ii. Scroll down to find the JNDI - CMP Connection Factory Binding
section.
iii. Add JNDI name as jdbc/adventure/AdventureDB as shown in
Figure 8-5 on page 354.
b. To map EJB JNDI names:
i. Click the Bean tab of the Deployment Descriptor and use Table 8-13.
ii. In WebSphere Bindings section for LodgingOrder, add the JNDI name
as ejb/local/lodgingsupplier/LodgingOrder (refer open-ejb-jar.xml)
iii. Now select LodgingPOEndpointBean. In WebSphere Bindings
section, add the JNDI name as LodgingPOEndpointBean (refer
open-ejb-jar.xml).
Table 8-13 JNDI names for EJBs
Bean Type
Bean Name
JNDI Name
Add New
CMP Field
Entity
LodgingOrder
ejb/local/lodgingsupplier/LodgingOrder
No
Session
LodgingPOEndpointBean
LodgingPOEndpointBean
No
iv. Now select LodgingMessage bean. You need to add Activation
Configuration and JCA Adapter binding for the message bean.
v. In the Activation Configuration section, click Add. Select
destinationType in the name field as and javax.jms.Queue in the
value field.
vi. Click Add again. Now enter destination in the name field and
jms/lodging/LodgingQueue in the value field.
vii. In WebSphere Binding section, select JCA Adapter. Enter
jms/lodging/LodgingActivation as the Activation Spec JNDI name
and jms/lodging/LodgingQueue as the Destination JNDI name.
Table 8-14 Activation configuration for LodgingMessageEJB
Message Driven
Bean Name
destinationType
destination
Activation Spec
JNDI Name
Destination JNDI
Name
LodgingMessageEJB
javax.jms.Queue
jms/lodging/Lodging
Queue
jms/lodging/Lodging
Activation
jms/lodging/Lodging
Queue
380
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Complete steps for message bean window look similar to Figure 8-20.
Figure 8-20 JNDI names for EJBs
c. Map Resource References:
i. Click the References tab of the Deployment Descriptor and use
Table 8-15.
ii. Expand LodgingPOEndpointBean. Select ResourceRef
jms/lodging/QueueConnectionFactory. In WebSphere Bindings
section, add JNDI name as jms/lodging/QueueConnectionFactory for
this resource reference.
iii. Select ResourceEnvRef jms/lodging/LodgingQueue. In WebSphere
Bindings section, add JNDI name as jms/lodging/LodgingQueue for
this resource reference.
iv. Expand LodgingMessage. Select
ejb/local/lodgingsupplier/LodgingOrder. In the WebSphere Binding
section, add JNDI name as ejb/local/lodgingsupplier/LodgingOrder
for this resource reference.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
381
Table 8-15 JNDI names for resource references
Bean Name
Resource Ref Name
JNDI Name
LodgingPOEndpoint bean
jms/lodging/QueueConnectionFactory
jms/lodging/QueueConnectionFactory
jms/lodging/LodgingQueue
jms/lodging/LodgingQueue
ejb/local/lodgingsupplier/LodgingOrder
ejb/local/lodgingsupplier/LodgingOrder
LodgingMessage
10.Save the Deployment Descriptor after all changes.
11.To generate EJB to database mapping, follow all the steps with the same
values as mentioned in step 10 on page 360.
12.To enable XDoclet support for this project, right-click LodgingSupplier-EJB
project and select Properties.
13.Select Project Facets property and click Add/Remove Project Facets.
14.Select EJBDoclet(XDoclet) and click Finish (Figure 8-21).
Figure 8-21 Enabling XDoclet support for project2
2
Copyright (c) 2000-2004, XDoclet Team, All rights reserved.
382
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.Click OK on the Properties windows to save the changes.
8.2.3 Creating Web services for all modules
In this section, we describe the process to create Web services for all modules.
Creating a Web service for ActivityPOEndpointBean
The ActivityPOEndpointBean session bean in the activitysupplier-ejb project is
accessed as a Web service in the opc-ejb project. To create the Web service for
this session bean, complete the following steps:
1. Navigate to activitysupplier-ejb → Deployment Descriptor → Session
Beans → ActivityPOEndpointBean.
2. Right-click this session bean. Select Webservice → Create WebService as
shown in Figure 8-22.
Figure 8-22 Create Web service from Session EJB
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
383
There are six levels of the service generation: Develop, Assemble, Deploy,
Install, Start, Test.
Important: Move the slider to set the level of service generation. We
changed the level of the slider to Assemble.
3. Click Finish, as shown in Figure 8-23.
Figure 8-23 Web service option - Assemble level
384
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Web service is created. We selected the Assemble option, so the
activitysupplier-ejbHttpRouter project was also created. After the creation of
Web service, your workspace has some extra files and projects as shown in
Figure 8-24.
Figure 8-24 New files added after creation of Web service for activitysupplier
Creating a Web service for AirlinePOEndpointBean
AirlinePOEndpointBean, the session bean in the airlinesupplier-ejb project, is
accessed as a Web service in the opc-ejb project. To create a Web service for
this AirlinePOEndpointBean, follow steps 1 on page 383 through 4 in “Creating a
Web service for ActivityPOEndpointBean” on page 383.
Important: Set the level of service generation to Assemble.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
385
After you create a Web service for the airlinesupplierproject, you have extra files
and projects as shown in Figure 8-25.
Figure 8-25 New files added after creation of Web service for airlinesupplier
Creating Web service for CreditCardEndpointBean
The CreditCardEndpointBean session bean in the bank-ejb project is accessed
as Web service in opc-ejb project. To create Web service for this
CreditCardEndpointBean follow steps 1 on page 383 through 4 in “Creating a
Web service for ActivityPOEndpointBean” on page 383.
Important: Set the level of service generation to Assemble.
386
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
After creation of the Web service bank project, you will have extra files and
projects as shown in Figure 8-26.
Figure 8-26 New files added after creation of Web service for bank
Creating Web service for BrokerServiceBean
The BrokerServiceBean session bean in the opc-ejb project is accessed as Web
service in activitysupplier-ejb, airlinesupplier-ejb and lodgingsupplier-ejb project.
To create Web service for this BrokerServiceBean, follow steps 1 on page 383
through 4 in “Creating a Web service for ActivityPOEndpointBean” on page 383.
Important: Set the level of service generation to Assemble.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
387
Creating Web service for OtEndpointBean
The OtEndpointBean session bean in opc-ejb project is accessed as the Web
service in adventure Web project. To create the Web service for this
OtEndpointBean, follow steps 1 on page 383 through 4 in “Creating a Web
service for ActivityPOEndpointBean” on page 383.
Important: Set the level of service generation to Assemble.
Creating Web service for PoEndpointBean
The PoEndpointBean session bean in the opc-ejb project is accessed as the
Web service in the adventure Web project. To create Web service for the
PoEndpointBean, follow the steps 1 on page 383 through 4 in “Creating a Web
service for ActivityPOEndpointBean” on page 383.
Important: Set the level of service generation to Assemble.
388
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
After you create all three Web services in opc-ejb project, you will notice some
additional files as shown in Figure 8-27.
Figure 8-27 New files added after creation of Web service for opc
Creating Web service for LodgingPOEndpointBean
The LodgingPOEndpointBean session bean in the LodgingSupplier-EJB project
is accessed as the Web service in the opc-ejb project. To create the Web service
for this LodgingPOEndpointBean, follow steps 1 on page 383 through 4 in
“Creating a Web service for ActivityPOEndpointBean” on page 383.
Important: Set the level of service generation to Assemble.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
389
After you create the Web service lodgingsupplier project, you will have extra files
and projects as shown in Figure 8-28.
Figure 8-28 New files added after creation of Web service for lodgingsupplier
390
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Verify the creation of all Web services in JSR-109, click Web Services →
Services in the Project Explorer view as shown in Figure 8-29.
Figure 8-29 Web service window
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
391
8.2.4 Fixing the Service References
In this section, we discuss how to fix the Service References.
Fixing Service Ref for activitysupplier project
The Web service of the BrokerServiceBean is referenced by the
ActivityMessageEJB in the activitysupplier-ejb project. To give proper reference,
complete the following steps:
1. Open the Deployment Descriptor of activitysupplier-ejb project in Deployment
Descriptor editor. Navigate to References tab → ActivityMessageEJB →
ServiceRef service/WebServiceBroker.
2. Click Remove and remove this service reference as shown in Figure 8-30.
Figure 8-30 Service references for EJBs
392
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Now Navigate to the References tab and select ActivityMessageEJB. Then,
click Add as shown in Figure 8-31.
Figure 8-31 Window after existing service reference removed
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
393
4. You see a window similar to Figure 8-32. Select Service reference and click
Next.
Figure 8-32 Add a new service reference
394
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Choose service/BrokerServiceBeanService as shown in Figure 8-33 and
click Finish.
Figure 8-33 Select the service reference
6. Click the ejb/local/activitysupplier/ActivityPurchaseOrder resource
reference in ActivityMessageEJB to verify whether the service reference is
added.
7. Now navigate to Deployment Descriptor → WS Bindings. In Services
Reference section, click Add. Select service/BrokerServiceBeanService
and click OK.
8. In the Service Reference Details section, add the location of the deployed
WSDL file by browsing to the
ejbModule/META-INF/wsdl/BrokerServiceBean.wsdl file.
9. The Port Qualified Name section is filled automatically.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
395
After all changes, the WS Binding tab page should look similar to Figure 8-34.
Figure 8-34 WS Binding for service ref
10.Web service client code is generated automatically in
com.sun.j2ee.blueprints.opc.webservicebroker.provider package.
Fixing Service Ref for airlinesupplier project
Web service of BrokerServiceBean is referenced by AirlineMessageEJB in
airlinesupplier-ejb project. To give proper service reference for this Web service
repeat the steps 1 on page 392 through 8 in “Fixing Service Ref for
activitysupplier project” on page 392. In all these steps, use AirlineMessageEJB
in place of ActivityMessageEJB.
Fixing Service Ref for lodgingsupplier project
The Web service of BrokerServiceBean is referenced by LodgingMessageEJB in
the LodgingSupplier-EJB project. To give proper service reference for this Web
service repeat steps 1 on page 392 through 8 in “Fixing Service Ref for
activitysupplier project” on page 392. In all these steps, use
LodgingMessageEJB in place of ActivityMessageEJB.
396
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Fixing Service Ref for OPC project
The OPC project refers to the following four Web services in two EJBs,
BrokerRequesterBean and WorkFlowManagerBean:
ActivityPOEndpointBeanService
AirlinePOEndpointBeanService
LodgingPOEndpointBeanSessionService
CreditCardEndpointBeanService
You need to remove all four existing service references and add them again. You
also need to add Web Services Bindings for these service references.
Complete the following steps:
1. Click Deployment Descriptor:OrderProcessingCenterJAR. Navigate to
References tab → WorkFlowManagerBean.
2. Select ServiceRef service/CreditCardService and remove it.
3. Select WorkFlowManagerBean again and click Add.
4. Select Service reference and click Next.
5. Choose service/CreditCardEndpointBeanService (refer to Figure 8-33 on
page 395 for actual service file and Figure 8-16 on page 399) and click
Finish.
6. Now navigate to BrokerRequestorBean. Select and delete the following
existing service references:
– service/ActivityPOService
– service/LodgingPOService
– service/AirlinePOService
7. Select BrokerRequestorBean again and click Add.
8. Select Service reference and click Next. Choose
service/ActivityPOEndpointBeanService (refer to Figure 8-33 on page 395
for actual service file and Figure 8-16 on page 399) and click Finish.
9. Repeat step 7 and 8 to add two more service references
(service/AirlinePOEndpointBeanService and
service/LodgingPOEndpointSessionService) to BrokerRequestorBean.
10.Click ServiceRef service/ActivityPOEndpointBeanService in
BrokerRequestorBean to verify whether service reference is added.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
397
11.Now navigate to Deployment Descriptor → WS Bindings. In the Services
Reference section, click Add. Add the following four services one by one:
–
–
–
–
service/ActivityPOEndpointBeanService
service/AirlinePOEndpointBeanService
service/LodgingPOEndpointSessionService
service/CreditCardEndpointBeanService
12.Now in the Service Reference Details section, add the location of the
deployed WSDL file by browsing the ejbModule/META-INF/wsdl/ folder and
selecting the respective WSDL file for each service.
13.Port Qualified Name section is filled automatically.
14.After all changes, the Web Services Bindings page should look similar to
Figure 8-35.
Figure 8-35 Web Services bindings for service references in OPC
398
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.The Web service client code is generated automatically in the following
packages:
–
–
–
–
com.sun.j2ee.blueprints.activitysupplier.powebservice
com.sun.j2ee.blueprints.airlinesupplier.powebservice
com.sun.j2ee.blueprints.lodgingsupplier.powebservice
com.sun.j2ee.blueprints.bank.creditcardservice
8.2.5 Fixing the environment variables entries
You have generated the Web service from the session beans so that the URL
and Web service names are different than those assumed by the source
application. So, you need to make changes to the environment entries for all the
Web service names and URLs.
Table 8-16 lists all the Web service names and their URLs. You can verity the
Web service URLs from the WSDL files.
Table 8-16 Web service names and Web service URL
Web service Name
Web service URL
service/ActivityPOEndpointBeanService
http://localhost:9080/activitysupplier-ejbHttpRouter/services
/ActivityPOEndpointBean
service/AirlinePOEndpointBeanService
http://localhost:9080/airlinesupplier-ejbHttpRouter/services/
AirlinePOEndpointBean
service/LodgingPOEndpointSessionServi
ce
http://localhost:9080/LodgingSupplier-EJBHttpRouter/servic
es/LodgingPOEndpointSession
service/CreditCardEndpointBeanService
http://localhost:9080/bank-ejbHttpRouter/services/CreditCar
dEndpointBean
service/BrokerServiceBeanService
http://localhost:9080/opc-ejbHttpRouter/services/BrokerSer
viceBean
service/OtEndpointBeanService
http://localhost:9080/opc-ejbHttpRouter/services/OtEndpoin
tBean
service/PoEndpointBeanService
http://localhost:9080/opc-ejbHttpRouter/services/PoEndpoin
tBean
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
399
Fixing environment entries for Activity Supplier
In this section, we discuss how to fix the environment entries for Activity Supplier.
Perform the following instructions:
1. Click Deployment Descriptor:ActivitySupplierJAR. Navigate to the Bean
tab. Select ActivityMessageEJB and scroll down top-right pane to bring the
Environment Variables in view as shown in Figure 8-36.
Figure 8-36 Environment Variables window
2. Select param/BrokerServiceURL variable and click Edit.
400
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Change the Value field to new Web service URL (for example,
http://localhost:9080/opc-ejbHttpRouter/services/BrokerServiceBean) as
shown in Figure 8-37. Refer to Table 8-16 or a respective WSDL file if you
know the URL. Click Finish.
4. Save and close the Deployment Descriptor.
Figure 8-37 Modifying an existing environment variable
Fixing environment entries for Airline Supplier
In this section, we discuss how to fix the environment entries for Airline Supplier.
Perform the following steps:
1. Click Deployment Descriptor:AirlineSupplierJAR. Navigate to the Bean
tab. Select AirlineMessageEJB and scroll down the top-right pane to bring
the Environment Variables in view as shown in Figure 8-36.
2. Select param/BrokerServiceURL variable and click Edit.
3. Change the value field to
http://localhost:9080/opc-ejbHttpRouter/services/BrokerServiceBean to
reflect new URL for Web service as shown in Figure 8-37.
4. Save and close the Deployment Descriptor.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
401
Fixing environment entries for Lodging Supplier
The Lodging Supplier project uses XDoclet annotations. When XDoclet Builder
processes these annotations it generates the ejb-jar.xml. Environment entries
are generated using XDoclet tags written in EJB classes. Thus, instead of
modifying through the Deployment Descriptor, you modify the XDoclet tag in the
LodgingMessageBean class. Follow these steps:
1. Open LodgingMessageBean.java in
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean package in an
editor.
2. Change @ejb.env-entry so that it looks similar to that shown in Example 8-4.
Example 8-4 The @ejb.env-entry change
* @ejb.env-entry
*
name="param/BrokerServiceURL"
*
type="java.lang.String"
*
value =
"http://localhost:9080/opc-ejbHttpRouter/services/BrokerServiceBean"
3. You need to change the @ejb.ejb-service-ref entry also. When you
regenerate ejb-jar.xml, all previous changes made to ejb-jar.xml are
overwritten. Example 8-5 shows the new @ejb.ejb-service-ref XDoclet tags.
Example 8-5 The @ejb.ejb-service-ref change
*
@ejb.ejb-service-ref
*
name="service/BrokerServiceBeanService"
*
interface="com.sun.j2ee.blueprints.opc.webservicebroker.provider.Broker
ServiceBeanService"
*
wsdl-file-uri="META-INF/wsdl/BrokerServiceBean.wsdl"
*
jaxrpc-mapping-file="META-INF/BrokerServiceBean_mapping.xml"
4. Right-click the LodgingSupplier-EJB project and select the Run XDoclet
option from the context menu to regenerate the ejb-jar.xml with the modified
values. You can verify it also by opening the Deployment Descriptor.
402
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Fixing the environment entries for OPC
To fix the environment entries for OPC:
1. Click Deployment Descriptor:OrderProcessingCenterJAR.
2. Navigate to the Bean tab.
3. Change the environment variables listed in Table 8-17. Leave the remainder
of the variables unchanged.
Table 8-17 Environment variables names and their values
Bean Name
Environment Variable Name
New Value
WorkFlowManagerBean
param/CreditCardServiceURL
http://localhost:9080/bank-ejbHttpRout
er/services/CreditCardEndpointBean
BrokerRequestorBean
param/LodgingServiceURL
http://localhost:9080/LodgingSupplierEJBHttpRouter/services/LodgingPOE
ndpointSession
param/AirlineServiceURL
http://localhost:9080/airlinesupplier-ejb
HttpRouter/services/AirlinePOEndpoin
tBean
param/ActivityServiceURL
http://localhost:9080/activitysupplier-ej
bHttpRouter/services/ActivityPOEndp
ointBean
8.2.6 Fixing the code
In this section, we discuss the how to fix the code for Activity Supplier, Airline
Supplier, Lodging Supplier, and OPC.
Fixing code for Activity Supplier
Perform the following instructions to fix code for Activity Supplier:
1. Open JNDINames.java in com.sun.j2ee.blueprints.activitysupplier package.
2. Change the value of the BROKER_SERVICE_NAME variable to
java:comp/env/service/BrokerServiceBeanService. Refer to Table 8-16 on
page 399. The new code should look similar to this code:
public static final String BROKER_SERVICE_NAME =
"java:comp/env/service/BrokerServiceBeanService";
3. Now open ActivityMessageBean.java in the
com.sun.j2ee.blueprints.activitysupplier.pomessagebean package. There are
some errors with respect to the Web service client classes.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
403
4. Modify the sendInvode(ActivityOrder act) method as shown in bold in
Example 8-6.
Example 8-6 The sendInvoice method of ActivityMessageBean.java
private void sendInvoice(ActivityOrder act) {
Invoice inv = new Invoice("1234", act.getOrderId(),
"ACTIVITY_INVOICE",
act, "COMPLETED");
try {
InitialContext ic = new InitialContext();
BrokerServiceBeanService svc = (BrokerServiceBeanService)
ic.lookup(JNDINames.BROKER_SERVICE_NAME);
String endpointURI = (String)
ic.lookup(JNDINames.BROKER_SERVICE_URL);
BrokerServiceBean port= (BrokerServiceBean)
svc.getPort(BrokerServiceBean.class);
// Required because we build the stubs using static WSDL
((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,
endpointURI);
port.submitDocument(inv.toXML());
} catch (Exception ne) {
// Proper exception handling as in OPC module has to be
// implemented here later
ne.printStackTrace();
}
}
5. Press Ctrl+Shift+O to generate the import statement. Save all the changes.
Verify that all errors are gone.
Fixing code for Airline Supplier
Perform the following instructions to fix code for Airline Supplier:
1. Open JNDINames.java in com.sun.j2ee.blueprints.airlinesupplier package.
2. Change the value of the BROKER_SERVICE_NAME variable to
java:comp/env/service/BrokerServiceBeanService. Refer to Table 8-16 on
page 399. The new code should look similar to this code:
public static final String BROKER_SERVICE_NAME =
"java:comp/env/service/BrokerServiceBeanService";
3. Now open AirlineMessageBean.java in the
com.sun.j2ee.blueprints.airlinesupplier.pomessagebean package. There are
some errors with respect to the Web service client classes.
404
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Modify the sendInvoice(AirlineOrder flight) method as shown in bold in
Example 8-7.
Example 8-7 The sendInvoice method of AirlineMessageBean.java
public void sendInvoice(AirlineOrder flight) {
Invoice inv = new Invoice("1234", flight.getOrderId(),
"AIRLINE_INVOICE", "AGENT-001234",
flight.getDepFlightDate(),
flight.getRetFlightDate(),
flight.getDepFlightId(),
flight.getRetFlightId(),
flight.getHeadCount(),
"COMPLETED",
"48 Hours Prior to Flight");
try {
InitialContext ic = new InitialContext();
BrokerServiceBeanService svc = (BrokerServiceBeanService)
ic.lookup(JNDINames.BROKER_SERVICE_NAME);
String endpointURI = (String)
ic.lookup(JNDINames.BROKER_SERVICE_URL);
BrokerServiceBean port= (BrokerServiceBean)
svc.getPort(BrokerServiceBean.class);
// Required because we build the stubs using static WSDL
((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,
endpointURI);
port.submitDocument(inv.toXML());
} catch (Exception ne) {
// Proper exception handling as in OPC module has to be
// implemented here later
ne.printStackTrace();
}
}
5. Press Ctrl+Shift+O to generate the import statement. Save all the changes.
Verify that all errors are gone.
Fixing code for Lodging Supplier
Perform the following instructions to fix code for Lodging Supplier:
1. Open JNDINames.java in com.sun.j2ee.blueprints.lodgingsupplier package.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
405
2. Change the value of BROKER_SERVICE_NAME variable to
java:comp/env/service/BrokerServiceBeanService. Refer to Table 8-16 on
page 399. The new code should look similar to this code:
public static final String BROKER_SERVICE_NAME =
"java:comp/env/service/BrokerServiceBeanService";
3. Now open LodgingMessageBean.java in the
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean package. There are
some errors with respect to Web service client classes.
4. Modify the sendInvoice(LodgingOrder lodge) method as shown in bold in
Example 8-8.
Example 8-8 The sendInvoice method of LodgingMessageBean.java
public void sendInvoice(LodgingOrder lodge) {
Invoice inv = new Invoice("1234", lodge.getOrderId(),
"LODGING_INVOICE", "COMPLETED",
lodge.getLodgingId().trim(),
"1234 Main Street, Sometown 12345, USA",
"No Cancelations 24 hours prior");
try {
InitialContext ic = new InitialContext();
BrokerServiceBeanService svc = (BrokerServiceBeanService)
ic.lookup(JNDINames.BROKER_SERVICE_NAME);
String endpointURI = (String)
ic.lookup(JNDINames.BROKER_SERVICE_URL);
BrokerServiceBean port= (BrokerServiceBean)
svc.getPort(BrokerServiceBean.class);
// Required because we build the stubs using static WSDL
((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,
endpointURI);
port.submitDocument(inv.toXML());
} catch (Exception ne) {
// Proper exception handling as in OPC module has to be
// implemented here later
ne.printStackTrace();
}
}
5. Press Ctrl+Shift+O to generate the import statement. Save all the changes.
Verify that all errors are gone.
406
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Fix the code for OPC
Perform the following instructions to fix the code for OPC:
1. Open JNDINames.java in the com.sun.j2ee.blueprints.opc package.
2. Change JNDI Names for supplier services and credit card services. Refer to
Table 8-16 on page 399 for the service names. The new code should look
similar to this code:
// JNDI Names for supplier services
public static final String LODGING_SERVICE_NAME =
"java:comp/env/service/LodgingPOEndpointSessionService";
public static final String ACTIVITY_SERVICE_NAME =
"java:comp/env/service/ActivityPOEndpointBeanService";
public static final String AIRLINE_SERVICE_NAME =
"java:comp/env/service/AirlinePOEndpointBeanService";
// JNDI Name for credit card service
public static final String CREDIT_CARD_SERVICE_NAME =
"java:comp/env/service/CreditCardEndpointBeanService";
3. Now you need to fix the Web service client interfaces in four client files.
Replace all occurrences of the old interfaces with new interfaces, as shown in
Table 8-18.
Table 8-18 Code changes in message beans in OPC
Package Name
Class Name
Method name
Old Interface
Name
New Interface Name
com.sun.j2ee.bl
ueprints.opc.fina
ncial
CreditCardVerifier
CreditCardVerifi
er()
CreditCardService
com.sun.j2ee.blueprints.bank.cred
itcardservice.CreditCardEndpoint
BeanService
CreditCardIntf
com.sun.j2ee.blueprints.bank.cred
itcardservice.CreditCardEndpoint
Bean
AirlinePurchaseOr
derService
com.sun.j2ee.blueprints.airlinesup
plier.powebservice.AirlinePOEndp
ointBeanService
AirlinePOIntf
com.sun.j2ee.blueprints.airlinesup
plier.powebservice.AirlinePOEndp
ointBean
LodgingPurchase
OrderService
com.sun.j2ee.blueprints.lodgingsu
pplier.powebservice.LodgingPOE
ndpointSessionService
com.sun.j2ee.bl
ueprints.opc.we
bservicebroker.r
equestor
ActivitySupplierC
lient
LodgingSupplier
Client
sendRequest(Str
ing xmlDoc)
sendRequest(Str
ing xmlDoc)
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
407
Package Name
Class Name
AirlineSupplierCli
ent
Method name
sendRequest(Str
ing xmlDoc)
Old Interface
Name
New Interface Name
LodgingPOIntf
com.sun.j2ee.blueprints.lodgingsu
pplier.powebservice.LodgingPOE
ndpointSession
ActivityPurchaseO
rderService
com.sun.j2ee.blueprints.activitysu
pplier.powebservice.ActivityPOEn
dpointBeanService
ActivityPOIntf
com.sun.j2ee.blueprints.activitysu
pplier.powebservice.ActivityPOEn
dpointBean
Now all errors are fixed. Next, you perform the steps to generate the deployed
code for the project and export the EAR files for deployment on the server.
408
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8.2.7 Preparing to deploy and export EAR files
Complete the following instructions to deploy the code for each project and to
export the associated EAR file:
1. Right-click the activitysupplier project and click Prepare for Deployment as
shown in Figure 8-38. Now the deployed code is generated for the EJBs. No
errors should exist in the project.
Figure 8-38 Prepare for deployment window
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
409
2. Right-click the activitysupplier project. Click Export → EAR file as shown in
Figure 8-39.
Figure 8-39 Export EAR file window
410
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Browse to the desired destination and click Finish (Figure 8-40).
Figure 8-40 Destination for export
4. Repeat steps 1 through 3 to generate the deployed code and export
airlinesupplier, bank, lodgingsupplier, and OPC projects.
8.2.8 Exporting DDL files
We have used the top-down approach for generating RDB mappings for EJBs.
Therefore, it is always advisable to export the Table.ddl from each EJB project
that includes entity beans and then execute them on the database server.
Perform the following steps:
1. To export Table.ddl from activitysupplier-ejb project, Navigate to
activitysupplier-ejb → ejbModule → META-INF → Table.ddl.
2. Right-click Table.ddl and select Export.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
411
3. Select General → File System and click Next.
4. Make sure only Table.ddl is selected in top-right pane. Enter
C:\MigratedAdventureBuilder\DDL\activitysupplier in the “To directory”
field and click Finish as shown in Figure 8-41.
Figure 8-41 Export Table.ddl file
5. If a dialog box displays informing you that the target directory does not exist
and asking if you would like to create it, select Yes.
6. Repeat steps 1 through 5 for the following projects.
– airlinesupplier-ejb project with target directory
C:\MigratedAdventureBuilder\DDL\airlinesupplier
– LodgingSupplier-EJB project with target directory
C:\MigratedAdventureBuilder\DDL\lodgingsupplier
412
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
– opc-ejb project with target directory
C:\MigratedAdventureBuilder\DDL\opc
– processmanager-ejb project with target directory
C:\MigratedAdventureBuilder\DDL\processmanager
8.2.9 Importing the ConsumerWebsite application that includes the
Web module
Now, the last step in migrating the application is to import Adventure Builder, the
Web application, the fix code, and application dependencies. We discuss
development of the Adventure Builder Web module in 7.3, “Developing
Adventure Builder on WebSphere Application Server Community Edition
V1.1.0.1” on page 223.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
413
To import the application EAR file :
1. In RAD, go to File → import. Select J2EE → EAR file.
2. Select the consumerwebsite.ear file from the <adventure_src> directory using
the Browse button (Figure 8-42).
3. Accept the EAR project name and Target run time as default and click Finish
to import the application into the workspace.
Figure 8-42 Enterprise application import of consumer Web site
Resolving Adventure project import errors
After Import you will see many JSP and HTML related errors. To resolve these
errors:
1. Turn off HTML Syntax validator and JSP syntax validator by clicking
Window → Preferences → Validation.
414
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. Select Override validator preferences, clear HTML Syntax validator for
manual and build, and clear JSP syntax validator for manual and build as
shown in Figure 8-43.
3. Click Apply.
Figure 8-43 Uncheck JSP and HTML syntax validators
4. Select the adventure project. Navigate to Project → Clean from the menu
bar. Select the clean selected project and click OK.
The project is rebuilt and all errors are removed. If there are still some
warnings, you can ignore them.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
415
5. You need to add the service reference for Web service again. You
regenerated the service reference in your EJB projects. Thus, you delete the
Web services client code, WSDL files, and mapping files.
6. Delete the selected files from the adventure project as shown in Figure 8-44
and Figure 8-45.
Figure 8-44 Delete Web services client files
416
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Figure 8-45 Delete Web services client, WSDL, and mapping files
Fixing resource references
To fix resource references, follow these steps:
1. Click Deployment Descriptor: adventure. Go to the References tab.
2. Select ResourceRef jdbc/CatalogDB. In the WebSphere Bindings section,
enter the JNDI name as jdbc/CatalogDB.
3. Select and delete two service references:
– service/OpcPurchaseOrderService
– service/OpcOrderTrackingService
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
417
4. You now need to add the service references again. Click Add in the
References tab and select Service reference in the next window. Add
service/OtEndpointBeanService as shown in Figure 8-46.
Figure 8-46 Service reference window
5. Repeat step 4 to add another service reference for
service/PoEndpointBeanService. If you get a warning to overwrite the files,
click Yes.
6. Click the WS Bindings tab. In the Service References section, click Add.
Add the following two services one by one.
– service/OtEndpointBeanService
– service/PoEndpointBeanService
7. Now in the Service References detail section, add the location of deployed
WSDL file by browsing to ejbModule/META-INF/wsdl/ folder and selecting the
respective WSDL file for each service.
418
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. The Port Qualified Name section is filled automatically. Save the Deployment
Descriptor.
Fixing the code
To fix the code, follow these steps:
1. Now open CheckoutHTMLAction.java in
com.sun.j2ee.blueprints.consumerwebsite.actions package. There are some
errors with respect to Web service client classes.
2. Add an import statement at the top of class.
import com.sun.j2ee.blueprints.opc.purchaseorder.*;
3. Press Ctrl+S. Many errors will go away. Now modify the
buildPurchaseOrder(HttpServletRequest request) method. It is difficult to
show the complete method code. Thus, we show a section of the method in
Example 8-9. The modified code is shown in bold letters.
Example 8-9 Excerpt of buildPurchaseOrder method in CheckoutHTMLAction.java
....
....
Context ic = new InitialContext();
Service opcPurchaseOrderSvc =
(Service)
ic.lookup("java:comp/env/service/PoEndpointBeanService");
PoEndpointBean port =
(PoEndpointBean)opcPurchaseOrderSvc.getPort(PoEndpointBean.class);
String server = (request.getServerPort() != 0) ?
(request.getServerName()+":"+request.getServerPort()) :
(request.getServerName());
((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:9080/opc-ejbHttpRouter/services/PoEndpointBean");
String ret = port.submitPurchaseOrder(mypo);
CheckoutBean checkoutBean = new CheckoutBean(ret);
request.setAttribute(AdventureKeys.CHECKOUT_BEAN,
checkoutBean);
....
....
4. Press Ctrl+Shift+O. There will be a warning for the Address class. Use the
Address class defined in com.sun.j2ee.blueprints.opc.purchaseorder. Save
the class. All error in this class will be gone.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
419
5. Now open OrderTrackingHTMLAction.java in the
com.sun.j2ee.blueprints.consumerwebsite.actions package. There are some
errors with respect to Web service client classes.
6. Add an import statement at the top of class.
import com.sun.j2ee.blueprints.opc.purchaseorder.*;
7. Now modify the getOrderDetails(String orderId, HttpServletRequest
request) method as shown in Example 8-10. The modified code is shown in
bold letters.
Example 8-10 getOrderDetails method in OrderTrackingHTMLAction.java
private OrderDetails getOrderDetails(String orderId,
HttpServletRequest request) throws Exception {
Context ic = new InitialContext();
OtEndpointBeanService opcOrderTrackingSvc =
(OtEndpointBeanService)
ic.lookup("java:comp/env/service/OtEndpointBeanService");
OtEndpointBean port = opcOrderTrackingSvc.getOtEndpointBean();
String server = (request.getServerPort() != 0) ?
(request.getServerName()+":"+request.getServerPort()) :
(request.getServerName());
((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:9080/opc-ejbHttpRouter/services/OtEndpointBean");
return port.getOrderDetails(orderId);
}
8. Press Ctrl+Shift+O and save changes.
Preparing for deployment and export
To deploy and export the application, follow these steps:
1. Right-click the consumerwebsite project and click Prepare for Deployment
as shown in Figure 8-38 on page 409. Now the deployed code is generated.
There should be no errors except for the two errors in the XML files in
webproject. You can ignore them.
2. Now right-click the consumerwebsite project. Click Export → EAR file and
save it in a desired location.
420
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8.3 Summary
You have migrated the Adventure Builder application from WebSphere
Application Server Community Edition V1.1.0.1 to WebSphere Application
Server V6.1 and generated EAR files ready to be deployed on WebSphere
Application Server. We discuss the deployment and testing of this application on
WebSphere Application Server in Chapter 9, “Deploying Adventure Builder on
WebSphere Application Server” on page 423.
Chapter 8. Migrating Adventure Builder to WebSphere Application Server
421
422
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9
Chapter 9.
Deploying Adventure
Builder on WebSphere
Application Server
This chapter describes the steps to deploy the Adventure Builder application that
you migrated in the previous chapter, Chapter 8, “Migrating Adventure Builder to
WebSphere Application Server” on page 347.
This chapter describes the following:
Configuring the database
Configuring WebSphere Application Server
Installing the applications
Testing the application
You can download the MigratedAdventureBuilder.zip file using the instructions in
Appendix A, “Additional material” on page 493. You download the compressed
file to a directory of your choice and extract the contents of the file in C:\> drive.
For our example, we used the directory C:\MigratedAdventureBuilder directory.
In the remainder of this chapter, we refer to this directory as <ab_home>.
© Copyright IBM Corp. 2007. All rights reserved.
423
9.1 Configuring the database
The Adventure Builder application accesses the database. In this section, we
create users, database, schemas, and tables for the application.
9.1.1 Creating users
You need to create the following user accounts to access the application:
adventurebuilder
adventure
To create users:
1. Open a command prompt. Issue the NET USER command to create the
accounts (for example, User IDs and passwords).
Note: The asterisk (*) in these commands causes Windows to prompt you for
the password. You must retype the password to confirm.
2. Create the adventurebuilder account with the user ID adventurebuilder and
the password adventurebuilder.
net user adventurebuilder * /add
Enter: adventurebuilder
Enter: adventurebuilder
3. Create the adventure account with the user ID adventure and the password
adventure.
net user adventure * /add
Enter: adventure
Enter: adventure
9.1.2 Creating the sample application database
In this section, we describe the steps necessary for creating the sample
application database ADVNTRDB. To create the sample application database:
1. From a command line, you need to start a DB2 CLP (command line
processor):
cd <ab_home>/sql
db2cmd
424
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
2. Now, while you are in DB2 command prompt, execute the following
commands to create the Adventure Builder database and tables:
db2 create db ADVNTRDB
db2 connect to ADVNTRDB
db2 -tvf adventure-catalog.sql
db2 -tvf .\activitysupplier\Table.ddl
db2 -tvf .\airlinesupplier\Table.ddl
db2 -tvf .\lodgingsupplier\Table.ddl
db2 -tvf .\opc\Table.ddl
db2 -tvf .\processmanager\Table.ddl
db2 -tvf .\grant-permissions.sql
db2 disconnect all
db2stop
db2start
Adventure-Catalog.sql creates all master tables and also insert data. The
Table.ddl from EJB projects creates transaction tables.
Note: Remember to run grant-permission.sql. Otherwise, the application will
not run.
9.2 Configuring WebSphere Application Server
You use the Administrative Console to do all server side configuration, but
WebSphere Application Server also offers extensive scripting capabilities that
can help you automate many steps for a faster and more repeatable deployment.
We assume WebSphere Application Server V6.1 - Base is already installed with
the default profile AppSrv01. The server should be running before you start any
administrative tasks.
To configure WebSphere Application Sever:
1. To start the server, click Start → All Programs → IBM WebSphere →
Application Server 6.1 → Profiles → AppSrv01 → Start the Server.
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
425
2. Open the Administrative Console. Click Start → All Programs → IBM
WebSphere → Application Server 6.1 → Profiles → AppSrv01 →
Administrative Console. You can also open the Administrative Console by
entering http://localhost:9060/ibm/console in an Internet browser.
3. Enter a user name to open the Administrative Console. In our example, our
user name is ITSO, as shown in Figure 9-1. This user name is used for
maintaining the session only as we have not configured security on server.
This user need not be part of some user registry.
Figure 9-1 Launch the Administrative Console
426
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Figure 9-2 shows the Administrative Console.
Figure 9-2 Administrative Console
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
427
9.2.1 Configuring JDBC resources
In this section, we explain how to create JDBC Provider, J2C authentication
aliases, and data sources for the Adventure Builder application.
Creating JDBC Provider
Complete the following steps to create the JDBC Provider:
1. In the left panel of the Administrative Console, select Resources → JDBC →
JDBC Provider. Select scope as Node=blade18Node01, Server=server1 as
shown in Figure 9-3.
Figure 9-3 Select scope of JDBC Provider
2. Click New.
428
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Complete the following fields as shown in Figure 9-4:
Database type
Provider type
Implementation type
Name
DB2
DB2 Universal JDBC Driver Provider
XA Data source
DB2 Universal JDBC Driver Provider (XA)
Figure 9-4 Provider and Implementation type of JDBC Provider
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
429
4. Click Next.
5. Enter the directory location of jar files as <SQLLIB_HOME>/java. In our
example, it is C:\Program Files\IBM\SQLLIB\JAVA, as shown in Figure 9-5.
Figure 9-5 Database class path information for JDBC provider
430
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Click Next.
7. Click Finish and then click Save to Master Configuration as shown in
Figure 9-6.
Figure 9-6 JDBC Provider summary
You have just created JDBC provider. Next, you create the J2C authentication
aliases and then create the data source. These aliases are used for
authenticating the application with the database.
Creating J2C authentication aliases
The ADVNTRDB database requires authentication credentials, and you do not
want to store these credentials as custom properties on the data source. Thus,
you use the J2EE Connector Architecture (J2C) authentication data entries to
create authentication aliases for the two users, adventure and adventurebuilder.
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
431
To create the aliases:
1. From the left navigation pane, click Security → Secure administration,
applications and infrastructure.
2. From the secure administration page, expand Java Authentication and
Authorization Service tree and select J2C authentication data as shown in
Figure 9-7.
Figure 9-7 Secure administration, applications and infrastructure
432
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Click New (Figure 9-8).
Figure 9-8 JAAS-J2C Authentication Data
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
433
4. Enter the following information, as shown in Figure 9-9:
Alias:
User ID:
Password:
adventurebuilder
adventurebuilder
adventurebuilder
Figure 9-9 Create a J2C alias
5. Click Apply and click Save to Master Configuration to persist the changes.
434
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Repeat steps 3 and step 5 to create another J2C authentication alias as
follows:
Alias:
User ID:
Password:
adventure
adventure
adventure
After saving the changes, you see a window similar to Figure 9-10.
Figure 9-10 J2C aliases created
Now you create the data sources. The application uses two data sources,
jdbc/CatalogDB and jdbc/adventure/AdventureDB.
Creating data sources
CMP beans and the Web application use data sources to connect to the
database. You create two data sources:
jdbc/CatalogDB
jdbc/adventure/adventureDB
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
435
To create the data sources:
1. From the left navigation pane, select Resources → JDBC → Data sources.
2. Select Scope pull-down menu and click New (Figure 9-11).
Figure 9-11 Select scope for data source
436
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Complete the following fields as shown in Figure 9-12:
Data source name
CatalogDB
JNDI name
jdbc/CatalogDB
ComponentManaged authentication alias Adventure
Figure 9-12 Data source configuration
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
437
4. Click Next. Click Select an existing JDBC provider and select the JDBC
provider. In our example, DB2 Universal JDBC Provider (XA) as shown in
Figure 9-13.
Figure 9-13 Select JDBC provider for data source
438
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Click Next to open the database specific properties window (Figure 9-14).
6. Complete the following fields:
Database name
Driver type
Server name
Port number
ADVNTRDB
4
localhost
50000
The “Use this data source in container managed persistence (CMP)” option is
selected by default.
Figure 9-14 Database specific properties for the Data Source
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
439
7. Click Next to see the summary as shown in Figure 9-15 and then click Finish
and save the configuration.
Figure 9-15 Data source creation summary
440
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
8. Repeat steps from 2 through 8 to create another data source,
jdbc/adventure/AdventureDB. In step 3, complete the following information as
shown in Figure 9-16.
Data source name
AdventureDB
JNDI name
jdbc/adventure/AdventureDB
ComponentManaged authentication alias AdventureBuilder
Figure 9-16 Basic data source information
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
441
Now the data source is listed in the Data sources page as shown in Figure 9-17.
Figure 9-17 Data Sources created
9.2.2 Configuring the JMS resources
Defining JMS resources in WebSphere Application Server is very different from
defining them in WebSphere Application Server Community Edition V1.1.0.1.
WebSphere Application Server V6.1 uses a Service Integration Bus as the
back-end support for its default messaging. Thus, in addition to the JMS
resources from the WebSphere Application Server Community Edition
deployment plan, you need to define a bus to support messaging, a bus member
(the application server), and a bus destination for each of the JMS destinations.
442
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Creating the bus
Complete the following steps to create the bus:
1. Click Service Integration → Buses.
2. Click New (Figure 9-18).
Figure 9-18 Creating new service bus
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
443
3. Enter the name of new bus as AdventureBuilderBus and click Next as shown
in Figure 9-19.
Figure 9-19 Create a new bus
444
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. A summary of the bus creation displays (Figure 9-20). Click Finish to create
the bus.
Figure 9-20 Bus creation summary
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
445
A window displays to confirm that the bus was created (Figure 9-21).
Figure 9-21 Bus created
446
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Adding a member to the bus
Complete the following steps to add a member to the bus:
1. Click AdventureBuilderBus.
2. Click Bus Members from Topology and then click Add (Figure 9-22).
Figure 9-22 Bus properties
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
447
3. Select Server and select Blade18Node01:server1 as shown in Figure 9-23.
Click Next.
Figure 9-23 Adding a server as bus member
448
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Accept the default (File store) for Select the type of message store option and
click Next, as shown in Figure 9-24.
Figure 9-24 Type of message store
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
449
5. Accept the defaults for Message Store Properties and click Next
(Figure 9-25).
Figure 9-25 Message store properties
450
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Click Finish to add Node=blade18Node01, Server=server1 as member of the
AdventureBuilderBus.
Figure 9-26 Confirmation of Bus Member addition
Creating destination queues
You need to create a destination for the following queues:
ActivityQueue
AirlineQueue
LodgingQueue
CRMQueue
OrderFillerQueue
WebServiceBrokerQueue
WorkFlowMgrQueue
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
451
Note: The destination names that we specify here are arbitrary. You map JMS
destination names to these names later. These destination names need not
be the same as queue names; however, we use destination names that are
the same as queue names for convenience.
To create destination queues:
1. Navigate to Service integration → Buses → AdventureBuilderBus and
then click Destinations (Figure 9-22 on page 447) from Destination
Resources to see a window similar to Figure 9-27.
2. Click New.
Figure 9-27 Bus Destinations
452
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Select Queue as destination type and click Next (Figure 9-28).
Figure 9-28 Select Destination type
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
453
4. Enter ActivityQueue as the identifier and click Next as shown in Figure 9-29.
Figure 9-29 Destination queue Identifier
454
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
5. Select Node=blade18Node01, Server=server1 as bus member that will
store and process the messages for the queue and click Next (Figure 9-30).
Figure 9-30 Assign destination queue to bus member
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
455
6. Click Finish to create the queue, as shown in Figure 9-31.
Figure 9-31 Confirm destination queue creation
7. Repeat steps 2 through 6 for each queue destination. For each queue
destination, in step 4 on page 454, you need to enter the queue identifier as
follows:
–
–
–
–
–
–
456
AirlineQueue
LodgingQueue
CRMQueue
OrderFillerQueue
WebServiceBrokerQueue
WorkFlowMgrQueue
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
After you create all the queues, the destination window looks similar to
Figure 9-32.
Figure 9-32 All destination queues created
Creating Queue Connection Factories
You need to create the following Queue Connection Factories:
ActivityQueueConnectionFactory
AirlineQueueConnectionFactory
LodgingQueueConnectionFactory
OpcQueueConnectionFactory
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
457
To create the Queue Connection Factories:
1. Navigate to Resources → JMS → Queue connection factories. Select the
Server scope as Node=blade18Node01, Server=server1 as shown in
Figure 9-33.
Figure 9-33 Select scope for queue connection factory
2. Click New to create a new Queue Connection Factory.
458
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Select Default messaging provider and click OK (Figure 9-34).
Figure 9-34 Message Provider for queue connection factory
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
459
4. Enter the following fields and click Apply as shown in Figure 9-35.
Name
JNDI name
Bus name
ActivityQueueConnectionFactory
jms/activity/QueueConnectionFactory
AdventureBuilderBus
Figure 9-35 Properties of Queue Connection Factory
5. Click Save to master configuration. Repeat steps 2 through 4 for each
Queue Connection Factory with the values shown in Table 9-1.
Table 9-1 Queue Connection Factory details
Name
JNDI Name
Bus Name
AirlineQueueConnectionFactory
jms/airline/QueueConnectionFactory
AdventureBuilderBus
LodgingQueueConnectionFactory
jms/lodging/QueueConnectionFactory
AdventureBuilderBus
OpcQueueConnectionFactory
jms/opc/QueueConnectionFactory
AdventureBuilderBus
460
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
After completing all the steps, the window should look similar to Figure 9-36.
Figure 9-36 All Queue Connection Factories created
Creating queues
You need to create queues for all the MDBs. You have already created bus and
queue destinations in earlier steps. You now create the following seven queues:
ActivityQueue with JNDI Name: jms/activity/ActivityQueue
AirlineQueue with JNDI Name: jms/airline/AirlineQueue
LodgingQueue with JNDI Name: jms/lodging/LodgingQueue
CRMQueue with JNDI Name: jms/opc/CRMQueue
OrderFillerQueue with JNDI Name: jms/opc/OrderFillerQueue
WebServiceBrokerQueue with JNDI Name:
jms/opc/WebServiceBrokerQueue
WorkFlowMgrQueue with JNDI Name: jms/opc/WorkFlowMgrQueue
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
461
To create the queues:
1. Navigate to Resources → JMS → Queues. Select the Server scope as
Node=blade18Node01, Server=server1 as shown in Figure 9-37.
2. Click New to create a new Queue.
Figure 9-37 Select server scope for queue
462
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Select Default messaging provider and click OK (Figure 9-38).
Figure 9-38 Select Messaging Provider for the queue
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
463
4. Enter the following fields and click Apply as shown in Figure 9-39.
Name
JNDI name
Bus name
Queue name
ActivityQueue
jms/activity/ActivityQueue
AdventureBuilderBus
ActivityQueue
Figure 9-39 Properties of the queue
5. Click Save to master configuration. Repeat steps 2 through 4 for each
queue with the values shown in Table 9-2.
Table 9-2 Properties of the queues
Name
JNDI Name
Bus Name
Queue Name
AirlineQueue
jms/airline/AirlineQueue
AdventureBuilderBus
AirlineQueue
LodgingQueue
jms/lodging/LodgingQueue
AdventureBuilderBus
LodgingQueue
CRMQueue
jms/opc/CRMQueue
AdventureBuilderBus
CRMQueue
464
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Name
JNDI Name
Bus Name
Queue Name
OrderFillerQueue
jms/opc/OrderFillerQueue
AdventureBuilderBus
OrderFillerQueue
WebServiceBroke
rQueue
jms/opc/WebServiceBrokerQu
eue
AdventureBuilderBus
WebServiceBrokerQue
ue
WorkFlowMgrQue
ue
jms/opc/WorkFlowMgrQueue
AdventureBuilderBus
WorkFlowMgrQueue
After you create all the queues, you see a window similar to Figure 9-40.
Figure 9-40 All queues created
Creating activation specification
Finally, you define activation specifications for each MDB in each application of
Adventure Builder. Activation specifications define the information that is found
in the <activation-config> element of each message-driven bean in
openejb-jar.xml.
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
465
To create the activation specifications:
1. Navigate to Resources → JMS → Activation specifications. Select the
Server scope as Node=blade18Node01, Server=server1 as shown in
Figure 9-41.
2. Click New to create a new activation specification.
Figure 9-41 Select the scope of the activation specification
466
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Select Default messaging provider and click Next as shown in Figure 9-42.
Figure 9-42 Select Messaging Provide for activation specification
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
467
4. Complete the following fields as shown in Figure 9-43. Click Apply.
Name
JNDI name
Destination type
Destination
Bus name
ActivityActivation
jms/activity/ActivityActivation
Queue
JNDI name jms/activity/ActivityQueue
AdventureBuilderBus
Figure 9-43 Properties of the activation specification
5. Click Save to master configuration.
468
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Repeat steps 2 through 4 for each activation specification with the values
listed in Table 9-3.
Table 9-3 Properties of the activation specifications
Name
JNDI Name
Destination
Type
Destination
Bus Name
AirlineActivation
jms/airline/AirlineAct
ivation
Queue
jms/airline/AirlineQu
eue
AdventureBuilderBus
LodgingActivation
jms/lodging/Lodging
Activation
Queue
jms/lodging/Lodging
Queue
AdventureBuilderBus
CRMActivation
jms/opc/CRMActivat
ion
Queue
jms/opc/CRMQueue
AdventureBuilderBus
OrderFillerActivation
jms/opc/OrderFiller
Activation
Queue
jms/opc/OrderFiller
Queue
AdventureBuilderBus
WebServiceBrokerA
ctivation
jms/opc/WebServic
eBrokerActivation
Queue
jms/opc/WebServic
eBrokerQueue
AdventureBuilderBus
WorkFlowMgrActiva
tion
jms/opc/WorkFlowM
grActivation
Queue
jms/opc/WorkFlowM
grQueue
AdventureBuilderBus
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
469
After you complete all the steps, you see a window similar to Figure 9-44.
Figure 9-44 All activation specifications created
470
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9.2.3 Configuring Mail
Complete these steps to configure the mail server:
1. To configure the Java mail functionality, navigate to Resources → Mail →
Mail Session in the left navigation pane.
2. Select the scope as Node=blade18Node01, Server=server1 and click New
as shown in Figure 9-45.
Figure 9-45 Select scope for Mail Session
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
471
3. Enter the following fields and click Apply as shown in Figure 9-46.
Provider
Name
JNDI Name
Mail transport host
Mail transport protocol
Mail from
Built-In Provider
MailSession
mail/MailSession
localhost
smtp
[email protected]
Figure 9-46 Properties of the Mail Session
4. Click Save to master configuration.
472
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
9.3 Installing the applications
Now you need to install all modules of Adventure Builder application:
1. Click Applications → Install New Application.
2. Click Browse and select activitysupplier.ear from <ab_home> file and click
Next (Figure 9-47).
Figure 9-47 Install new Application: Specify location of file
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
473
3. Click Next (Figure 9-48).
Figure 9-48 Select Install options
474
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
4. Click Next (Figure 9-49).
Figure 9-49 Select server for installation
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
475
5. Click Finish to deploy the application, as shown in Figure 9-50. After
deployment, click Save to the master configuration.
Figure 9-50 Installation summary
6. Repeat steps 1 through 4 to install the following EAR files:
–
–
–
–
–
476
airlinesupplier.ear
lodgingsupplier.ear
opc.ear
bank.ear
consumerwebsite.ear
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
After you have installed all the applications, you see a window similar to
Figure 9-51.
Figure 9-51 Enterprise application
7. Select all the newly installed applications and click Start to run the
applications.
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
477
9.4 Testing the application
The Adventure Builder application is deployed and started successfully in the
form of six EAR files. To test the working of the application, complete the
following steps:
1. Open a Web browser. Enter http://localhost:9080/ab/index.jsp in the
address bar to see a window similar to that shown Figure 9-52.
2. Click Start building an adventure.
Figure 9-52 First page of the Adventure Builder application
478
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
3. Click Sign On in the Adventure Builder Reference Application home page as
shown in Figure 9-53.
Figure 9-53 Home page
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
479
4. Initially, the Create New Account button is disabled. It is enabled when you
click inside the User Name text box. We create a new user, ITSOResident,
with the password as password, as shown in Figure 9-54.
5. Click Create New Account.
Figure 9-54 Sign in or create new user
480
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
6. Enter the user details and click Create Account as shown in Figure 9-55.
Figure 9-55 Create New Account
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
481
When the user account is created successfully, a page similar to that shown
in Figure 9-56 displays.
Figure 9-56 Account Creation Success
482
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
7. You can click any of the Adventure Categories. For our example, we select
Mountain Adventures (Figure 9-57).
Figure 9-57 Select the type of adventure
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
483
8. Then, we select Mountain Climbing Adventure. Figure 9-58 shows the
result.
9. Click Select Package.
Figure 9-58 Choose the package for adventure
484
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
10.Click Set Package Options (Figure 9-59).
Figure 9-59 Specify package details
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
485
11.Click Show Available Flights as shown in Figure 9-60.
Figure 9-60 Select transportation means own/flight
486
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
12.A page similar to that shown in Figure 9-61 displays. If you were to click I Will
Provide My Own Transportation, then Figure 9-61 is skipped.
13.Click Purchase Selected Flights.
Figure 9-61 Select flight
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
487
14.Click Checkout to purchase the adventure (Figure 9-62).
Figure 9-62 Adventure Package summary
488
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
15.Confirm the billing information. Scroll down the window and click SUBMIT.
Refer to Figure 9-63.
Figure 9-63 Billing information
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
489
16.The order is created successfully (Figure 9-64).
Figure 9-64 Order number generation and successful checkout
490
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
17.To check the order, click the application-generated order number. You can
see all order details as shown in Figure 9-65.
Figure 9-65 Tracking the order
Chapter 9. Deploying Adventure Builder on WebSphere Application Server
491
492
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
A
Appendix A.
Additional material
This IBM Redbook publication refers to additional material that you can
download from the Internet as described in this appendix.
Locating the Web material
The Web material that is associated with this IBM Redbook is available in
softcopy on the Internet from the IBM Redbooks Web server. Point your Web
browser at:
ftp://www.redbooks.ibm.com/redbooks/SG247433
Alternatively, you can go to the IBM Redbooks Web site at:
ibm.com/redbooks
Select the Additional materials and open the directory that corresponds with
the IBM Redbook form number, SG247433.
© Copyright IBM Corp. 2007. All rights reserved.
493
Using the Web material
The additional Web material that accompanies this book includes the following
files:
File name
Adventure-src.zip
MigratedAdventureBuilder.zip
Description
Adventure compressed code samples
Migrated Adventure Builder compressed
files
Getting the Plants by WebSphere application
You download the Plants by WebSphere application along with WebSphere
Application Server Community Edition from the IBM site:
https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=ws
ced&S_PKG=1102&S_TACT=105AGX28&S_CMP=DLMAIN&lang=en_US&cp=UTF-8
You need to log in using your developerWorks ID and password. In the Sample
J2EE Applications page, download and decompress the Plants by WebSphere
application following the instructions there.
How to use the Web material
Create a subdirectory (folder) on your workstation, and decompress the contents
of the Web material zipped file into this folder.
494
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Related publications
We consider the publications that we list in this section particularly suitable for a
more detailed discussion of the topics that we cover in this IBM Redbook
publication.
IBM Redbooks
For information about ordering these publications, see “How to get IBM
Redbooks publications” on page 498. Note that some of the documents
referenced here might be available in softcopy only.
Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6,
SG24-6690
MySQL to DB2 UDB Conversion Guide, SG24-7093
Online resources
These Web sites are also relevant as further information sources:
Supported software and versions for WebSphere Application Server V6.1
http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg27007642Descr
iption2
WebSphere Application Server Community Edition
http://www-306.ibm.com/software/webservers/appserv/community/features/
WebSphere Application Server Community Edition detailed system
requirements
http://www-1.ibm.com/support/docview.wss?uid=swg27006834
WebSphere fix pack
http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg24012718
http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg24014336
JUnit and Hyades sites, respectively
http://www.junit.org
http://www.eclipse.org/hyades
© Copyright IBM Corp. 2007. All rights reserved.
495
Rational Application Developer for WebSphere Software - features and
benefits
http://www-306.ibm.com/software/awdtools/developer/application/featu
res/index.html?S_CMP=wspace
Rational Application Developer for WebSphere Software - system
requirements
http://www-306.ibm.com/software/awdtools/developer/application/sysre
q/index.html
The IBM WebSphere Application Server Migration Services Program
http://www-128.ibm.com/developerworks/ondemand/migrate/server.html
Patterns for e-business site
http://www.ibm.com/developerworks/patterns
Interoperating transactionally between application servers
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topi
c=/com.ibm.websphere.nd.doc/info/ae/ae/tjta_intop.html
The IBM DB2 Migration Toolkit
http://www.ibm.com/software/data/db2/migration/mtk
Ispirer Systems Ltd. offers the SQLWays migration tool
http://www.ispirer.com/products
MySQL database
http://www.logemann.org/blojsom/blog/default/2005/05/10/why_i_love_M
ySQL_as_developer_database.html?page=comments
Download a trial WebSphere Application Server V6.1
http://www-128.ibm.com/developerworks/downloads/ws/was/?S_TACT=105AG
X28&S_CMP=DLMAIN
Command line profile tool
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topi
c=/com.ibm.websphere.nd.doc/info/ae/ae/rxml_manageprofiles.html
Rational Application Developer V7.0
http://www-128.ibm.com/developerworks/downloads/r/rad/?S_TACT=105AGX
15&S_CMP=LP
Ant tasks, refer to the WebSphere Application Server V6.1 Information Center
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topi
c=/com.ibm.etools.ant.tasks.doc/topics/tjant.html
496
Migrating from WebSphere Application Server Community Edition to WebSphere Application
Refer to the WebSphere Application Server Information Center for more
information about how to run and develop thin clients
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.
websphere.express.doc/info/exp/ae/tcli_developthin.html
For further information and examples of scripting, refer to the WebSphere
Application Server V6.1 Information Center
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topi
c=/com.ibm.websphere.base.doc/info/aes/ae/txml_script.html
Download sample administration scripts
http://www.ibm.com/developerworks/websphere/library/samples/SampleSc
ripts.html
DB2 Universal Database Express Edition V8.2. For further DB2 installation
and configuration instructions, refer to the DB2 Information Center
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp
Download DB2 Universal Database V8.2 Express Edition
http://www.ibm.com/developerworks/downloads/im/udbexp
The WebSphere Application Server Community Edition V1.1 documentation
http://publib.boulder.ibm.com/wasce/V1.1.0/en/index.html
Download WebSphere Application Server Community Edition
http://www-128.ibm.com/developerworks/downloads/ws/wasce/?S_TACT=105
AGX10&S_CMP=WESDL
Download Eclipse Web Tools Platform V1.5.2
http://download.eclipse.org/webtools/downloads
Download XDoclet 1.2.3
http://sourceforge.net/project/showfiles.php?group_id=31602
Download WebSphere Application Server Community Edition Eclipse Plugin
1.1.0.1
http://www-128.ibm.com/developerworks/downloads/ws/wasce/?S_TACT=105
AGX10&S_CMP=WESDL
Download Sun JRE 1.5.0
http://java.sun.com/javase/downloads/index_jdk5.jsp
Download Java Web Services Developer Pack 2.0
http://java.sun.com/webservices/downloads/webservicespack.html
Related publications
497
Apache Ant is a Java-based build tool. Apache Ant 1.7.0
http://ant.apache.org/bindownload.cgi
Article describes how to solve JCL problems on WebSphere
http://www.ibm.com/support/docview.wss?uid=swg27004610
How to get IBM Redbooks publications
You can search for, view, or download Redbooks, IBM Redpapers, Technotes,
draft publications and Additional materials, as well as order hardcopy Redbooks,
at this Web site:
ibm.com/redbooks
Help from IBM
IBM Support and downloads
ibm.com/support
IBM Global Services
ibm.com/services
498
Migrating from WebSphere Application Server Community Edition to WebSphere Application
Index
A
AccountServlet 148–149
activation configuration 372
Activation Spec JNDI name 356
Activation Specification 139
ActiveMQ 11
ActivityEB 372
ActivityLocalHome 374
ActivityPOEndpointBeanService 397
ActivitySupplier 223
activitysupplier-ejb 371
activitysupplier-ejb project 353, 392
adaptable applications 2
AddressEB 372
AddressLocalHome 374
AdminApp 85
AdminConfig 84
AdminControl 84
Administrative Console 60
AdminServlet 148–149
AdminTask 85
Adventure Builder 222, 347
Adventure Builder Reference application 223
adventurebuilder.zip 349
adventure-src.zip 223
AirlinePOEndpointBeanService 397
AirlineQueue 456
AirlineSupplier 223
AIX 10
Annotation-based programming 15
Ant 39
Ant 1.5.1 4
Apache Ant 122, 147, 498
Apache Ant 1.5.1 4
Apache Ant 1.7 222
Apache Ant 1.7.0 123
Apache Axis 11, 101
Apache Cloudscape 101
Apache Geronimo 11–12, 101
Apache Log4j 135
Apache Maven 147
Apache Maven 1.0.2 4
Apache Tomcat 11–12, 101
© Copyright IBM Corp. 2007. All rights reserved.
Apache Velocity 1.3.1 4
Apache Xalan 127, 132
Apache Xerces 127, 132
Application analysis 15
application class loader 130
application class loaders 129
Application Client 23
Application Client Project 23
Application data source class loader 128
Application EAR class loader 128
application packaging
packaging 134
application portability 134
Application Server Toolkit 2, 13, 17, 37–38
Application Server Toolkit V6.1 147
Application WAR2 class loader 128
application.xml 133
application-client.xml 133
applications 134
Attribute-Oriented Programming 108
auto primary key generation 355
ava Authentication and Authorization Service 178
AVK 125
B
BackOrder 202–203
BackOrder CMP 2.0 bean 150
BackOrder CMP entity bean 150
BackOrder entity bean 152
backorder.jsp 150
BackOrderStock 202
BackOrderStock session bean 152
BackOrderStock stateless session bean 150
Bank 223
bank-ejb project 367
Bean names 355
beanclassname 374
Bean-managed persistence (BMP) 147
bean-managed persistence (BMP) bean 150
blog 42
bootstrap 129
Bootstrap class loaders 128
BrokerRequesterBean 397
499
BrokerRequestorBean 372, 403
BrokerServiceBean 372–373, 387, 396
BrokerServiceIntf.java 291
build path errors 198
Business processes 32
C
Cactus 22
Catalog session bean 149–150
checkStatus action 150
class loader isolation policies 130
Class loader modes 131
class loaders 128
ClassNotFoundException 130
CLASSPATH 129
ClearCase 16
coexistence migration 41
com.sun.j2ee.blueprints.lodgingsupplier.pomessagebean package 291
command line processor (CLP) 424
Community Edition Administrative Console 222
Compatibility Test Suite 125
Concurrent Versions System 16
connection pool 155
connectiondefinition-instance tag 158
ConsumerWebsite 223
ConsumerWebsite application 325
ContactInfoEB 372–373
ContactInfoLocalHome 374
Container Managed Persistence (CMP) 256
container-managed persistance entity bean (CMP)
150
container-managed persistence (CMP) 147
container-managed relationships (CMR) 148
Copy Utility Jars 284
CORBA 25
CORBA CSIv2 30
CORBA Object Transaction Service 30
CreditCardEB 372
CreditCardEndpointBeanService 397
CreditCardLocalHome 374
CRMBean 372–373
CRMQueue 456
CTS 125
custom key generator class 137
Customer entity bean 151
CVS 16
500
D
data source 222, 353, 363
data type overflow 138
database mapping 366
Database migration 41
database schema 132
database schemas 137
DB2 CLP 224
DB2 Universal Database Express Edition V8.2 87,
147, 222
DB2 Universal Database V8.2 123
db2cmd 224
DDL 42, 137
deployment descriptor editor 354
deployment descriptors 132
Destination JNDI name 356
Development environment 21
development tools 13
doPopulate method 199
dynamic proxies 291
E
EAR Application Class Loader heirarchy 128
Eclipse 35, 197, 221, 246
Eclipse 3.2.1 SDK 107
Eclipse Modelling Framework (EMF) 107
Eclipse technology-based Web tools platform 11
Eclipse Web Tools Platform 107, 222–223, 246,
293
Eclipse Web Tools Platform V1.5.2 107, 123, 497
EIS 2
EJB 134
EJB CMP 2.0 3
EJB module 135, 222
EJB QL 143
EJB SSB 2.0 3
EJB to RDB mapping tool 138
ejb-jar.xml 133, 283
EJBs 353, 363
Enterprise Information System 2
Enterprise Java Beans 22
Enterprise JavaBeans (EJB) 11
Enterprise Resource Planning 8
Enterprise Service Bus 24
Entity Bean 256
entity beans 411
Environments
development 21
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
production 21
test 21
ERP 8
ESB 24
Extensions class loaders 128
External Jar directory field 285
F
FileRegistrySample 184
fix 78
fix pack 56
Functional Verification Test 23
FVT 23
G
GEF 107
generated directory 291
geronimo-application.xml 292
getorderitems BackOrderStock method 150
Graphical Editing Framework (GEF) 107
graphical user interface 8
Greenhouse by WebSphere 146
GUI 8
H
Hardware 32
hardware 46
Haydes technology 16
Hibernate 40, 42
hidden classes 129
HP-UX 10
HTML pages 148
HTML Syntax Validator 325
HTML validation 324
HTTP 8, 24
HTTP socket 25
I
i5/OS 10
IBM 32 bit SDK for Java 2, v5.0 101
IBM Cloudscape 11, 101
IBM DB2 11
IDE 37
IdGenerator 202
IDL 9
IIOP 25
ImageServlet 148–149
Informix 42
InitialContext factory 139
install applications 63
integrated development environment (IDE) 349
Integrated Development Environments 37
Integration with other products 32
IntellyJ IDEA 35
interim fix 78
Internet address parsing 183
Interoperability 24
Best performance 29
Bidirectional 28
Client transaction 31
Easy to setup 29
JTA (2PC) support 30
Loose coupling 29
Low cost 29
Security propagation 30
Strategic 28
Supported 28
Synchronous 28
Tested 28
Inventory bean 150
Inventory beans 150
Inventory CMP entity bean 149
Inventory data 149
Inventory entity bean 151
Inventory objects 149
inverse-classloading 129
Ispirer Systems Ltd. 42, 496
J
J2EE xi, 2, 8–9
J2EE 1.4 145, 221, 223
J2SE 8
J2SE 5.0 146
JACL 84
Jakarta Commons Logging V1.2 131
JAR 134
Java 8
Java 2 Platform Enterprise Edition 8
Java 2 Platform Enterprise Edition (J2EE) 101
Java 2 platform, enterprise edition (J2EE) 148
Java 2 Standard Edition 8
Java API for XML-based remote procedure call
(JAX-RPC) 148
Java Application Verification Kit 125
Java Authorization Contract for Containers (JACC)
Index
501
12
Java Connector Architecture 9
Java DataBase Connectivity 9
Java Database Connectivity (JDBC) 11
Java Developer Kit (JDK) 11
Java EMF Model (JEM) 107
Java Interface Definition Language 9
Java Mail 1.2 3
Java Mail API 181
Java Management Extensions (JMX) 4, 11
Java Message Service 9
Java Message Service (JMS) 11
Java Native Interface 137
Java Transaction API 9
Java Transaction API (JTA) 11
Java Web Services Developer Pack 2.0 109, 123,
222–223
java.lang.Long generatedPkField 374
java.rmi.Remote 287
JavaDoc comment 309
JavaMail 9
JavaMail API 149, 151
JavaServer Pages (JSP) 148
javax.servlet.Filter 314
JAXM APIs 143
JAX-RPC 142
JAX-RPC APIs 143
JAX-RPC mapping file 291
JAX-RPC request 150
JCA 9
JCA Adapter binding 372
JCL 131
JDBC 9, 40
JDBC 2.1 3
JDK 11
JDKs 146
JDO 40
JDom 132
JEM 107
JIDL 9
JMS 9, 24, 139
JMS 1.0.2 3
JMS Activation Specification 139
JMS connection factories 139
JMS resources 222
JNDI - CMP Connection Factory Binding 354
JNDI Explorer 83
JNDI lookups 142
JNDI Names 355
502
JNDI names 353
JNI 137
JSP 1.2 3
JSP 1.2 taglibs 3
JSP pages 148
JSP Standard Type Library 143
JSTL 143
JTA 9, 25
JTS 9
JUnit 4
JUnit technology 16
JUnitEE 4, 22
JVM Internal classes 128
JWSDP 137
Jython 84
K
KeySequenceDirect 127
L
Lightweight Directory Access Protocol (LDAP) 12
Linux/Intel 10
Linux/PPC 10
listener ports 139
Lodging Supplier Module 286
LodgingEB 372
LodgingLocalHome 374
LodgingMessage 382
LodgingMessageEJB 396
LodgingPOEndpoint 382
LodgingPOEndpointBean 286, 389
LodgingPOEndpointBeanSessionService 397
LodgingPurchaseOrderService.wsdl 288
LodgingPurchaseOrderServiceMap.xml 288
LodgingQueue 456
LodgingSupplier 223
LodgingSupplier EJB Application 255
lodgingsupplier.ear 378
Log4j.jar 135
Login session bean 149, 151
M
Mailer bean 151
Mailer session bean 151
Mailer stateless session bean 149
MailSession object 181
manage applications 64
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
ManagerEB 376
mapping database schemas 138
mapping files 353, 363
mapping tool 138
Maven 39
Maven 1.0.2 4
Message Driven Bean 256
Message Driven Beans 143
metadata 108
META-INF directory 283, 291
Microsoft SQL 42
Microsoft SQL Server 11
migration
issues 2
process 2
strategies 2
tools 2
migration activities 31
migration approach
coexistence 41
offline 41
switchover 41
migration strategy 20
Modularization 22
MultiParent class loader 128
MX4J 11
MySQL 11, 42, 138
N
non-overridable-classes 129
O
ObjectWeb 11
ObjectWeb (HOWL) 11
OEJP protocol 28
offline migration 41
OMG 25
opc 369
OPC project 397
opc-ejb project 369
OpcOrderTrackingService 325
OpcPurchaseOrderService 325
Open Services Infrastructure 9
open source community 101
OpenEJB 11, 101
openejb-jar.xml 283, 353, 363
Oracle 42
Oracle® 11
Order CMP entity bean 149
Order entity bean 151
Order Processing Center (OPC) 349, 368
ORDER_ORDERID 213
OrderFillerBean 372–373
OrderFillerQueue 456
ORDERITEM 213
OrderItem 202
OrderItem entity bean 151
OrderProcessingCenter (OPC) 223
OS/390 10
OS/400 10
OtEndPointBean 373
OtEndpointBean 372, 388
OTS 30
P
Packaging
WebSphere 9
parent class loader 129
parent first 131
parent last 131
pbw.properties 150
pbwdbplan.xml 158
pbwdeploy-plan.xml 159
planning activities 31
Plants by WebSphere 146
PlantsByWebSphereEAR subdirectory 153
PlantsByWebSphereEJB subdirector 153
PlantsByWebSphereWEB subdirectory 153
PlantsGalleryWEB subdirectory 153
PoEndPointBean 373
PoEndpointBean 372, 388
po-jaxrpc-config.xml 288
Populate.java 199
portable applications 2
primary key 126
PrimaryKeyGenerator.java 374
ProcessManagerSB 376
Production environment 21
Project Facets 258
Project Object Model 147
PurchaseOrderEB 372–373
Python implemented in Java 84
Q
QoS 26, 28
queue connection factor 363
Index
503
queue connection factories 353
queues 353, 363
R
RAD 137
RAR 134
Rational Application Developer V6 13
Rational Application Developer V7.0 14, 35, 47,
123, 349
Rational ClearCase 15
Rational ClearCase LT 16
Rational Product Updater 78
Rational RequisitePro 15
Rational Tools Suite 15
Rational Unified Process 15
Rational Web Developer V6 13
rdb mapping 136
RDB mappings 411
Redbooks Web site 498
Contact us xv
ReportGenerator 202
ReportGenerator session bean 151
ResetDB 150, 202
ResetDB entity bean 152
RMI-IIOP 25
RUP 15
S
SAAJ APIs 142
SampAdmin 215
Scalability 9
schema mapping 132
SCM 16
security permissions 159
sendOrder method 150
serverStatus 81
Service Endpoint Interface (SEI) 287
service references 353
servicelocator utility jar 283
servicelocator.jar 285
Servlet 2.3 3
ServletRequestAtrributeListener 143
ServletRequestListener 143
servlets 148
Servlets and JavaServer Pages (JSP) 11
session beans 353
setupCmdLine script 58
ShoppingCart 202
504
ShoppingCart bean 149
ShoppingCart session bean 151
ShoppingCart stateful session bean 149
ShoppingServlet 148–149
SignOnNotifier 318
Simple Object Access Protocol 24
SlickEdit 35
SMTP 24
Solaris 10
Source code 32
Source Code Management 16
SQL commands 222
sql directory 153
SQL scripts 137
SQLLIB 154
SQLWays 42, 496
startServer 80
stateful session beans 148
Stateless Session Bean 256
stateless session beans 148
stopServer 82
strategies 2
submitLodgingReservationDetails 286–287
Sun JWSDP v2.0 287, 290
Sun Microsystems, Inc. 222
Supplier CMP 2.0 bean 150
Supplier entity bean 152
supplierconfig.jsp 150
Suppliers session bean 152
SVT 23
switchover migration 41
Sybase 42
system class loader 129
System Integration Test 23
T
Table.ddl 411
TCL-based scripting language 84
Test environments 21
thin application clients 141
third-party JMS 25
Topology 32
TranQL 11
tranql 158
tranql connector 230
TransportationEB 372
TransportationLocalHome 374
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
U
UML 15
UML Topics 15
Unified Modeling Language 15
Unit testing 16
Universal Test Client 38, 82
users.properties 159
UTC 38, 82
Utility Classes 22
utility.jar 135
V
Velocity 1.3.1 4
W
WAR 134
wasce_samples-1.1.0.1.zip 153
wasprofile 59
Web Application 23
Web application module 135
Web module 222
Web module class loader 130
Web module class loaders 129
Web Service Client 137
Web service servlet 148
Web services 8, 24
Web services client code 353, 363
Web Tools Platform 107
web.xml 133, 140
Web-centric application development 107
WebLogic 29
WebServiceBroker 286
WebServiceBroker.java 291
WebServiceBrokerQueue 456
webservices.xml 289, 353, 363
WebSphere 7
packaging 9
WebSphere Application Server 9
WebSphere Application Server Community Edition
Eclipse Plugin 223, 255
WebSphere Application Server Community Edition
Eclipse Plugin 1.1.0.1 123, 222
WebSphere Application Server Community Edition
V1.1.0.1 145–146, 222
WebSphere Application Server Migration Services
Program 20, 496
WebSphere Application Server V6.1 47, 123
WebSphere Application Server V6.1 - Base 147,
347
WebSphere MQ 24, 29
WebSphere profiles 58
WebSphere runtime class loaders 129
Windows 10
WORA 125
WorkFlowManagerBean 372, 397, 403
WorkFlowMgrBean 373
WorkFlowMgrQueue 456
Workspace Launcher 246
Write Once, Run Anywhere 125
wsadmin scripts 84
WS-AtomicTransaction 30
wscompile 288
wscompile tool 287, 290
WSDL 25
wsdl file 290
wsdl files 353, 363
WS-I Basic Security Profile 30
WS-Security 30
X
Xalan 127
XDoclet 15, 108, 223, 255, 293, 377
XDoclet 1.2 4
XDoclet 1.2.3 123
XDoclet annotations 38
XDoclet Builder 311
Xerces 127
XMI 138
XML 8
XMLBuddy Pro 35
XMLSpy 35
XSLT 35
Z
zLinux 10
Index
505
506
Migrating from WebSphere Application Server Community Edition to WebSphere Application Server
Migrating from WebSphere Application Server
Community Edition to WebSphere Application Server
(1.0” spine)
0.875”<->1.498”
460 <-> 788 pages
Back cover
®
Migrating from WebSphere
Application Server Community
Edition to WebSphere
Application Server
Includes migration
strategies to help
make applications
more portable and
adaptable
Provides
step-by-step
migration examples
for J2EE applications
Discusses migration
issues that we
encountered in our
development
This IBM Redbook publication can help you plan and perform
the migration of your J2EE applications that are developed for
WebSphere Application Server Community Edition V1.1.0.1,
enabling them to run on WebSphere Application Server V6.1 Network Deployment. It includes migration strategy
considerations for developing portable applications as well as
working migration examples. This book discusses some of the
most common migration issues that you might encounter when
migrating from J2EE platforms to WebSphere Application
Server V6.1.
In this book, we use two sample applications to demonstrate
how to migrate your J2EE applications. We migrate each
application using a different approach and different
development tools. In one migration, we use Rational
Application Developer V7.0 and, in the other, we use the
Application Server Toolkit, which comes with WebSphere
Application Server V6.1 - Base. We also describe step-by-step
how we built and configured our environment for these
migration examples.
The audience for this book includes administrators and
developers that seek a process and instructions for migrating
from WebSphere Application Server Community Edition to the
WebSphere Application Server Basic and Network Deployment
editions.
INTERNATIONAL
TECHNICAL
SUPPORT
ORGANIZATION
BUILDING TECHNICAL
INFORMATION BASED ON
PRACTICAL EXPERIENCE
IBM Redbooks are developed by
the IBM International Technical
Support Organization. Experts
from IBM, Customers and
Partners from around the world
create timely technical
information based on realistic
scenarios. Specific
recommendations are provided
to help you implement IT
solutions more effectively in
your environment.
For more information:
ibm.com/redbooks
SG24-7433-00
ISBN 0738489476
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement