IBMRedbook WebSphereMigrationGuide
IBMRedbook WebSphereMigrationGuide
IBMRedbook WebSphereMigrationGuide
Joao Emilio S B da Silva Kiran Mantripragada Vasfi Gucer Kurtcebe Eroglu Hamdy Eed Fabio Xavier Albertoni
ibm.com/redbooks
International Technical Support Organization WebSphere Application Server V7: Competitive Migration Guide August 2010
SG24-7870-00
Note: Before using this information and the product it supports, read the information in Notices on page xix.
First Edition (August 2010) This edition applies to IBM WebSphere Application Server Version 7.0.
Copyright International Business Machines Corporation 2010. 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
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi The team who wrote this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Now you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . xxiii Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Stay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Scope of this book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Applications covered in this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3.1 Java SE and EE technologies covered . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 What is not covered in this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.5 How to use this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Chapter 2. Common migration issues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1 Java EE application server compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.1 Differences in Java EE implementations. . . . . . . . . . . . . . . . . . . . . . . 8 2.1.2 Using vendor-specific features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.1.3 Deployment descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2 Application portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2.1 Application packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2.2 Java source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.2.3 Use of native code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.2.4 Database-related issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.2.5 Java EE application clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3 J2EE 1.4 to Java EE 5 migration considerations . . . . . . . . . . . . . . . . . . . 21 2.3.1 Java Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3.2 Java Server Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.3.3 Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.3.4 Java Server Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
iii
2.3.5 Web services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.4 Runtime migration issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.4.1 Migrating other products at the same time . . . . . . . . . . . . . . . . . . . . 23 2.4.2 Resource definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.4.3 Development environment issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Chapter 3. WebSphere overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.1 IBM WebSphere Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.1.1 Application infrastructure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.1.2 Application integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.1.3 Business process management . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.1.4 Business rule management systems . . . . . . . . . . . . . . . . . . . . . . . . 29 3.1.5 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.1.6 Portals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2 WebSphere Application Server V7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2.2 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.2.3 Java Platform Enterprise Edition (Java EE) . . . . . . . . . . . . . . . . . . . 36 3.2.4 Evolving Java application development standards . . . . . . . . . . . . . . 38 3.2.5 Supported hardware, platforms, and software . . . . . . . . . . . . . . . . . 39 3.2.6 New features and enhancements in WebSphere Application Server V7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.2.7 Feature packs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.3 Development and deployment tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.3.1 Rational Application Developer for Assembly and Deploy V7.5 . . . . 64 3.3.2 Rational Application Developer for WebSphere Software V7.5 . . . . 66 3.3.3 WebSphere Rapid Deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.3.4 Choosing which tools to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Chapter 4. Migration strategy and planning . . . . . . . . . . . . . . . . . . . . . . . . 69 4.1 Migration process overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 4.1.1 Types of migrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 4.1.2 Important aspects of migrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 4.1.3 Migration considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 4.2 Before beginning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 4.2.1 Migration assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 4.3 Migration planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 4.3.1 Roles and responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 4.3.2 Getting help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 4.3.3 Migration project plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 4.4 Migration implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.4.1 Implementation considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.4.2 Implementation phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
iv
4.4.3 Application migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.4.4 Runtime migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 4.5 Post deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 4.5.1 Performance tuning and optimization . . . . . . . . . . . . . . . . . . . . . . . . 84 4.5.2 WebSphere Application Server V7: New opportunities . . . . . . . . . . . 84 4.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Chapter 5. Installation and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 87 5.1 Hardware and software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 5.2 IBM Rational Application Developer for WebSphere Software . . . . . . . . . 88 5.2.1 Installing the latest fixpack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 5.2.2 Verifying installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 5.3 IBM Application Migration Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 5.3.1 Installing Application Migration Tool into IBM Rational Application Developer for WebSphere Software . . . . . . . . . . . . . . . . . . . . . . . . . 95 5.4 IBM DB2 Server Express Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Chapter 6. Migration from Oracle WebLogic. . . . . . . . . . . . . . . . . . . . . . . . 99 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 6.2 Prerequisites and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 6.3 Oracle WebLogic Server 9.2 installation . . . . . . . . . . . . . . . . . . . . . . . . . 102 6.4 Application Migration Tool overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 6.5 Migrating Trade 3.1 for Oracle WebLogic Server 9.2 . . . . . . . . . . . . . . . 104 6.5.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6.5.2 Configuring the initial environment . . . . . . . . . . . . . . . . . . . . . . . . . 106 6.5.3 Migrating the sample application. . . . . . . . . . . . . . . . . . . . . . . . . . . 113 6.5.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 6.6 xPetstore EJB migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 6.6.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 6.6.2 Configuring the initial environment . . . . . . . . . . . . . . . . . . . . . . . . . 167 6.6.3 Migrating the sample application. . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.6.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Chapter 7. Migrating from JBoss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 7.1 Migrating from older versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 7.2 Preparing the environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 7.2.1 Installing and configuring Apache Ant. . . . . . . . . . . . . . . . . . . . . . . 200 7.2.2 Installing and configuring Apache Maven . . . . . . . . . . . . . . . . . . . . 201 7.2.3 Installing and configuring JBoss Application Server . . . . . . . . . . . . 202 7.2.4 JBoss Seam Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 7.3 Migrating JSF-EJB3 Sample Application from JBoss . . . . . . . . . . . . . . . 203 7.3.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 7.3.2 Verifying JSF-EJB3 sample application . . . . . . . . . . . . . . . . . . . . . 204 7.3.3 Importing the EAR file and source code to RAD . . . . . . . . . . . . . . . 205
Contents
7.3.4 Analyzing and fixing migration problems. . . . . . . . . . . . . . . . . . . . . 211 7.3.5 Managing additional runtime dependencies . . . . . . . . . . . . . . . . . . 212 7.3.6 Checking the project using Application Migration Tool . . . . . . . . . . 220 7.3.7 Build and run application on integrated test environment . . . . . . . . 222 7.3.8 (Optional) Specifications level migration . . . . . . . . . . . . . . . . . . . . . 222 7.3.9 Migrating to WebSphere built-in JPA provider (optional) . . . . . . . . 224 7.3.10 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 7.4 Migrating a Seam application generated with seam-gen . . . . . . . . . . . . 226 7.4.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 7.4.2 Preparing database schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 7.4.3 Generating Seam application using seam-gen . . . . . . . . . . . . . . . . 230 7.4.4 Verifying generated seam-gen application . . . . . . . . . . . . . . . . . . . 234 7.4.5 Importing the EAR file and source code to RAD . . . . . . . . . . . . . . . 235 7.4.6 Analyzing and fixing problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 7.4.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 7.5 Migrating the Online Brokerage application . . . . . . . . . . . . . . . . . . . . . . 254 7.5.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 7.5.2 Building the Online Brokerage application . . . . . . . . . . . . . . . . . . . 255 7.5.3 Creating and populating the database . . . . . . . . . . . . . . . . . . . . . . 256 7.5.4 Importing the EAR file and source code to RAD . . . . . . . . . . . . . . . 258 7.5.5 Analyzing and fixing the problems . . . . . . . . . . . . . . . . . . . . . . . . . 261 Chapter 8. Migrating from Apache Tomcat . . . . . . . . . . . . . . . . . . . . . . . . 275 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 8.2 Prerequisites and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 8.3 Software installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 8.3.1 Apache Tomcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 8.4 MvnForum migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 8.4.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 8.4.2 Configuring the source environment . . . . . . . . . . . . . . . . . . . . . . . . 280 8.4.3 Migrating the MvnForum application . . . . . . . . . . . . . . . . . . . . . . . . 282 8.5 Easy JSP Forum migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 8.5.1 Migration approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 8.5.2 Configuring the source environment . . . . . . . . . . . . . . . . . . . . . . . . 289 8.5.3 Migrating the Easy JSP Forum application to WebSphere . . . . . . . 291 Chapter 9. Migrating from GlassFish. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 9.2 Prerequisites and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 9.3 Java Pet Store Reference application . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 9.3.1 Installing and configuring GlassFish V2.1.1 . . . . . . . . . . . . . . . . . . 304 9.3.2 Building and deploying Java Pet Store on GlassFish . . . . . . . . . . . 305 9.3.3 Migration to WebSphere Application Server . . . . . . . . . . . . . . . . . . 306
vi
9.4 CalculatorWS: A sample web services application . . . . . . . . . . . . . . . . . 318 9.4.1 Running CalculatorWS on NetBeans 6.8 and GlassFish 3 . . . . . . . 319 9.4.2 Migration to WebSphere Application Server . . . . . . . . . . . . . . . . . . 320 9.5 Major issues when migrating web services applications . . . . . . . . . . . . . 322 9.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 Appendix A. Development practices for portable applications . . . . . . . 325 Java EE development practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 J2EE, standards and proprietary solutions . . . . . . . . . . . . . . . . . . . . . . . . 326 Conform to standards as much as possible . . . . . . . . . . . . . . . . . . . . . . . 327 Abstraction is a key point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 Develop the application architecture into layers . . . . . . . . . . . . . . . . . . . . 327 Write and maintain automated tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Use MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Do not reinvent the wheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 Develop to the specifications, not the application server . . . . . . . . . . . . . 334 Build what you know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 Always use session facades whenever you use EJB components . . . . . . 336 Use stateless session beans instead of stateful session beans . . . . . . . . 336 Use container-managed transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Prefer JSPs as your first choice of presentation technology . . . . . . . . . . . 337 Enable session persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Take advantage of application server features that do not require your code to be modified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Play nice within existing environments . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Embrace Java EE, do not fake it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Plan for version updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Log your program state using a standard logging framework . . . . . . . . . . 340 Always clean up after yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Follow rigorous procedures for development and testing . . . . . . . . . . . . . 341 Software Engineering and general development practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Design patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Iterative development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 Object Oriented (OO) approach to design and programming . . . . . . . . . . 347 End-to-end life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 The Rational Unified Process (RUP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Agile development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Appendix B. Migration questionnaires . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 Business requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Contents
vii
Application architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 National language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 Java. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 EJB usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 Servlets and JSPs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Web services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 Database access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 JMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 JNDI naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 Application trace and logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Struts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 Development migration questionnaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Workstation configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Integrated Development Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Development test configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Software development skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Development methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 Build and packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 Ant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 Runtime migration questionnaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 Current hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 Network edge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 Rollout issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 Testing migration questionnaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Hardware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Practices and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Appendix C. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 Locating the web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 Using the web material. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
viii
System requirements for downloading the web material . . . . . . . . . . . . . 376 How to use the web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 How to get Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Contents
ix
Figures
2-1 WebSphere Application Server v7 classloader in default configuration . . 10 2-2 Recommended packaging structure of Java EE application . . . . . . . . . . . 16 3-1 Basic architecture of an application server . . . . . . . . . . . . . . . . . . . . . . . . 31 3-2 Business application services position in SOA reference architecture . . . 32 3-3 Packaging structure of WebSphere Application Server V7.0 . . . . . . . . . . 33 3-4 Web services run time started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3-5 Multiple base profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3-6 Administrative agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 3-7 Administrative agent managing multiple application servers . . . . . . . . . . 50 3-8 Job manager management model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3-9 Rational Application Developer packaging . . . . . . . . . . . . . . . . . . . . . . . . 64 3-10 Rational Software Delivery Platform overview . . . . . . . . . . . . . . . . . . . . 67 4-1 Migration process overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5-1 IBM Installation Manager preferences dialog after adding repositories . . 92 5-2 RAD version information as displayed in About window. . . . . . . . . . . . . . 93 5-3 Integrated testing environment server view . . . . . . . . . . . . . . . . . . . . . . . 94 5-4 Welcome page of test environment showing current version . . . . . . . . . . 94 5-5 Plug-in file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 5-6 Selecting toolkit update site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 5-7 Verifying installation of toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 6-1 Trade3 J2EE components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6-2 EAR file import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 6-3 Trade module selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 6-4 Application Migration Tool configuration . . . . . . . . . . . . . . . . . . . . . . . . . 117 6-5 Migration tool workspace scope settings . . . . . . . . . . . . . . . . . . . . . . . . 118 6-6 Migration Tool rule settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 6-7 Software Analyzer View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 6-8 Java Code Review tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 6-9 WebLogic specific packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6-10 Trade web application package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 6-11 Setting Java Build Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 6-12 Problems View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 6-13 Quick Fix Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 6-14 Project Clean dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 6-15 Migration tool analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 6-16 XML File Review tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 6-17 Quick Fix Preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 6-18 EJB JNDI Quick Fix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
xi
6-19 WebSphere Binding file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 6-20 WebLogic deployment descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 6-21 Specify DB type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 6-22 XML File Review tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 6-23 WebLogic Query Language construct. . . . . . . . . . . . . . . . . . . . . . . . . . 136 6-24 Convert CMP Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 6-25 CMP napping file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 6-26 Database Schema files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 6-27 Show unmapped objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 6-28 WebLogic Query Language error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 6-29 WebLogic EJB deployment descriptors . . . . . . . . . . . . . . . . . . . . . . . . 141 6-30 WebLogic web deployment descriptor . . . . . . . . . . . . . . . . . . . . . . . . . 142 6-31 J2EE Migration Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 6-32 J2EE version selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 6-33 Migration Completion dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 6-34 Creating Service Integration Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 6-35 Service Integration Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 6-36 WebSphere scope selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 6-37 MDB Activation Spec Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 6-38 Add and Remove Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 6-39 Trade Application welcome page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 6-40 Trade Application Configuration options . . . . . . . . . . . . . . . . . . . . . . . . 164 6-41 Import EAR file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 6-42 Importing xPetstore Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 6-43 Database mapping generated with Top-down option . . . . . . . . . . . . . . 180 6-44 Migration toolkit JSP Code Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 6-45 Refactoring JSP file fragments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 6-46 XML File Review tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 6-47 WebLogic specific Query Language tag . . . . . . . . . . . . . . . . . . . . . . . . 184 6-48 EJB Deployment Descriptor Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 6-49 Resource reference page in the EJB Deployment Descriptor editor. . . 195 7-1 Importing an EAR file using import wizard . . . . . . . . . . . . . . . . . . . . . . . 206 7-2 Initial project structure created by the Import wizard. . . . . . . . . . . . . . . . 207 7-3 Before and after we replace class files with respective source files in EJB module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 7-4 Importing source files for EJB module . . . . . . . . . . . . . . . . . . . . . . . . . . 209 7-5 Before and after we replace class file with respective source file in web module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 7-6 Adding a dependency to the web module . . . . . . . . . . . . . . . . . . . . . . . . 211 7-7 Application module after importing additional dependencies . . . . . . . . . 214 7-8 EJB module dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 7-9 Persistence XML Editor warning message . . . . . . . . . . . . . . . . . . . . . . . 216 7-10 Configuring class loading for third party persistence providers. . . . . . . 219
xii
7-11 Software Analyzer configuration with JBoss migration rule set. . . . . . . 220 7-12 Migration Tool XML file review on JSFEJB3 . . . . . . . . . . . . . . . . . . . . . 221 7-13 Migration Tool XML file review on JSFEJB3 . . . . . . . . . . . . . . . . . . . . . 221 7-14 Target specification level selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 7-15 Specifications level migration summary . . . . . . . . . . . . . . . . . . . . . . . . 224 7-16 Before and after Specification Migration Wizard run . . . . . . . . . . . . . . . 224 7-17 Creating test database using DB2 Command Editor . . . . . . . . . . . . . . 229 7-18 EAR import wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 7-19 Importing myproject.ear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 7-20 Selecting EAR Modules during import . . . . . . . . . . . . . . . . . . . . . . . . . 237 7-21 EJB module structure before and after source code import . . . . . . . . . 238 7-22 Importing source files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 7-23 Before and after libraries in EAR moved to shared library . . . . . . . . . . 240 7-24 Shared library properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 7-25 EJB module class path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 7-26 Web module dependencies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 7-27 JDBC provider settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 7-28 Selecting provider for data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 7-29 Data Source details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 7-30 Resource properties for data source . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 7-31 Data Sources panel of WebSphere Application Server deployment . . . 252 7-32 Creating brkrgdb database for sample application . . . . . . . . . . . . . . . . 258 7-33 brokerage_WEB module before and after source code import . . . . . . . 259 7-34 Importing source code files to brokerage_WEB module . . . . . . . . . . . . 260 7-35 Adding dependency to HAR resources . . . . . . . . . . . . . . . . . . . . . . . . . 262 7-36 JDBC provider settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 7-37 Data Source details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 7-38 Data Sources panel of WebSphere Application Server Deployment . . 268 7-39 Resource references for brokerage_WEB . . . . . . . . . . . . . . . . . . . . . . 269 7-40 Creating a new utility module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 7-41 Importing source files to utility project . . . . . . . . . . . . . . . . . . . . . . . . . . 271 7-42 Utility module contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 7-43 Module dependencies of web module. . . . . . . . . . . . . . . . . . . . . . . . . . 272 8-1 MvnForum deployed and started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 8-2 Files selection from source_home. Do not select the forum folder. . . . . 296 8-3 Easy JSP Forum deployed and started. . . . . . . . . . . . . . . . . . . . . . . . . . 299 9-1 Java Pet Store migration steps overview . . . . . . . . . . . . . . . . . . . . . . . . 304 9-2 Creating petstore database in DB2. . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 9-3 Creating tables and populating petstore database. . . . . . . . . . . . . . . . 308 9-4 Select the workspace folder according to your environment. . . . . . . . . . 309 9-5 Resetting the RAD perspective to a Java EE Project look and feel . . . . 310 9-6 Creating a dynamic web project #2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 9-7 Creating a dynamic web project #2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Figures
xiii
9-8 Package name problem when importing to RAD. . . . . . . . . . . . . . . . . . . 313 9-9 Create a Resource Reference for a JDNI name . . . . . . . . . . . . . . . . . . . 315 9-10 Sample web services application development and migration steps . . 319 9-11 Select the workspace folder according to your environment. . . . . . . . . 320 9-12 Resetting the RAD perspective to a Java EE Project look and feel . . . 321 9-13 Typical infrastructure for web services applications . . . . . . . . . . . . . . . 323 A-1 Typical Java EE MVC implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 332 A-2 Rational Unified Process overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
xiv
Tables
2-1 Java and vendor deployment descriptors and configuration files . . . . . . . 14 3-1 Supported operating systems for WebSphere Application Server V7.0 . . 40 3-2 List of databases that are supported by WebSphere App. Server V7. . . . 42 3-3 Dependency Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3-4 Web services development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3-5 Specification level support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 6-1 Data source values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 6-2 Database Connection Properties Values . . . . . . . . . . . . . . . . . . . . . . . . 109 6-3 JMS Server values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 6-4 JMS Queue values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 6-5 JMS Topic values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 6-6 JMS Topic values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 6-7 Queue connection factory values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 6-8 Topic connection factory values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 6-9 JMS queue connection factory configuration . . . . . . . . . . . . . . . . . . . . . 151 6-10 JMS topic connection factory configuration. . . . . . . . . . . . . . . . . . . . . . 151 6-11 JMS queue configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 6-12 JMS queue configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 6-13 JMS Topic configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 6-14 JMS activation specification configuration . . . . . . . . . . . . . . . . . . . . . . 154 6-15 JMS activation specification configuration . . . . . . . . . . . . . . . . . . . . . . 154 6-16 OrderProcessor MDBs WebSphere binding configuration . . . . . . . . . . 155 6-17 Mailer MDBs WebSphere binding configuration. . . . . . . . . . . . . . . . . . 156 6-18 JDBC provider configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 6-19 JDBC data source configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 6-20 J2C Authentication Alias Configuration. . . . . . . . . . . . . . . . . . . . . . . . . 158 6-21 WebSphere bindings for the Account EJB . . . . . . . . . . . . . . . . . . . . . . 159 6-22 Trade EJB JNDI Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 6-23 EJB reference names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 6-24 Default data source configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 6-25 Trade web application reference JNDI names . . . . . . . . . . . . . . . . . . . 161 6-26 JDBC Data Source configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 6-27 Database Connection Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 6-28 JMS Server configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 6-29 Order MDBs JMS queue configuration. . . . . . . . . . . . . . . . . . . . . . . . . 170 6-30 Mail MDBs JMS queue configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 171 6-31 JMS connection factory configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 171 6-32 JavaMail session configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
xv
6-33 Database configuration for wizard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 6-34 JavaMail session configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 6-35 JDBC provider configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 6-36 JDBC data source configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 6-37 J2C Alias Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 6-38 JMS queue connection factory configuration . . . . . . . . . . . . . . . . . . . . 190 6-39 Mail queue configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 6-40 Order queue configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 6-41 Order MDBs JMS activation specification configuration. . . . . . . . . . . . 191 6-42 Mailer MDBs JMS activation specification configuration . . . . . . . . . . . 192 6-43 OrderProcessor MDBs WebSphere binding configuration . . . . . . . . . . 193 6-44 Mailer MDBs WebSphere binding configuration. . . . . . . . . . . . . . . . . . 194 6-45 WebSphere bindings for the Account EJB . . . . . . . . . . . . . . . . . . . . . . 194 6-46 Default data source configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 6-47 Petstore EJBs WebSphere bindings . . . . . . . . . . . . . . . . . . . . . . . . . . 196 6-48 Order EJBs WebSphere bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 6-49 OrderProcessor EJBs WebSphere bindings . . . . . . . . . . . . . . . . . . . . 196 6-50 OrderProcessor EJBs WebSphere bindings . . . . . . . . . . . . . . . . . . . . 196 6-51 Mailer EJBs WebSphere bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 7-1 WebSphere Application Server V7 default binding patterns . . . . . . . . . . 212 7-2 Additional runtime libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 7-3 .Shared dependencies to be copied . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 7-4 Required libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 8-1 JDBC provider values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 8-2 Data Source values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 8-3 Database specific properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 8-4 J2C alias configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 8-5 Installation values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 8-6 JDBC provider values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 8-7 Data Source values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 8-8 Database specific properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 8-9 J2C alias configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 8-10 Installation values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
xvi
Examples
2-1 2-2 2-3 6-1 6-2 6-3 6-4 7-1 7-2 7-3 7-4 7-5 7-6 7-7 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 8-9 9-1 9-2 9-3 9-4 9-5 9-6 9-7 9-8 9-9 Web.xml excerpt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 WebSphere Application Server V7 deployment descriptor excerpt . . . . . 14 Thin client looking up an EJB deployed on a single server . . . . . . . . . . . . 20 Excerpt from the startWebLogic.cmd configuration file . . . . . . . . . . . . . . 108 xPetstore database configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Database error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Updated INSERT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Libraries to be copied . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Replacement grammar information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Code snippet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Seam setup command interactive output . . . . . . . . . . . . . . . . . . . . . . . . 230 Code snippet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Changes to the file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Database creation commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 Changing mvncore.xml file code snippet . . . . . . . . . . . . . . . . . . . . . . . . 281 Define data source in mvncore.xml. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Define paths and trusted domains in mvncore.xml . . . . . . . . . . . . . . . . . 284 Creating the database and the tables . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Populate the table Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Adding the required packages to access the data source . . . . . . . . . . . 296 Changing the connection parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Remove the square brackets in the following SQL syntaxes . . . . . . . . . 297 GlassFish installation commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 GlassFish initialization commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Unpack commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Folder structure for source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Original index.jsp raises an Unsupported Operation exception due to read-only result list from JPA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 Modified index.jsp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 Original CatalogXmlAction.java (line 70). . . . . . . . . . . . . . . . . . . . . . . . . 317 New CatalogXmlAction.java (line 70) . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Output messages after running the Client Consumer application for Calculator Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
xvii
xviii
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.
xix
Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. These and other IBM trademarked terms are marked on their first occurrence in this information with the appropriate symbol ( or ), indicating US registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at http://www.ibm.com/legal/copytrade.shtml The following terms are trademarks of the International Business Machines Corporation in the United States, other countries, or both: AIX 5L AIX CICS ClearCase CloudBurst DataPower DB2 Connect DB2 Universal Database DB2 developerWorks Domino FileNet IBM ILOG IMS Informix iSeries Lotus Parallel Sysplex Passport Advantage POWER Rational Rose Rational Redbooks Redpaper Redbooks (logo) SoDA System i System z Tivoli WebSphere z/OS zSeries
The following terms are trademarks of other companies: ITIL is a registered trademark, and a registered community trademark of the Office of Government Commerce, and is registered in the U.S. Patent and Trademark Office. AMD, AMD Opteron, the AMD Arrow logo, and combinations thereof, are trademarks of Advanced Micro Devices, Inc. FileNet, and the FileNet logo are registered trademarks of FileNet Corporation in the United States, other countries or both. Novell, SUSE, the Novell logo, and the N logo are registered trademarks of Novell, Inc. in the United States and other countries. Oracle, JD Edwards, PeopleSoft, Siebel, and TopLink are registered trademarks of Oracle Corporation and/or its affiliates. SAP, and SAP logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries. Java, and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. Microsoft, Windows, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Intel, Itanium, Pentium, Intel logo, Intel Inside logo, and Intel Centrino logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. 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.
xx
Preface
This IBM Redbooks publication helps you plan and execute the migration of J2EE applications developed for Oracle WebLogic Server, JBoss, GlassFish, and Apache Tomcat, so that they run on WebSphere Application Server V7. This book provides detailed information to plan migrations, suggested approaches for developing portable applications, and migration working examples for each of the platforms from which we migrated. It is not our intention to provide a feature-by-feature comparison of these application servers versus WebSphere Application Server V7, or to argue the relative merits of the products, but to produce practical technical advice for developers who have to migrate applications from these vendors to WebSphere Application Server V7. The book is intended as a migration guide for IT specialists who are working on migrating applications written for other application servers to WebSphere Application Server V7.
xxi
Vasfi Gucer is a project leader at the ITSO Austin/TX. He has more than 15 years of experience in Systems Development and Enterprise Systems Management. He writes extensively and teaches IBM classes worldwide on Tivoli software. Vasfi is also an IBM Certified Senior IT Specialist, PMP, and ITIL Expert. Kurtcebe Eroglu is an Advisory IT Specialist working for IBM Software Services for WebSphere (ISSW) in Turkey. He has nine years of experience in IT, focused on software quality assurance, OO design and development, JEE and EAI. Prior to IT, he designed and erected waste water treatment and industrial water demineralization plants. He has BSc degree in Environmental Engineering and MSc degrees in Engineering Management and Computer Engineering from Middle East Technical University. Hamdy Eed is a Certified IT Specialist and a member of the Americas ITS Certification Board. He is a Senior WebSphere consultant with more than 12 years of experience consulting on WebSphere-based products, industry standards, and Application and Integration Middleware. Hamdy is also an expert in Business Process Management, WebSphere Performance tuning and WebSphere competitive J2EE migrations. He is currently a Senior Consultant for IBM Software Services for WebSphere organization. Hamdy holds a degree in Computer Science from Richards Stockton College of New Jersey. Fabio Xavier Albertoni is a Senior IT Specialist working in Integrated Technology Delivery SSO, in Hortolandia, Brazil. He has 12 years of experience in the IT and banking industries. He has spent the last eight years developing and implementing integrated solutions using WebSphere Application Server and MQ-Series. He holds a degree in Data Processing from FATEC University of Ourinhos and a Masters degree in Computer Engineering from Instituto de Pesquisas Tecnologicas of Sao Paulo, Brazil. Thanks to the following people for their contributions to this project: Erica Wazewski International Technical Support Organization, Poughkeepsie Center Andrew Hoyt, Ed McCabe, Tom McManus, Donald Vines IBM USA Serdar Gere IBM Turkey Andrea Bauer IBM Canada
xxii
Thanks to the authors of the previous editions of this book. Authors of the Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6, SG24-6690: Hernan Cunico, Leonardo Fernandez, Christian Hellsten and Roman Kharkovski
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 publications in one of the following ways: Use the online Contact us review Redbooks form found at: ibm.com/redbooks Send your comments in an email 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
xxiii
xxiv
Chapter 1.
Introduction
This IBM Redbooks publication is the latest in a series on migrating Java Enterprise Edition (EE) applications from application servers to IBM WebSphere Application Server. The books in the series are as follows: Migrating WebLogic Applications to WebSphere Advanced Edition, SG24-5956, focuses on migration applications from WebLogic V5.1 to WebSphere 3.5. Migrating WebLogic Applications to WebSphere Advanced Edition V4, SG24-6179, discusses WebLogic V6.1 and WebSphere V4.0. IBM Redpaper Migrating WebLogic Applications to WebSphere V5, REDP-0448, covers migrating applications from WebLogic V7 to WebSphere V5.0. Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6, SG24-6690, focuses on migrating applications from these platforms to WebSphere V6. This book covers migration from Oracle WebLogic 9.2, JBoss 4.x and 5, Apache Tomcat 6.0.26, and GlassFish 2.1 to WebSphere Application Server V7. This chapter summarizes the contents of this book. It also describes the process used to identify migration issues and write this document.
1.1 Objectives
Migration of Java EE applications from one application server to another is an activity that can vary from extremely simple to extremely complex. This book does not offer all possible solutions or cover every issue that can arise in a migration, but it is a good place to begin. This book provides information to build a project plan containing the most common migration-related activities and information about migrating from other application servers to WebSphere Application Server V7. The examples for WebLogic and JBoss use the Migration Toolkit for Rational Application Developer V7 to minimize migration efforts. This book has the goal of being a practical guide for Java EE professionals. We identify specific migration issues and make specific considerations regarding the following issues: Migration process Migration common issues Migration tools
This book contains key information about WebSphere Application Server V7, information about building a project plan, common migration issues discovered, and consolidated and specific chapters demonstrating migration from each application server in scope. Migrations have been done with various approaches. Certain migrations used Rational Application Developer V7.5. Other migrations preserved the original development and build environment of the source application. The following elements were documented in these processes: Step-by-step migration process Specific use of tools Migration issues we identified along the way As a last step, migration issues we encountered were also analyzed, categorized, and expanded upon.
Chapter 1. Introduction
Chapter 1. Introduction
Chapter 2.
Classloaders
Another area of interest is classloader implementations. Each vendor has its own way to implement the classloader. WebSphere Application Server V7 is 100% compliant with Java EE specifications and has additional features that allow for the coexistence of applications using various versions of the same library, for instance. Another known problem is that vendors, as we all do, make usage of open source libraries (such as apache commons, log4j, axis and so on). JBoss, for example, has an implementation of classloader that does not differentiate classes from applications and the server itself. So, for instance, an application that uses log4j does not need to deploy log4j library. The best solution in that case is to use the exact same version of log4j that it is shipped with JBoss to avoid problems. You might face problems, such as ClassNotFound, when deploying JBoss-migrated applications. In these cases, you have couple of options. In Chapter 7, Migrating from JBoss on page 199 we provide solutions to overcome this problem. For more about WebSphere Application Server V7 classloaders, see IBM Redbooks publication Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6, SG24-6690.
Each classloader is a child of the parent classloader, as illustrated in Figure 2-1. By default, when a resource needs to be loaded, all classloaders ask the parent classloader to locate it. If it cannot be found, the resource is loaded by the child classloader. If none of the classloaders can find the resource, you receive a ClassNotFoundException.
System classloaders
Application classloader
Application classloader
Application classloader
The application classloader can be configured to use the following modes. Single When in single mode, the application classloader 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. There are limitations when using this mode, such as for JSF applications. See the following web page for more information: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topi c=/com.ibm.websphere.nd.doc/info/ae/ae/cweb_javaserver_faces.html
10
Multiple When in multiple mode, an application classloader is created for each module in the EAR application. This means that the various modules are isolated from each other. Tip: During the authors migration experiences, they encountered clients who require enterprise applications to communicate across various WebSphere cells. In this case a CORBA style and an explicit JNDI name are specified. The following article presents more information about the topic: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topi c=/com.ibm.websphere.zseries.doc/info/zseries/ae/cejb_bindingsejbfp. html
Classloader modes
WebSphere Application Server V7 supports two classloader modes. Parent first This is the default mode for all classloaders. It is the Java EE and Java standard. The loading of the resources is first delegated to the parent classloader. If the parent classloader is unable to find the resource, the child classloader tries to handle it. Parent last Using the parent last class loading policy makes the classloader work opposite of the parent first mode. The resource is loaded from the application or web module classloader first. If the resource is not found, the loading is delegated to the parent classloader.
Shared libraries
WebSphere Application Server V7 allows you to configure dependencies that are shared by either all applications in the server or just one specific application classloader. Shared libraries are configured using the administration console and can be specified at the application or server level.
11
Bundled libraries
WebSphere Application Server V7 contains 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 various class loading policies, such as parent last instead of parent first. The following list details the common libraries that might create problems: WebSphere Application Server V7 includes the Jakarta Commons Logging (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 JDom is also bundled with WebSphere Application Server V7.
12
Migration of Java EE application using previous specifications such as J2EE 1.4 come with one of the biggest problems associated to deployment descriptors when migrating to WebSphere Application Server V7. The problem and solutions to the problem are summarized as follows: Container-Managed Persistence (CMP) to database schema mapping WebSphere Application Server V7 uses another way of mapping CMPs to the database schema, compared to the other application servers covered in this IBM Redbooks publication. The better way of creating these mappings is by using Rational Application Developer V7. You can use the EJB to Relational Database Synchronization (RDB) mapping in Rational Application Developer V7 to create your back-end and map your entity beans to the corresponding database table. This wizard also creates the necessary JDBC code used for accessing the database at run time. The Java EE standard deployment descriptors are mapped to the WebSphere Application Server V7-specific deployment descriptors with IDs, as illustrated in Example 2-1 on page 14 and Example 2-2 on page 14. This means that the ID in the WebSphere Application Server V7-specific deployment descriptor must match the one in the Java EE standard deployment descriptor. WebSphere Application Server V7 validates the deployment descriptors more strictly than, for example, JBoss and Oracle Weblogic. This leads to the following problems when migrating: Deployment descriptors fail validation because the elements are not in the proper order or the DTD is incorrect. JSPs do not compile. Use web.xml to map JNDI references that were placed on vendor-specific deployment descriptors. If you are migrating to Java EE 5 you are likely making use of annotations that simplify references using embedded dependency injection implemented by WebSphere Application Server V7 such as @EJB. Switch JNDI reference mapping since WebSphere Application Server V7 JNDI standards is different than in other vendors. It is usually different in all other vendors, so it is actually a migration issue for almost every application server to another. Next, we show an example of how the standard J2EE web.xml deployment descriptor and WebSphere Application Server V7 are mapped with IDs. In the example, a resource reference, having the ID ResourceRef_2, is mapped to a JNDI name pointing to a resource that is managed by WebSphere Application Server V7. See Example 2-1 on page 14 and Example 2-2 on page 14.
13
... <resRefBindings xmi:id="ResourceRefBinding_1117409057536" jndiName="jms/QueueConnectionFactory"> <bindingResourceRef href="WEB-INF/web.xml#ResourceRef_2"/> </resRefBindings> ... Table 2-1 lists the Java EE standard and vendor-specific deployment descriptors.
Table 2-1 Java and vendor deployment descriptors and configuration files Description Java EE specification application.xml WebSphere Application Server V7 ibm-application-b nd.xmi ibm-application-e xt.xmi ibm-web-bnd.xmi ibm-web-ext.xmi ibm-ejb-jar-bnd.x mi ibm-ejb-jar-ext. xmi ibm-ejb-access-b ean.xml ibm-applicationclient-bnd.xmi ibm-applicationclient-ext.xmi Oracle WebLogic weblogicapplication.xml JBoss Apache Tomcat N/A
EAR application
jboss-app.xml
web.xml ejb-jar.xml
N/A N/A
applicationclient.xml
clientapplication. runtime.xml
jboss-client. xml
N/A
14
Description
JBoss
Apache Tomcat Mainly located in the <tomcat_ home>\conf directory and <web_app>\ META-INF/ context.xml
Server configuration
15
WAR
META-INF/MANIFEST.MF Manifest-Version: 1.0 Class-Path: log4j.jar utility.jar ejb.jar
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 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, the client must have access to all EJB classes. If using Remote interfaces, you can optionally create a JAR containing only the client view of the EJBs. Rational Application Developer V7.5 usually creates a separate project with EJB interfaces.
16
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 are placed in the application root. utility.jar This is a utility library that contains common application code. Code that is used by more than one module is located in this file.
Migration problems
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. During the migration of the sample applications, we found the following packaging-related problems. EJB module references classes in the WAR module The application worked on JBoss because of the JBoss Unified Classloader flat hierarchy. It stops working when deployed to WebSphere Application Server V7, because the EJB cannot view what the WAR module contains. Tip: The EJB module should not depend on classes in the web module. This creates a dependency that does not work on platforms other than JBoss. Extract these classes from the web application module and put them in a utility JAR. Use the META-INF/MANIFEST.MF file to declare the dependency. EJB module references libraries located in the WAR module In one application, EJBs imported classes from both Apache Axis and Apache Struts. The required JAR files were located in the web modules WEB-INF/lib folder and only visible to that module. Tip: Dependencies on libraries that are shared between Java EE modules in an application are in the root of the EAR file. The modules that have the dependencies should declare the dependency by using the META-INF/MANIFEST.MF file. You can place common JARs in a shared library in WebSphere and set the scope to Application. All modules in the EAR file are able to use such libraries. Shared libraries can also be set at the server scope.
17
18
19
Thin clients
Thin application clients provide a more lightweight alternative to Java EE application clients. The thin clients access WebSphere through RMI-IIOP and do not have access to all the services provided by WebSphere. 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 2-3.
Example 2-3 Thin client looking up an EJB deployed on a single server
... context = new InitialContext(env); remote = (CustomerServiceRemote)context.lookup("com.ibm.itso.CustomerServiceRemo te"); ... To run thin clients, you need to install the Java EE and Java thin application client, which is part of the WebSphere Application Server V7 installation package and can be installed separately.
20
Refer to the WebSphere Application Server V7 Information Center for more information about how to run and develop thin clients: http://publib.boulder.ibm.com/infocenter/radhelp/v7r5/index.jsp?topic=/ com.ibm.ws.ast.st.common.ui.doc/topics/tjavathin.html
21
2.3.3 Servlets
Servlets are as old as Java EE implementations, which is why no issues were raised during our migration. We are going to a new Java EE implementation with such great improvements in code maintainability, that developers might not want to lose the change of use annotations that simplify their lives. Use of new annotations (such as @servlet) helps avoid problems for teams that have been facing issues in updating deployment descriptors For those who do not like XDoclet overhead, this is a good opportunity to get rid of it.
22
23
vice-versa, which is a totally separate environment and requires changes in the application, resolution of education issues, and changes in scripts used to automate support activities. It is the same situation when migrating other components (such as databases or messaging products). New drivers to be used, new features to discover, deprecated functions to change in both application code and resource configurations, and other features might fill gaps not covered on the previous environment. You need to take into account all these factors when migrating from one application server to another.
JMS resources
A common issue in migrating JMS resources is that the way each application server configure JMS resources vary from vendor to vendor. In WebSphere Application Server V7, before you can define or create JMS resources (such as queues, topics and connection factories) you need first to define a service integration bus. A service integration bus in WebSphere Application Server V7 is the back end that is used by the default messaging provider. More info about messaging, including tutorials and samples can be found at the Information Center: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/ com.ibm.websphere.express.doc/info/exp/ae/welc6tech_msg.html Also, see WebSphere Application Server V7 Messaging Administration Guide, SG24-7770.
24
JDBC resources
Reconfiguring the JDBC resources is probably the most common migration step for any migration. Generally, migrating from application servers might also come with migration of database products or versions, requiring JDBC drivers updates, so be sure to use the appropriate JDBC driver to avoid problems with new implementations for new databases. When keeping the database make sure you are using the correct driver as well. In WebSphere Application Server V7 there are three configurations to be performed to set up a data source: JDBC driver, usually ready to go for most of the most used databases J2C Authentication data, where it is configured the user and password to be used to connect in the database data source itself For more about configuring JDBC resources, see the following web page: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.web sphere.express.doc/info/exp/ae/welc6tech_dat.html
Security resources
There are several areas to configure security resources for your migrated applications and the administrative functions and roles, such as authentication mechanisms, authorization mechanisms, security for web services, and so on. Because this is a sensitive area of migration that probably involves security standards to be applied (such as ITCS 104 (Information Technology Security Standards, internal IBM security standards), we prefer to send the reader to the appropriate reference materials available. A few basic configurations are shown in the product-specific migration chapters of this book. To learn more about security configurations and resources on WebSphere Application Server V7, see the following web page: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/ com.ibm.websphere.express.doc/info/exp/ae/welc6topsecuring.html Also refer to WebSphere Application Server V7.0 Security Guide, SG24-7660.
25
Here are a few tips for you to try to avoid migration issues: Verify your startup scripts and check for JVM arguments On UNIX machines, check the profile of the process ID for any related environmental configuration Open vendor specific configuration files (such as server.xml in JBoss and config.xml in Weblogic) to check for additional configurations Understand how the old application server implements class path Ensure that you know what JARs are extending your old application server libraries You can find more about configuring process definitions in WebSphere Application Server V7 Administration and Configuration Guide, SG24-7615.
26
Chapter 3.
WebSphere overview
It is common to refer IBM WebSphere as WebSphere Application Server, but in fact, IBM WebSphere is a bundle of software for on demand business and service-oriented architecture (SOA) for enterprises. Providing comprehensive leadership, the IBM WebSphere platform is evolving to meet the demands of companies faced with challenging business requirements, including the following tasks: Increasing operational efficiencies Strengthening client loyalty Integrating disparate platforms and systems Responding with speed to any market opportunity or external threat Adapting existing business to change quickly The IBM WebSphere platform is designed to enable you to build business-critical enterprise applications and solutions and combining them with innovative new functions. WebSphere includes and supports a wide range of products that help you develop and serve your business applications. They are designed to make it easier for clients to build, deploy, and manage enterprise applications, dynamic web sites, and other more complex solutions productively and effectively. In this chapter, you get an overview of the WebSphere Application Server V7 and learn the packaging distribution options. We take a quick look at the new features and the main differences from earlier versions. Finally, you find information about others WebSphere products used in this IBM Redbooks publication, to perform the migrations.
27
This chapter has the following sections: IBM WebSphere Platform on page 28 WebSphere Application Server V7 on page 30 Development and deployment tools on page 63
28
29
3.1.5 Optimization
The optimization technologies in WebSphere combine applied mathematics and computer science to help businesses make smarter decisions. IBM ILOG ODM Enterprise IBM ILOG OPL-CPLEX Development Bundles IBM ILOG Core Products & Technologies
3.1.6 Portals
Deliver a point of personalized interaction with applications, content, processes and people. WebSphere Portal Server Where to look for more information: To learn more about WebSphere products, see the following web page: http://www-01.ibm.com/software/websphere/
3.2.1 Overview
WebSphere Application Server is the IBM runtime environment for Java-based applications. This section gives an overview of the options and functionalities that WebSphere Application Server V7.0 offers: Application server purpose Evolving Java application development standards Enhanced management Broader integration Advanced tooling and extensions
30
The application server acts as middleware between back-end systems and clients. It provides a programming model, an infrastructure framework, and a set of standards for a consistent designed link between them. WebSphere Application Server provides the environment to run your solutions and to integrate them with every platform and system as business application services conforming to the SOA reference architecture.
31
WebSphere Application Server is a key SOA building block. From a SOA perspective, with WebSphere Application Server you can perform the following functions: Build and deploy reusable application services quickly and easily Run services in a secure, scalable, highly available environment Connect software assets and extend their reach Manage applications effortlessly Grow as your needs evolve, reusing core skills and assets Figure 3-2 shows the SOA reference architecture and WebSphere Application Server's role in this architecture.
WebSphere Application Server is available on a wide range of platforms and in multiple packages to meet specific business needs. By providing the application server that is required to run specific applications, it also serves as the base for other WebSphere products, such as IBM WebSphere Enterprise Service Bus, WebSphere Process Server, WebSphere Portal, and many other IBM software products. As business needs evolve, new technology standards become available. The reverse is also true. Since 1998, WebSphere has grown and adapted itself to new technologies and to new standards to provide an innovative and cutting-edge environment that allows you to design fully-integrated solutions and to run your business applications.
32
3.2.2 Packaging
Because e-business application scenarios require various levels of application server capabilities, WebSphere Application Server is available in multiple packaging options. Although they share a common foundation, each option provides unique benefits to meet the needs of applications and the infrastructure that supports them. At least one WebSphere Application Server product fulfills the requirements of any particular project and its supporting infrastructure. As your business grows, the WebSphere Application Server family provides a migration path to more complex configurations. The following packages are available: WebSphere Application Server - Express V7.0 WebSphere Application Server V7.0 WebSphere Application Server for Developers V7.0 WebSphere Application Server Network Deployment V7.0 WebSphere Application Server for z/OS V7.0 Figure 3-3 summarizes the main components included in each WebSphere Application Server package.
33
Where to look for more information: For more information about WebSphere Application Server packaging, see WebSphere Application Server V7: Concepts, Planning and Design, SG24-7708.
34
35
WebSphere Application Server for z/OS V7.0 enhances the product in a variety of ways: Defines Service Level Agreements (SLA) on a transaction base (response time per transaction). Protects your production with Workload Management, in times of unpretendable peaks. Uses z/OS functionality for billing based on used resources or transactions. Uses one central security repository, including Java role-based security. Builds a cluster inside of a single application server (multi-servant). Profits from near linear hardware and software scalability. Profits from System z cluster (Parallel Sysplex) and up to 99.999% availability. For more information about WebSphere Application Server for z/OS V7.0, see WebSphere Application Server V7: Concepts, Planning and Design, SG24-7708, or visit the following web page: http://www.ibm.com/software/webservers/appserv/zos_os390/
36
The potential value of Java EE to clients is tremendous. This includes the following benefits: An architecture-driven approach allowing application development helps reduce maintenance costs and allows for construction of an information technology (IT) infrastructure that can grow to accommodate new services. Application development standards, tools and predefined rules improve productivity and accelerates and shortens development cycles. Packaging, deployment, and management standards for your enterprise applications facilitate systems and operations management Industry standard technologies enable clients to choose among platforms, development tools, and middleware to power their applications. Platform independence gives flexibility to create an application one time and to run it on multiple platforms. This provides true portability to enterprise applications. Embedded support for Internet and web technologies allows for applications that can bring services and content to a wider range of customers, suppliers, and others, without creating the need for proprietary integration. Java EE 5, the latest release of the Java EE platform, represents a significant evolution in the Java enterprise programming model. It improves the application developer experience and productivity with the following new features: Latest specifications Enterprise JavaBeans (EJB) 3.0 JAX-WS 2.0 JSP 2.1 Servlet 2.5 JSF 1.2 Java Development Kit (JDK) 6.0 Usage of progressive disclosure Annotations and injection support to reduce complexity EJB development as Plain Old Java Objects (POJOs) Java Persistence API (JPA) to allow creation of simpler entities using annotated POJO model Another exciting opportunity for IT is web services. Web services allow for the definition of functions or services within an enterprise that can be accessed using industry standard protocols (such as HTTP and XML) already in use. This allows for easy integration of both intra- and inter-business applications, which can lead to increased productivity, reduced expense, and shortened time to market. Web services are also the key elements of SOA, which provides for the reuse of existing service components and more flexibility to enable businesses to address changing opportunities.
37
38
Hardware
Supported hardware for WebSphere Application Server V7.0: IBM POWER family of processors PA-RISC processor Intel Itanium 2 processor Intel Pentium processor at 500 MHz or faster Intel EM64T or AMD Opteron IBM System z processors IBM System i (iSeries) SPARC workstations
39
Operating systems
Table 3-1 shows supported operating systems and their versions for WebSphere Application Server V7.0.
Table 3-1 Supported operating systems for WebSphere Application Server V7.0 Operating system Microsoft Windows Supported Versions Supported with 32-bit WebSphere Application Server: Microsoft Vista Business Microsoft Vista Enterprise Microsoft Windows Server 2003 with SP2 Microsoft Windows Server 2003 R2 Microsoft Windows Server 2008, Datacenter with SP1 Microsoft Windows Server 2008, Enterprise with SP1 Microsoft Windows Server 2008, Standard with SP1 Microsoft Windows XP Professional with SP2 Supported with 64-bit WebSphere Application Server: Microsoft Windows Server 2003 x64 R2 Microsoft Windows Server 2008 Enterprise x64 with SP1 Microsoft Windows Server 2008 Datacenter x64 with SP1 Microsoft Windows Server 2008 Standard x64 with SP1 Supported with 32-bit and 64-bit WebSphere Application Server: AIX 6.1 with Maintenance Package 6100-00-04 AIX 5L 5.3 with Service Pack 5300-07-01 Supported with 32-bit WebSphere Application Server: Sun Solaris Version 9 with Patch Cluster dated 1/03/08 or later Sun Solaris Version 10 with Patch Cluster dated 1/07/08 or later Supported with 64-bit WebSphere Application Server: Sun Solaris Version 10 with Patch Cluster dated 1/07/08 or later Supported with 64-bit WebSphere Application Server: Sun Solaris Version 10 with Patch Cluster dated 1/07/08 or later Supported with 32-bit WebSphere Application Server: HP-UX 11iv2 with Patch Bundle dated Dec 2007 HP-UX 11iv3 with Patch Bundle dated Sep 2007 Supported with 64-bit WebSphere Application Server: HP-UX 11iv2 with Patch Bundle dated Dec 2007 HP-UX 11iv3 with Patch Bundle dated Sep 2007 Supported with 32-bit WebSphere Application Server: Red Hat Enterprise Linux AS, Version 4 with Update 6 Red Hat Enterprise Linux ES, Version 4 with Update 6 Red Hat Enterprise Linux WS, Version 4 with Update 6 Red Hat Enterprise Linux, Version 5 with Update 1 SUSE Linux Enterprise Server, Version 9 with SP4 SUSE Linux Enterprise Server, Version 10 with Update 1
IBM AIX
HP-UX on Itanium
Linux on x86
40
Supported Versions Supported with 32-bit and 64-bit WebSphere Application Server: Red Hat Enterprise Linux, Version 4 with Update 6 Red Hat Enterprise Linux, Version 5 with Update 1 SUSE Linux Enterprise Server, Version 9 with SP4 SUSE Linux Enterprise Server, Version 10 with Update 1 Supported with 31-bit and 64-bit WebSphere Application Server: Red Hat Enterprise Linux AS, Version 4 with Update 6 Red Hat Enterprise Linux, Version 5 with Update 1 SUSE Linux Enterprise Server, Version 9 with SP4 SUSE Linux Enterprise Server, Version 10 with Update 1 Supported with 31-bit and 64-bit WebSphere Application Server: z/OS V1.7 z/OS V1.8 z/OS V1.9 z/OS.e z/OS.e V1.7 z/OS.e V1.8 IBM i V5R4 IBM i V6R1
IBM z/OS (Supported for WebSphere Application Server V7.0 for z/OS)
IBM i
About support limitations: To see if there is a 32-bit or 64-bit support limitation for your operating system, refer to the WebSphere Application Server system requirements web page: http://www.ibm.com/software/webservers/appserv/doc/latest/prereq.html
Web servers
Supported web servers for WebSphere Application Server V7.0 are as follows: Apache HTTP Server 2.0.58 Apache HTTP Server 2.2 IBM HTTP Server for WebSphere Application Server V6.1 IBM HTTP Server for WebSphere Application Server V7.0 Internet Information Services (IIS) 6.0 Internet Information Services (IIS) 7.0 Lotus Domino Enterprise Server 7.0.2 Lotus Domino Enterprise Server 8.0 Sun Java System Web Server 6.1 SP8 Sun Java System Web Server 7.0 Update 1
41
Important: Not every web server is supported on all platforms and operating systems. To match compatibility and support, see the original documentation for each of these software vendors.
Database servers
Table 3-2 shows the database servers that WebSphere Application Server V7.0 supports.
Table 3-2 List of databases that are supported by WebSphere App. Server V7 Databases IBM DB2 a Supported versions DB2 for iSeries 5.3, 5.4, or 6.1 DB2 for z/OS V8, V9 or V9.1 DB2 Connect DB2 Enterprise Server Edition V8.1, V8.2, V9.0 and V9.5 DB2 Express V8.1, V8.2, V9.0 and V9.5 DB2 Workgroup Server Edition V8.1, V8.2, V9.0 and V9.5 Cloudscape 10.3 (Derby) Oracle 10g Standard/Enterprise Release 1 - 10.1.0.5 Oracle 10g Standard/Enterprise Release 2 - 10.2.0.3 Oracle 11g Standard/Enterprise Release 1 - 11.1.0.6 Sybase Adaptive Server Enterprise 12.5.4 Sybase Adaptive Server Enterprise 15.0.2 Microsoft SQL Server Enterprise 2005 SP2 Dynamic Server 10.00xC6 Dynamic Server 11.10xC1 Dynamic Server 11.5xC1 IMS V9 IMS V10 WebSphere Information Integrator 8.2 FP8 WebSphere Information Integrator 9.1 FP3 WebSphere Information Integrator 9.5 FP2
Cloudscape Oracle
a. For a detailed list of supported fixpack levels and editions for DB2, see the support document #7013265 at the following web page: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27013265
Important: Not every database server is supported on all platforms and operating systems. To match compatibility and support, see the original documentation for each of these software vendors.
42
Directory servers
Supported directory servers for WebSphere Application Server V7.0 are as follows: LDAP Servers using Stand Alone LDAP User Registry Configuration and Federated Repository Configuration: IBM Tivoli Directory Server 6.0 IBM Tivoli Directory Server 6.1 IBM z/OS Integrated Security Services 1.8 IBM z/OS Integrated Security Services 1.9 IBM z/OS.e Security Server 1.8 IBM z/OS.e Security Server 1.9 Lotus Domino Enterprise Server 7.0 Lotus Domino Enterprise Server 8.0 Novell eDirectory 8.7.3 SP9 Novell eDirectory 8.8.1 Sun Java Directory Server 6.0 Sun Java Directory Server 6.1 Windows Active Directory 2003 Windows Active Directory 2008
LDAP Servers using only Federated Repository Configuration: Windows Active Directory Applications Mode 1.0 SP1 OpenLDAP 2.4.7
43
Where to look for more information: For more information about what is new in WebSphere Application Server V7, see the developersWorks article Whats new in WebSphere Application Server V7? available on the following web page: http://www.ibm.com/developerworks/websphere/library/techarticles/080 9_alcott/0809_alcott.html.
Excerpt: The rest of this chapter, from page 44 to page 68 is an excerpt from the developersWorks article Whats new in WebSphere Application Server V7?, mentioned in the previous note.
Standards
WebSphere Application Server V7 now includes new support for the following functions:
Java EE 5
The most notable supported standard in WebSphere Application Server V7 is Java Platform, Enterprise Edition (Java EE) 5. WebSphere Application Server V7 provides complete support for the Java EE 5 specification, including the web services and EJB 3.0 functions that were previously available as feature packs in V6.1. In case you are not familiar with Java EE 5, this latest release of the standard represents a significant evolution in the Java enterprise programming model, resulting in considerable improvements in the application developer experience and, in turn, in application developer productivity. A phrase often used to describe the Java EE 5 programming model is progressive disclosure, meaning that much of the code that has, until now, been required for Java EE development is eliminated. Instead, the most generally used application context is provided as the default behavior. Then, using annotations, you can override the defaults, if required, to achieve the required implementation. In this manner, the application is progressively constructed, and only to the extent necessary. WebSphere Application Server V7 also introduces support for Java Platform, Standard Edition (Java SE) 6.
Dependency injection
Developer productivity is further enhanced when it is time to override the defaults, because this can be accomplished using annotations rather than writing code. Annotations are used in conjunction with a programming pattern known as dependency injection, or Inversion of Control (IoC), in which the application code
44
declares variables and annotates them to indicate whatever is needed, and then the container inserts the specified object or resource references. Table 3-3 shows a simple example to help explain dependency injection. The code segment on the left is from an EJB 2.1 application. The one on the right, from an EJB 3.0 application, has an annotation @EJB that is used to tell the container that this is an EJB. The container then inserts the EJB 3.0 application with the required wrapper (or boilerplate), eliminating the need for you to do so.
Table 3-3 Dependency Injection EJB 2.1 Object obj = Context.Lookup(java:comp/env/ejb/MyCartHome); CartHome theCartHome = (CartHome) PortableRemoteObject.narrow(obj,CartHome.class); ShoppingCart myCart = theCarthome.create() myCart.someShoppingMethod(); EJB 3.0 @EJB ShoppingCart myCart myCart.someshoppingMetthod
Web services
The improvements to the Java EE 5 programming model are not limited to EJB development. Web services development is also greatly simplified through annotations. In Table 3-4, a Java EE 1.4 JAX-RPC application is depicted on the left and the corresponding Java EE 5 JAX-WS application is depicted on the right.
Table 3-4 Web services development JAX-RPC 1.1 code public interface StockQuote extends Remote{ public float getQuote(String sym) throws Remote Expecption; } public class QuoteBean implements { public float getQuote(String sym) {...} } JAX-WS 2.0 code @WebService public interface StockQuote { public float getQuote(String sym); } @WebService public class QuoteBean implements Stockquote { public float getQuote(String sym); }
45
The JAX-WS implementation in WebSphere Application Server V7 also provides support for SOAP 1.2, and for generic XML or HTTP as a protocol binding, which enables the creation of WS clients and WS providers that do not use SOAP for their wire level message format. Another important addition in WebSphere Application Server V7 is its support for Message Transmission Optimization Mechanism (MTOM), an improved method for sending binary attachments. MTOM is the preferred attachment mechanism for non-Java EE-based web services, so support for MTOM improves the interoperability between Java EE web services and non-Java EE web services.
Systems management
Systems management is another major area enhanced in WebSphere Application Server V7, with a number of new management and administration options to help you implement a more flexible, scalable, and asynchronous administrative topology. The following sections provide more detail.
Intelligent provisioning
Intelligent provisioning by the WebSphere Application Server run time selects only the run time function needed for an application, reducing both memory footprint and application server startup time. Each application is examined by WebSphere Application Server at application installation time to generate an activation plan. At run time, the server starts only those components that are required by the activation plan. WebSphere Application Server V7 contains support for a Web/JDBC application scenario in which only the web container and core run time components are started. This is in contrast to V6.1, in which the EJB container, SIP container, and web services run time also has been started, as shown in Figure 3-4 on page 47. This capability is also used in fixed function servers (for example, WebSphere Application Server proxy server) to help reduce the memory footprint, and is designed for extension by other WebSphere products that run on top of WebSphere Application Server.
46
Additional run time footprint reductions are delivered in the form of the Java SE 6 implementation that ships with WebSphere Application Server V7. The shared class cache that was introduced in the IBM Java SE 5 implementation has been improved so that the cache can now be persistent. As a result, the cache can survive a shutdown and restart of all WebSphere processes on a server. In the case of an application developer running a single WebSphere Application Server instance, the contents of the shared class cache can be reloaded on application server startup. When used independently (or in combination with intelligent provisioning) the result is significantly faster application server startup times. Another improvement in the IBM Java SE 6 is the use of compressed references (or pointer compression) in 64-bit WebSphere Application Server JVMs. The use of compressed references can provide a significant reduction in the process footprint of a 64-bit JVM, when compared to a 32-bit JVM. Prior to the IBM Java SE 6 implementation, it was not unusual for a 64-bit heap to be 1.7 to 2 times the size of an equivalent 32-bit heap.
Administrative agent
Flexible management is an improvement that can help reduce the cost of administering large deployments in several ways. The easiest way to illustrate this new feature is by comparing the WebSphere Application Server (base) V6.1 run time model to what is provided by flexible management in V7. In V6.1, the administrative run time is hosted in WebSphere Application Server. This means that the administrative console runs in an application server. When wsadmin
47
scripts are run against an application server, each application server process has administrative overhead as a result. There is also no provision for managing multiple base application servers profiles. Each must be managed independently, as depicted in Figure 3-5.
48
Flexible management changes this picture by separating most of the administrative components from the application server run time. Now, each application server is no longer a single point of management. This is accomplished with a separate administration process for (base) WebSphere Application Servers known as the administrative agent, shown in Figure 3-6.
You might wonder if moving the administration function from the application server to the administrative agent provides more capability. The answer lies in the fact that an administrative agent can manage multiple WebSphere Application Server (base) instances on a single machine, as shown in Figure 3-7 on page 50. When using an administrative agent, as the number of application server instances increases, the duplication of the administration footprint (for each application server) is eliminated. Further, because the administrative agent can manage all the application server instances on a machine, there is only one set of remote administration ports to remember (those for the administrative agent), as opposed to trying to manage all the separate administration ports associated with each application server.
49
When working with the admin agent, remember the following factors: The administrative agent can only manage the application servers that are on the same machine as the administrative agent. Although the administrative agent can manage multiple application servers, each application server is managed individually. In other words, log into the administrative agent to change the configuration of server1, log out, then log on to server2, and so on. The administrative agent only provides management of these application servers (and their applications). It does not provide for clustering and failover. For clustering and failover and centralized application management, you still need WebSphere Application Server Network Deployment.
Job manager
The job manager is another aspect of flexible management that is available in WebSphere Application Server Network Deployment V7. As with the administrative agent, it might be best to describe how the job manager functions by quickly reviewing the run time model for V6.1.
50
In WebSphere Application Server Network Deployment V7, there is a tight coupling: Between application servers and node agents. Between node agents and the deployment manager. This tight coupling can impact the scalability of the administrative run time if the run time components are not located together in close proximity. A possible example might be a branch office deployment, where a deployment manager in a central location is being used to manage nodes dispersed in each remote branch office. Even under the best of conditions (redundant, high capacity, low latency networks between the central location and the branch offices, and so on) this can be problematic because Wide Area Networks (WANs) are rarely as reliable as Local Area Networks (LANs), and both are known to occasionally fail. The job manager in WebSphere Application Server Network Deployment V7 addresses the limitations inherent in the current management architecture by adopting a loose management coupling architecture. Rather than synchronously controlling a number of remote endpoints (node agents), the job manager coordinates management across a group of endpoints by providing an asynchronous job management capability across a number of nodes. The management model relies on the submission of management jobs to these remote endpoints, which can be either a WebSphere Application Server (base) administrative agent or WebSphere Application Server Network Deployment V7 deployment manager. In turn, the administrative agent or the deployment manager is what actually executes the jobs that update the configuration, start or stop applications, or perform a variety of other common administrative tasks. The management model provided by the job manager is shown in Figure 3-8 on page 52. It is important to understand that the job manager is not a replacement for a deployment manager. It is an option for remotely managing a WebSphere Application Server Network Deployment V7 deployment manager or, more likely, multiple deployment managers. Recall the aforementioned example, trying to manage multiple remote nodes from a single deployment manager. With the job manager, each branch can be converted into its own WebSphere Application Server Network Deployment V7 cell with a deployment manager running locally in each branch. The job manager can be used to remotely manage each of these remote cells.
51
Web services
Another important new systems management capability in V7 is in the area of web services. Web service policy sets are mechanisms provided by WebSphere Application Server V7 for centrally defining various quality of service policies to apply to web services that are already deployed. There are two types of policy sets: Application policy sets These policy sets are used for business-related assertions, such as business operations that are defined in the WSDL file. System policy sets These policy sets are used for non-business-related system messages, such as messages that are defined in specifications that apply QoS policies. Examples include security token (RST) messages that are defined in WS-Trust, or the creation of sequence messages that are defined in WS-Reliable Messaging metadata. Rather than defining individual policies and applying them individually to each web service, policy sets can be applied one time to all web service applications to which they are applicable, thus ensuring a uniform quality of service for a given type of web service. Related to this, WebSphere Service Registry and
52
Repository discovers WebSphere Application Server V7 JAX-WS policy sets, discovers existing associations, and represent those as policy attachments. A number of default policy sets are provided: LTPA WSSecurity Default Kerberos V5 HTTPS default SSL WSTransaction Username SecureConversation Username WSSecurity default WS-Addressing default WSHTTPS default WS-I RSP ND WS-ReliableMessaging persistent Additionally, policy sets can be customized or modified as required.
Messaging
Beyond the web services improvements in WebSphere Application Server V7, there are also improvements to a related SOA component: messaging. New administrative wizards for System Integration Bus (SIBus) configuration are provided for configuring a cluster bus member and a foreign bus connection, and new panels for SIBus authorizations, WebSphere MQ JCA Resource Adapter configuration, and for inspecting an application's use of SIBus resources. V7 also includes a WebSphere MQ JMS JCA 1.5 resource adapter, and associated new panels and administrative commands. Having the JCA 1.5 resource adapter also means that message-driven beans that consume messages from WebSphere MQ can now use activation specifications instead of listener ports. Improved management of activation specifications (stop, start, message retry limits [or poison message filtering]) is also included in WebSphere Application Server V7.
Centralized installation
WebSphere Application Server Network Deployment V7 also adds the capability to perform centralized installation from the deployment manager to remote nodes. This enables a single installation to the deployment manager to be pushed out as an installation package from the deployment manager to a series of endpoints. The endpoint can be either a node that is not part of a WebSphere Application Server Network Deployment V7 cell (in which case Network Deployment can be installed) or an existing WebSphere Application Server Network Deployment V7 node that might need a fix pack.
53
Security
Security management improvements are also a significant portion of new features in WebSphere Application Server V7. Perhaps the most prominent change is the ability to create multiple security domains within a single WebSphere Application Server cell. Each security domain can have its own user population (and underlying repository), and, additionally, the application domain can be separated from the administrative domain. Not only can each domain have its own separate user population, but each domain can also be customized with a separate security configuration (for example, JAAS login configuration, TAI, authorization provider, JCA authentication data) in addition to the current application server level security configuration options. The scope of the domain is variable and can range from a cell, cluster, or node to a node group or application server. As a result, applications have a distinct user population and distinct security configuration. Further, the fine grained administrative security function introduced in WebSphere Application Server V6.1 but limited to wsadmin is now expanded in V7 to include the administrative console. Within the administrative security domain for a cell, this enables administrative roles to be restricted to specific components, such as a cluster, node, application server, or application.
54
Kerberos
WebSphere Application Server V7 provides support for Kerberos authentication, which can be used in a variety of single sign-on scenarios. The Kerberos support in V7 expands on the SPNEGO TAI support in V6.1 to provide better interoperability and identity propagation with other applications that support Kerberos authentication (such as IBM DB2, .NET, and others).
IBM WebSphere Application Server Feature Pack for OSGi Applications and Java Persistence API (JPA) 2.0 Open Beta
The feature pack for OSGi Applications and JPA 2.0 provides a lightweight, simplified application framework to increase developer productivity and time to value. Through this feature pack, organizations can realize many of the benefits found in other nonstandard open source frameworks in a standardized, WebSphere integrated fashion.
55
This feature pack delivers open community- and standards-based implementations of the OSGi Blueprint service specification and Java EE 6 JPA 2.0 along with the ability, optionally, to assemble, deploy and manage applications as a collection of versioned OSGi bundles.
56
Provides enterprise class multi-threaded scalability, serviceability with IBM support Offers consistent execution (invocation) and data navigation API, at the same time allowing access to existing Java logic across the XPath 2.0, XSLT 2.0, and XQuery 1.0 Provides 40 samples of the new standards along with four end to end samples that show these standards in typical web applications
IBM WebSphere Application Server Feature Pack for Communications Enabled Applications (CEA)
Efficiently update existing applications with communication capabilities and reduce cost by leveraging existing Java skills. The IBM WebSphere Application Server V7 Feature Pack for CEA delivers an SOA- and Java-based programming model for efficiently creating innovative multimodal communications applications, Capabilities of the WebSphere Application Server V7 Feature Pack for CEA are as follows: Telephony access services REST service and web service access to telephony services so your developers can use existing skills, without requiring communications expertise: Make a call Disconnect a call Receive incoming call notifications
Simple telephony provisioning since CEA services are not in the call flow, but are asynchronously notified of a call by the customer's enterprise Telephony/Unified Communications solution using standard telephony SIP CTI Gateway (CSTA XML over SIP protocol, also known as ECMA TR/87) Multi-modal communications Fully customizable JavaScript-based web 2.0 widgets to improve integration with your application and business process Fully extensible JavaScript-based web 2.0 widgets using Dojo semantics to efficiently build new CEA capabilities for use across your applications and company
57
Web 2.0 widget access to telephony services which can be easily and efficiently inserted into new or existing applications Click to call Allows users to click a button and be connected to another user through telephone Call Notifications Allows the application to poll for incoming calls which can then be programmatically answered to create a call session Web 2.0 widget access to multi-modal communications to efficiently build innovative applications that significantly improve user experiences and reduce user interaction costs Collaboration Dialog A modal window that enables peer-to-peer data sharing through a REST service in a simple and extensible fashion Contact Center Cobrowsing Enables a user and contact center representative to begin a Click to call telephone session. The user can then securely and privately browse a web application as WebSphere Application Server keeps their browser windows synchronized, with the ability to share navigation control, through Follow Me mode, or through individual web address sharing, and to highlight information for the other user to see. Two-way synchronized forms An extension to the Collaboration Dialog web widget that allows two parties to input and visually confirm form data entered by the other party. Individual form fields, such as credit card number or social security number, can be masked to only display a subset of the field data entered to the reviewing party. Peer-to-peer Cobrowsing Enables two users to begin a cobrowsing session through a unique web address. Users can then securely and privately browse a web application as WebSphere Application Server keeps their browser windows synchronized, with the ability to share navigation control, through Follow Me mode, or through individual web address sharing, and to highlight information for the other user to see.
58
Enhanced security and privacy Each user session is with and managed by WebSphere Application Server, not with each other. This provides a higher degree of security between users than a peer-to-peer session. No client-side software installation is required for users, which reduces security-driven barriers to customers taking advantage of innovative user interaction features of your communications-enabled applications. Using enterprise Telephony/Unified Communications network increases data privacy by keeping customer and company data on company infrastructure versus exposing the data to a third-party hosted solution. Telephony interoperability Tested with leading Telephony/Unified Communications solutions as an on-ramp to communications enabled business process (CEBP) solutions: Avaya Aura Communication Manager Cisco Unified Communications Manager Developer productivity Sample reference application to speed developer learning Unit test environment to prototype and test applications without requiring approval to access the corporate Telephony/Unified Communications network Ability to use a third-party IP softphone within the provided unit test environment Developer tooling Separately available in IBM Rational Application Developer V7.5, developers can build, test, and deploy communications enabled applications for WebSphere Application Server V7 with Rational Application Developer V7.5 and later. Function for SIP application developers Support for SIP Servlet 1.1 (JSR 289) Asynchronous Invocation API for accessing remote SIP sessions
IBM WebSphere Application Server V7 Feature Pack for Service Component Architecture
The WebSphere Application Server Feature Pack for Service Component Architecture (SCA) V1.0.1 helps deliver simplified development by providing an open-standards programming model for SOA.
59
In addition, the WebSphere Application Server Feature Pack for SCA V1.0.1 supports WebSphere Application Server's unique focus on investment protection. In any economy businesses need to make decisions that make use of investments from the past to respond to the future. The SCA feature pack helps businesses protect new IT investments and reuse existing assets in SOA applications. Designed by key technology vendors, including IBM, the SCA programming model provided in the SCA feature pack supports the principles of SOA through application flexibility and agility. Service implementation and access method details are moved out of business application logic and into metadata that can be operated on by middleware. As service details or locations change, the application remains unaffected. SCA helps application developers maximize productivity through focus on solving business problems with application code rather than protocols and locations. Highlights of the WebSphere Application Server Feature Pack for SCA are as follows: Improves SOA-based composite application time to market and flexibility Builds composite applications and services using the open SCA 1.0 programming model Uses the reliability and performance of WebSphere Application Server Works to protect application investments with a pluggable framework for the latest SCA supported implementation types and protocols WebSphere Application Server Feature Pack for SCA V1.0.1 capabilities are as follows: Create SCA service compositions in POJOs, EJB 2.1-3 components, Java Servlets, and Ajax / JavaScript Wire a variety of service types - bindings include web services, JMS, SCA and EJB 2-3 Expose business logic to web 2.0 style applications through JSON-RPC and ATOM web feeds Expose EJB 3.0 and Spring components for re-use in homo or heterogeneous compositions Simplified flexible service deployment as a JAR (Java Archive) Support for data as Java Architecture for XML Binding (JAXB) or Service Data Objects (SDO) 2.1 Additional SCA sample applications
60
61
Apache Wink
Apache Wink is an open source software project hosted by the Apache Software Foundation that provides an implementation of JAX-RS. In addition, Apache Wink provides key capabilities to enable common application development needs beyond that which is defined in the JAX-RS standard. Highlights of the IBM distribution of Apache Wink are as follows: JAX-RS 1.0 server run time Stand-alone client API with the option to use Apache HttpClient 4.0 as the underlying client Built-in support for JavaScript Object Notation library (JSON4J) An Atom JAXB model in addition to Apache Abdera support Multipart content support A handler system to integrate user handlers into the processing of requests
Ajax messaging
Traditionally, web applications have relied on a request/response model where user action dictated updates to the browser window. To enable a more interactive user experience, Ajax applications require a different approach. Ajax Messaging enables a publish and subscribe model where the server can stream data updates, messages, and events in real time to the client. Ajax Messaging uses a Comet application pattern without the need for additional client side plug-ins. The package includes server- and client-side Ajax components that communicate through Ajax friendly JSON-based messages.
62
The result is that data updates and events can be delivered dynamically to Internet browsers from an enterprise service bus (ESB) or other message source.
63
features of WebSphere Application Server V7.0 and supports it as an integrated test environment. It does not, however, support any of the previous versions of WebSphere Application Server as integrated test environments. Rational Application Developer for WebSphere Software V7.5 supports all new features of WebSphere Application Server V7.0 and is a fully featured integrated development environment for developing SIP, Portlet, web services, and Java EE applications. It supports previous versions of WebSphere Application Server (V6.0 and V6.1) as an integrated test environment. Figure 3-9 shows the Rational Application Developer packaging.
64
SIP development, including support for JSR 116 SIP servlets XML tools to build and validate XML artifacts, including schemas, DTDs, and XML files WebSphere Enhanced EAR support Profile management tool Support for WebSphere Application Server V7.0 test environments in either a local or remote configuration, but no support for any previous versions of WebSphere Application Server (such as V6.0 or V6.1) Jython script development, including script debugging capabilities Jacl to Jython script conversion tools (jacl2jython) Integration with Concurrent Versions System (CVS), which is a popular Source Code Management (SCM) repository and Rational ClearCase Rational Application Developer Assembly and Deploy V7.5 is a development environment that provides you with the tooling necessary to create, test, and deploy the various artifacts supported by WebSphere Application Server V7.0. It does not include the productivity-enhancing features and visual editors found in Rational Application Developer for WebSphere Software V7.5. It also does not include Rational ClearCase, Crystal Reports, UML modeling, Struts, or JSF support, and it does not support any of the previous releases of WebSphere Application Server (such as V6.0 or V6.1) as test environments. See Table 3-5 for the support level information.
Table 3-5 Specification level support Specification EAR EJB WAR Application client Support levels 1.2, 1.3, 1.4, 5.0 1.1, 2.0, 2.1, 3.0 2.2, 2.3, 2.4, 2.5 1.2, 1.3, 1.4, 5.0
65
66
67
Deployment automation is where applications installation packages are dropped into a hot directory under an application server and the application is installed automatically. Any installation parameters that have not been specified by the installation packages deployment descriptors have default values that are applied by the automated deployment process. Rapid deployment allows for a free-form deployment operation. In this mode, it is possible to drop source code or compiled classes for servlets, EJBs, JSPs, images, and so on into the hot directory without strict J2EE packaging. Rapid deployment then compiles the classes, adds deployment descriptors, and generates an EAR file that is automatically deployed on a running server. An enhanced EAR file enables the enterprise archive package to include information about resources and properties, such as data sources, which is required by an application. When deployed on a server, the resources are automatically created on the server. The WebSphere rapid deployment set of tools can be useful for quickly testing an application. For example, if you know you are going to test several versions of the same application, you can use the automatic deployment feature to have the rapid deployment tools automatically deploy the versions for you. There are limitations and rules you need to follow when working with these utilities, and most of the time you are significantly more productive using a full-blown development environment, such as Rational Application Developer Assembly and Deploy V7.5 or Rational Application Developer for WebSphere Software V7.5 Note: You can use rapid deployment tools for packaging applications at J2EE 1.3 or 1.4 specification levels. The rapid deployment tools do not support Java EE 5 nor J2EE 1.2 specification level.
68
Chapter 4.
69
70
71
Partial
Partial migration consists of migrating multiple or a few applications at a time in a phased approach where the schedule can cover them until the project is completed. It is a good choice when you have teams owning applications in a shared environment or when one team owns multiple applications, which makes it impossible to migrate every application at the same time due to time conflicts. Applications that are well written and modularized can also be used with this type of migration (for example, moving user interface modules before than business components or vice-versa).
Sample
Sample migration is defined by a migration of a single application that is representative of the other applications. A representative application is the one that has architectural and implementation similarities with most of the applications to be migrated within the enterprise. This process can be repeated for additional applications after the first one is complete. This is the most common type of application migration because it lays a foundation for future migrations based on challenges encountered in migrating the sample application. You can also determine how quickly migration can be done and highlight all the problems faced so that you can build a concise plan.
Full
Full migration is obvious but has its representativeness. When you decide to go with this option, it is probably because you have a dedicated environment for an application or you are left with no options but to migrate the entire environment due to reasons such as end of support, impossible interoperability of certain applications in old and new environments, and other possible issues.
72
73
There are cases where we face external factors that contribute to migration complexity and requires attention from all interested parties. These external factors are integrations with existing systems and interoperability between migrated applications that are dependent of other applications functionality or services.
74
Migration questionnaires
Because the assessment is one of the first steps in a migration and we jump into a whole new world sometimes with no previous experience from the actual customer. We need to know which kind of information is required to start the project and determine the roles and responsibilities of interested parties. Stakeholders need to be committed to the project to affect a successful migration. To build this knowledge base we propose that you use what we call migration questionnaires. It is a set of questions to gather necessary information about the migration, business requirements and decisions, hardware and software, topology, architecture, application code, and so forth. During this step, remember to make sure all questions are answered appropriately without generic answers such as yes and no. For more about migration questionnaire sample questions, see Appendix B, Migration questionnaires on page 355. The IBM WebSphere Application Server Migration Toolkit can be used as a tool when gathering information for the questionnaires. There is a reporting feature that brings out currently known issues that can be exported to PDF report file.
75
concepts. These meetings can be done through calls, web conferences, and in-person consultations.
76
77
Passport Advantage
Passport Advantage provides support for production issues and product bugs. The following web page helps you to open PMRs (or a service request) with Passport Advantage. http://www-01.ibm.com/software/support/probsub.html
WebSphere education
WebSphere education helps us to build and enhance our WebSphere skills. It has more than 250 courses across both the WebSphere Software portfolio and SOA. It provides flexible classroom, online, and private courses. The courses are designed by award winning instructors with first-hand product knowledge. The role-based training path in WebSphere education assists us by defining a path to acquiring skills for specific WebSphere product offerings. Check out the following link to view a list of WebSphere education offerings. http://www-01.ibm.com/software/websphere/education/
78
We consider that a project manager assigned to any project knows exactly how to deal with activities, but as our audience in this book is flexible, we are listing the sections that a good migration project plan should contain: Dates (rollout, milestones) Tasks Number of resources assigned Test plans Dependencies Risks Production rollout Meetings and check points Education activities It is not a final list, so you can add or remove sections that fit your needs.
79
Prepare phase
During this phase check for product and application prerequisites. At this time you should have hardware, software, and people available. Set up development environments, schedule meetings, provide education, and get help if needed.
Migrate phase
Start migrating both application code and runtime configurations. Always remember that the assessment report is your reference, a lot effort has been expended to build that and you can find important information regarding decisions taken and sometimes even code review feedbacks stating challenging areas of the migration. You already have a decision related to migration type, so document everything that is happening and you benefit from your feedback immediately. If you are a project manager or a delegate, your role is important to address issues that are raised putting everyone together or interfacing with other parties such as software and hardware vendors or third party service providers. The migration and test phases are closely integrated. It might be useful to test small pieces of functionality until you have everything migrated. This approach helps in two ways: Challenges of first migrated functionality serve as input to other migrations and speeds up the process. Tests run in parallel with code migration and get prepared for QA and load tests after migration is complete.
80
Test phase
The test phase is dynamic and has intersections with the migrate and rollout phases. There are three main types of tests that are welcome in a migration process: Hands on testing, done together with application migration Functional/regression testing to make sure all functionality are working as expected Load tests to assess whether or not the application/server is performing equal or better than previous environment
Rollout phase
Rollout phase starts after all previous tests are completed and we have ensured that the application is ready to provide the same or better responses than the previous environment. We know that there are issues that are only raised during production. That is why we have plans and the other previous phases to prevent or nullify chances of rollout back outs. Deploy the application into the production environment, make the tests again, and if everything is okay, then a decision whether to proceed has to be made. Usually these rollouts require a detailed plan with milestones, owners, and check points to put the team together and address any problems or initiate the backout plan. Rollouts with interoperability and interfaces involved are much harder to implement because of the potential compatibility problems with the existing applications. Be mindful about these challenges and prepare plans to prevent these issues. A good approach is to have this migration occur during a maintenance window so that you can stop external inputs to the systems affected and test integration and interoperability, so as to minimize risks of having tests mixed with actual valid requests. A clean up of databases or message queues might also be needed.
Cleanup phase
This phase starts when we have successfully deployed the migrated application into production. There are tools that help to monitor performance and system stability that are useful at this moment. Assign specialists to make the appropriate tuning of settings that might be required. Make the changes in the non-production environments before you make them in the production environment and run through the test plans again.
81
82
83
84
Java EE provides a simplified programming model, including the following tools: Inline configuration with annotations, making deployment descriptors now optional Dependency injection, hiding resource creation, and lookup from application code Java persistence API (JPA) allows data management without explicit SQL or JDBC Use of plain old Java objects (POJOs) for Enterprise Java beans and web services Java EE provides simplified packaging rules for enterprise applications: Web applications use WAR files Resource adapters use RAR files Enterprise applications use EAR files The lib directory contains shared JAR files A JAR file can be specified in the application.xml of the EAR either as an application client or as an EJB module A JAR file not specified by the application.xml of the EAR is defined as follows: A JAR file with an application-client.xml implies an application client A JAR file with an ejb-jar.xml implies an EJB module A JAR file with META-INF/MANIFEST.MF specified Main-Class implies an application client A JAR file with any @Stateless, @Stateful, or @MessageDriven annotations implies an EJB application A JAR file with Main-Class implies an application client A JAR file with @Stateless annotation implies an EJB application Many simple applications no longer require deployment descriptors, including EJB applications (.JAR files) Web applications that use JSP technology only Application clients Enterprise applications (.EAR files)
85
Java EE provides simplified resource access using dependency injection: In the Dependency Injection pattern, an external entity automatically supplies an object's dependencies. The object need not request these resources explicitly. In Java EE, dependency injection can be applied to all resources that a component needs. Creation and lookup of resources are hidden from application code. Dependency injection can be applied throughout Java EE technology: EJB containers Web containers Clients Web services
For additional information about Java EE, see the official specification: JSR 244: Java Platform, Enterprise Edition 5 (Java EE 5) Specification. http://jcp.org/en/jsr/detail?id=244
4.6 Summary
This process and activities are not supposed to be a final methodology or even the only way to go through a migration project, but rather, it helps you to be prepared and anticipate challenges to come. Following this process as a base for your own projects definitely helps. As you can see, there are several factors that influenced your planning, but basically two things are essential: A migration assessment with the assessment report as input to the project plan and use of a iterative process where first waves or iterations serve as a knowledge base for future ones. Another thing that is important to note is that the approach of migrate first and improve later is a good way to separate pitfalls of both activities although they are somehow related.
86
Chapter 5.
87
88
4. Choose an installation directory for Installation Manager. We accepted the default installation location: C:\Program Files\IBM\Installation Manager\eclipse Click Next. 5. On the Summary page, click Install. A confirmation window is displayed, informing you that installation of IBM Installation Manager was completed. 6. Click Restart Installation Manager to continue with installation of IBM Rational Application Developer for WebSphere Software. At this point installation of IBM Installation Manager is complete. 7. On the IBM Installation Manager welcome page, select the option to install software packages. 8. On the Package Selection page, select the options for IBM Rational Application Developer for WebSphere Software and IBM WebSphere Application Server Version 7.0 Test Environment. Click Next. 9. On the License Agreement page, review the License Agreement and Non-IBM Terms. Select I accept the terms in licence agreement. Click Next. 10.Choose an installation location for shared resources. We accepted the default installation location: C:\Program Files\IBM\SDPShared Click Next. 11.Choose an installation location for IBM Software Delivery Platform package group. We accepted the default installation location: C:\Program Files\IBM\SDP Click Next. 12.On the following page, click Next to continue without selecting the option to extend an existing Eclipse installation. 13.On the Language Selection page, select your language and click Next. 14.On the Feature Selection page, click Next to continue with default options. 15.On the Common Configurations page, click Next to continue with default options. 16.On the page for configuration of IBM WebSphere Application Server Version 7 Test Environment, select a profile name and location. We accepted the default profile name and profile path. was70profile1 C:\Program Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1 Fill in your user ID and password for administrative security options. Click Next.
89
17.On the summary page, review the information presented and click Install. 18.The confirmation page informs you that installation is completed. Click Finish. 19.The installation program launches IBM Rational Application Developer for WebSphere Software. A dialog box is displayed, asking you to choose a workspace location. We accepted the default location. Click OK. 20.After IBM Rational Application Developer for WebSphere Software is launched, the Administrative Settings dialog box is displayed. Enter the same user ID and password you used at step 16 on page 89 and click Finish. 21.License Management dialog box is displayed, informing you on details of your current licence. Click Done. IBM Rational Application Developer for WebSphere Software Version 7.5 is now installed, with an integrated IBM WebSphere Application Server Version 7.0 Test Environment.
Online update
If you have access, this is the simplest method for a single installation of IBM Rational Application Developer for WebSphere Software. Using online updating, update IBM Installation Manager, IBM Rational Application Developer for WebSphere Software, and the integrated test environments. For detailed instructions on using this method, see the topic Updating Installed Product Packages in the information center for IBM Rational Application Developer for WebSphere Software, at the following web page: http://publib.boulder.ibm.com/infocenter/radhelp/v7r5/index.jsp?topic=/ com.ibm.rad.install.doc/topics/t_update.html High-level steps are as follows: 1. Close any running instances of IBM Rational Application Developer for WebSphere Software. 2. Start IBM Installation Manager by navigating to Start Program Files IBM Installation Manage IBM Installation Manager. 3. On the Start page of IBM Installation Manager, click Update.
90
Important: At the time of writing, the latest update of IBM Rational Application Developer for WebSphere Software requires an updated version of IBM Installation Manager. Continue with the update of Installation Manager. Follow the instructions in the wizard to complete the update. 4. In the Update Packages wizard, select IBM Software Delivery Platform and click Next. Installation Manager searches for updates in its repositories and the predefined update sites for the product. 5. On the Update page, keep the default selections. Click Next. 6. On the Licenses page, after reviewing the license agreements for the selected updates, click Next. 7. On the Features page, keep the default selections and click Next. 8. On the Summary page, click Update to download and install the updates. A progress indicator shows the percentage of the installation completed. 9. Click Finish to close the wizard.
Offline update
The steps to perform an offline update are basically same as for an online update, but you must download the updates and register them as repositories with IBM Installation Manager first. All updates can be downloaded from the following web page: http://www.ibm.com/software/support Important: If any of the updates require a more recent version of IBM Installation Manager than the one currently installed, updates cannot be applied before IBM Installation Manager itself is updated first. The following updates must be downloaded separately and the following process must be repeated for each of them: 1. Update IBM Installation Manager. 2. Update IBM Rational Application Developer for WebSphere Software. 3. Update IBM WebSphere Application Server Integrated Test Environment.
91
To install updates from the compressed files, complete the following steps: 1. Extract the compressed files in an temporary directory. For example, we chose C:\RAD_fixes, and made a separate subdirectory for each upgrade: Installation manager: C:\RAD_fixes\installation manager fix IBM Rational Application Developer for WebSphere Software: C:\RAD_fixes\RAD Integrated test environment: C:\RAD_fixes\WAS 70 2. Add the update's repository location in IBM Installation Manager by performing the following steps: a. Start IBM Installation Manager. b. On the Start page of Installation Manager, click File Preferences, and click Repositories. The Repositories page opens. c. On the Repositories page, click Add Repository. d. In the Add repository window (Figure 5-1), browse to or enter the file path to the diskTag.inf file (or repository.config file when updating IBM Installation Manager itself), which is located in the disk1 sub-directory in the directory where you extracted the compressed files. Click OK.
Figure 5-1 IBM Installation Manager preferences dialog after adding repositories
e. Click OK to close the Preference page. 3. Install the update as described in online update section.
92
93
3. Press the green arrow icon in the Servers tab in the bottom portion of the main IBM Rational Application Developer for WebSphere Software window to launch integrated testing environment. See Figure 5-3.
4. After the status in this window changes to Started, right-click the server name and select Administration Run administrative console. 5. An administrative console login window is displayed. Log in with the credentials selected during installation and click Log in. 6. On the Welcome page, verify the version of the integrated test environment. See Figure 5-4.
94
5.3.1 Installing Application Migration Tool into IBM Rational Application Developer for WebSphere Software
The following steps describe how to install the Application Migration Tool into IBM Rational Application Developer for WebSphere Software: 1. Download the Application Migration Tool from the following web page: http://www.ibm.com/developerworks/websphere/downloads/migration_tool kit.html Save the file to a suitable location. We used the C:\Toolkit_setup folder. 2. Start IBM Rational Application Developer for WebSphere Software. 3. Open Software Updates and Add-ons window by navigating to Help Software updates. Select the Available Software tab. 4. Click the Add Site button.
95
5. On the Add Site dialog box, click the Archive button. A file dialog box is displayed. Select the downloaded plug-in file and click OK. See Figure 5-5.
6. The new update site is displayed in the list. Select the Update Site for Application Migration Tool and click Install. See Figure 5-6.
7. On the install window, click Next to continue. 8. On the Review Licences window, select the I accept the terms of license agreement option and click Finish.
96
9. When the Software Updates window is displayed, informing you that installation was completed, click Yes to restart IBM Rational Application Developer for WebSphere Software. 10.After the restart is completed, to verify the installation, navigate to Help About IBM Rational Application Developer for WebSphere Software. Click Features Details and scroll down to locate the Application Migration Tool feature, as shown in Figure 5-7.
97
To install DB2 Universal Database Express Edition, follow these steps: 1. Launch the setup.exe setup program. 2. On the DB2 Setup Launchpad, select Install a product. 3. Scroll down to locate DB2 Express Version 9.7 and click Install New. 4. On the Welcome page, click Next. 5. On the Software License Agreement window, select the I accept the terms in the license agreement option after reviewing the license and click Next. 6. On the Installation Type page, select Typical installation and click Next. 7. Leave the default response file options on the following page and click Next on the following page. 8. On the Installation folder page, select an installation location. We used the default installation location, C:\Program FilesSQLLIB\. Click Next. 9. On the next page, enter user information for the DB2 Administration Server. Accept the default values and click Next. 10.On the Configure DB2 Instances page, accept the default values and click Next. 11.Click Finish on summary page to start installation. 12.After setup is completed, an information page is displayed. Click Next. 13.Click Finish to complete installation on the next page without selecting any other additional products to install. 14.The setup program automatically launches the First Steps page upon successful termination. Close this page.
98
Chapter 6.
99
6.1 Introduction
Oracle WebLogic Server 9.2 was released in October of 2006 and is the J2EE runtime version from Oracle used throughout our migration examples in this IBM Redbooks publication. During our migration exercise for this platform, we used two J2EE 1.3 sample applications: Trade 3.1 xPetstore EJB 3.1.3 The Trade 3.1 application that we have selected for migration was developed by IBM for performance testing purposes and does not use any non-J2EE features of Oracle WebLogic Server 9.2. We selected Trade for the following reasons: It is a well built application It uses most of the J2EE 1.3 APIs discussed in 1.3.1, Java SE and EE technologies covered on page 4. It implements a number of good programming techniques for performance. It implements a number of patterns to reuse in your application development efforts. Note: There is a possibility that your application might have a dependency on WebLogic proprietary extensions such as WebLogic startup and shutdown classes, or it might have been constructed using the WebLogic Workshop development tool. If this is the case, your application is likely not portable to other application servers and requires a redesign and rewrite. The second application we have migrated is xPetstore EJB 3.1.3, which is a rewrite of Suns (now Oracle) Petstore application. This might not be the typical application that you find in the enterprise because it was designed and built to be portable across multiple application server platforms. The reason we have selected this application is that it was not designed for WebSphere and there is no evidence that it has ever been tried in WebSphere with DB2. The application uses a number of elements of J2EE 1.3 discussed in 1.3.1, Java SE and EE technologies covered on page 4. We used the new WebSphere Application Server Migration Tool V1.1 to migrate both the Trade and xpetstore applications. We explain the capabilities of the new migration toolkit and how to configure it in 6.4, Application Migration Tool overview on page 103.
100
Another useful tool that you can use Oracles Java Application Verification Kit (AVK). This tool is intended to help developers test their applications for the correct use of J2EE APIs and portability across J2EE. See more details at the following web page: http://java.sun.com/j2ee/verified/avk_enterprise.html
101
IBM Rational Application Developer V7.5 We used the new WebSphere Application Migration Tool V1.1 plugin for Rational Application Developer V7.5 that supports the migration of J2EE applications developed for competitive application servers. Details on the tool capabilities can be found in 6.4 "Application Migration Toolkit Overview". Instructions on how to install and configure Rational Application Developer V7.5 can be found in 5.2, IBM Rational Application Developer for WebSphere Software on page 88.
102
7. On the Configure Server Start Mode and JDK window, make the following selections: WebLogic domain startup mode: Development Mode JDK: Sun SDK 1.5.0_10 8. On the Customize Environment and Services Settings window, keep the default selections and click Next. 9. On the Create WebLogic Domain window, enter the following information: Domain name: TradeDomain Domain location D:\bea\user_projects\domains\TradeDomain 10.Click the Create button. 11.Run the configuration wizard a second time and create a second domain for the xPetstore EJB application. This time, create xpetstore in the following directory: D:\bea\user_projects\domains\xpetstore
103
The Application Migration Tool V1.1 and associated documentation can be downloaded from the following web page: http://www.ibm.com/developerworks/websphere/downloads/migration_toolkit .html The Application Migration Tool forum is available to provide input and get questions answered from the following web page: http://www.ibm.com/developerworks/forums/forum.jspa?forumID=2106
104
Trade Servlets Web Client Trade Option Trade JSPs WebSphere Command Beans
Account CMP
Qunte CMP
Joe, in action!
SOAP Client
Message EJBs Trade Broker MDB Queue EJB Container Streamer MDB Topic Message Server Pub/Sub
UDDI Registry
Trade WSDL
105
6. Build Trade for WebSphere Application Server V7 using Rational Application Developer V7.5. 7. Deploy and test the application on WebSphere Application Server V7 and identify and solve any problems reported.
106
trade3AppClient Directory containing source code for the J2EE client application for Trade. trade3Web Directory containing the source code for the web module. In our scenario, we used the D:\sampleApp\Trade3 directory to extract the application. It is also referred to as <source_home>.
107
set DB2=C:\IBM\SQLLIB\java set JDBC_TRADE_CLASSPATH=%DB2%\db2java.zip;%DB2%\db2jcc.jar;%DB2%\db2jcc_li cense_cisuz.jar;%DB2%\db2jcc_license_cu.jar set CLASSPATH=%CLASSPATH%;%MEDREC_WEBLOGIC_CLASSPATH%;%JDBC_TRADE_CLASSPATH % In our scenario, the DB2 JDBC drivers are located in the C:\IBM\SQLLIB\java directory. 3. Start the Oracle WebLogic Server 9.2 instance from the command line: d: cd \bea\user_projects\domains\TradeDomain startWebLogic.cmd 4. Access the Console Login when the server is up and running. When we created the new WebLogic configuration, we accepted the default values for port and location. In our scenario the Console Login can be accessed at the following URL: http://localhost:7001/console The username and password required for login were specified during the creation of the new WebLogic configuration. In our scenario, we used weblogic for both the username and password.
108
Click Next. The Transaction Options window is displayed and an informational message is displayed stating that based on the selected driver type, only XA 2 phase commit transactions supported. Click Next. 2. On the Connection Properties window, enter the information listed in Table 6-2.
Table 6-2 Database Connection Properties Values Parameter Database Name Host Name Port Database User Name Password Value trade3db localhost 50000 db2admin db2adm1n
Note: Use the database user name and password for your DB2 installation. In our example we used db2admin/db2adm1n respectively.
3. On the Test Database Connection page, click the Test Configuration button. You should see the message Connection test succeeded. 4. On the Select Targets window, select AdminServer as the target server and click Finish.
109
2. Create a JMS module to act as the container to defining JMS queues, topics, connection factories. 3. Create a JMS Module by navigating to TradeDomain Services Messaging JMS Modules. 4. Enter JMS Resource for the JMS Module name and click Next. 5. Select AdminServer as the target and click Finish. 6. Create the JMS queues, topics, and connection factories needed by the Trade application at run time. 7. Click JMS Resource, then click New. Configure the destinations by creating a new JMS Queue and an new JMS Topic. 8. Create a new JMS Queue with the values shown in Table 6-4. Click Next
Table 6-4 JMS Queue values Parameter Name JNDI Name Value TradeBrokerQueue jms/TradeBrokerQueue
9. Select JMSServerSubDep in the Subdeployment drop-down menu. In the Targets field make sure TradeJMSServer is selected. Click Finish.
110
10.From the JMS Resource window, create a JMS Topic with the values listed in Table 6-5. Click Next.
Table 6-5 JMS Topic values Parameter Name JNDI Name Value TradeStreamerTopic jms/TradeStreamerTopic
11.Select JMSServerSubDep in the Subdeployment drop-down menu. In the Targets field make sure TradeJMSServer is selected. Click Finish. 12.Create a second JMS Topic with the values listed in Table 6-6. Click Next.
Table 6-6 JMS Topic values Parameter Name JNDI Name Value TradeStatsTopic jms/TradeStatsTopic
13.Select JMSServerSubDep in the Subdeployment drop-down menu. In the Targets field make sure TradeJMSServer is selected. Click Finish. 14.Create two connection factories: Queue connection factory Topic connection factory Create the connection factories with the values shown in Table 6-7.
Table 6-7 Queue connection factory values Parameter Name JNDI Name Value QueueConnectionFactory jms/QueueConnectionFactory
15.In the Targets filed click Advanced Targeting button. 16.In the Subdeployment drop-down menu select JMSServerSubDep and in the Targets field make sure TradeJMSServer is selected. Click Finish.
111
17.Create a Topic Connection Factory by repeating steps 14 on page 111 through 16 on page 111 using the values listed in Table 6-8.
Table 6-8 Topic connection factory values Parameter Name JNDI Name Value TopicConnectionFactory jms/TopicConnectionFactory
112
If you click the Configuration link on the left side and click Trade Scenario, you can see how the application automatically navigates itself by clicking the Reload button in your browser. This feature randomly selects the next action to be performed and populates all the data instead of the user having to do it by hand. This greatly simplifies performance scripts. If you want to performance test this application, you do not need to navigate all windows and enter all the data. You can point your stress tool to the URL http://localhost:7001/trade/scenario and configure your stress test tool to see how many hits and how many concurrent users access this URL, and then start your test.
113
See 6.4, Application Migration Tool overview on page 103 for instructions on how to download and install the IBM WebSphere Application Server Migration Toolkit V1.1.
114
3. Make sure the Target runtime field is set to WebSphere Application Server v7. 4. In the Enterprise Application Import window, select trade3AppClient.jar and click Next. 5. In the Ear Module and Utility JAR Projects window, make sure all three modules are selected, as shown in Figure 6-3 and click Finish.
It takes a couple of minutes for Rational Application Developer to build the project. You can check the status at the bottom right corner of the workbench. When the build is complete you will notice a lot of errors in the problems view. This is expected, as the application has the web logic generated classes. Next, we import the Trade web services client WAR file. 6. In the Rational Application Developer Enterprise Explorer perspective, right-click and select Import WAR file from the context menu. 7. Click Browse and select the Trade WAR file trade3WSAppClient.war. 8. Under EAR Membership clear the Add project to an EAR field. 9. Click Finish.
115
Tip: Rational Application Developer V7.5 automatically rebuilds the project after each change to source code. Turn this off by selecting Project Build automatically from the menu. After the import you are prompted to switch to the web perspective. Select NO. You should have the following projects in the Enterprise Explorer view: trade3AppClient Contains a J2EE client application for Trade. trade3EJB This project contains the Trade EJBs. trade3Web The Trade web application containing servlets and JSPs. trade3 This project contains the EAR application. trade3WSAppClient This project contains the trade web services client.
116
1. Select Analysis from the Run menu to display the Application Migration Tool main configuration dialog box, as shown in Figure 6-4.
117
2. Expand the Software Analyzer and click New_configuration in the window shown in Figure 6-4 on page 117. The right side changes to show and explanation of the basic configuration options available. Tip: If you start a new workspace, the Software Analyzer does not have the New_Configuration sub-option. In this case highlight Software Analyzer and click the new icon on the toolbar (the first icon with the+ sign). 3. In the Name field, enter AppMigration as the name of the configuration. 4. In the Scope tab, leave the Analyze entire workspace radio button selected, as shown in Figure 6-5.
118
6. Select WebLogic Application Migration from the Rules Sets drop-down menu, and click Set. See Figure 6-6. Tip: The default is that no rules are selected until the user selects the ones that are of interest and clicks Set . After the configuration is set it can be reused.
The Application Migration Tool is now configured and the rules set. We are ready to run the analysis against the trade application. You can expand any of the analysis domains to see which rules are selected.
119
7. Click Analyze to analyze all the projects in the workspace. The Software analyzer view is opened at the bottom of the window. It contains four tabs. Each tab corresponds to one of the analysis domains selected based on the Rule Set selection made earlier. The Class-Path Review tab lists any class path related issues. The Java Code Review tab lists Java code related issues. The XML File Review tab lists issues with deployment descriptors and the presence of any web logic specific files. The JSP Code Review tab lists issues found in JSP files, commonly associated with web projects. 8. Click the XML File Review tab. See Figure 6-7.
As you can see, the tool scanned the XML files in the project and flagged the potential problems with WebLogic deployment descriptors by category/rule violation. For example, the tool points out that EJB and MDB (message-driven bean) JNDI (Java Naming and Directory Interface) references are defined in a WebSphere binding file. It also detected WebLogic specific files. You can expand each of the rules to see the files in question and which project to which they belong.
120
The tool found two rule violations. The first one is the absence of using matching throw clause for Java exceptions between the EJB remote interfaces and their corresponding bean implementation class. The tool also flagged 1632 occurrences of the use of WebLogic specific package names in Java files. Those packages were auto generated by WebLogic application server. At this point the tool only flags this issue but does not provide a quick fix option. Tip: You can right-click any of the flagged files under a specific rule to see a list of available options in the pop-up menu. For example, under Java Code Review tab expand the WebLogic package references rule and right-click any of the files in the list. From the context menu, select View Results. The Java file in question is opened and the cursor is at the code problem line.
121
122
4. Delete all the files in this folder with the X red mark except for the files Quote.java and QuoteHome.java. The com.ibm.websphere.samples.trade.ejb package resembles Figure 6-9.
123
5. The web application project also contains Oracle WebLogic Server specific classes, so delete the /trade3Web/Java Resources/src/jsp_servlet folder. Your trade3web project should look like Figure 6-10.
Rational Application Developer V7.5 still reports errors for the web application and client project. This is because the projects depend on classes located in the EJB project. To fix the problem perform the following steps: 1. Right-click the trade3Web application project and select Properties. 2. From the left pane in the trade3Web properties window, select Java Build Path. 3. Select the Projects tab and check Add. 4. In the Required Project Selection dialog box select trade3EJB and click OK.
124
5. Click OK in the Properties dialog box to close it. See Figure 6-11.
6. Repeat steps 1 on page 1245 for the trade3AppClient. The trade3EJB project also depends on the trade web services client, so we need to set the Java build path for the trade3EJB to reference trade3WSAppClient project. 7. Repeat steps 1-5 for the trade3EJB but select trade3WSAppClient under the Projects tab and click OK.
125
At this point the trade3EJB project still has errors. The Problems view still shows six errors remaining for the EJB project. This is because the source code for the files Quote.java and QuoteBean.java call the Remote class in java.rmi.RemoteException package, but it does not import the package. Fix this by using the Rational Application Developer Quick Fix wizard. 8. Switch to the Problems view, as shown in Figure 6-12.
9. Select the The type Remote is ambiguous error. From the context menu select Quick Fix. 10.The Quick Fix wizard window is displayed. 11.Highlight the first fix Explicitly import java.rmi.Remote.
126
The Java file Quote.java is open and the code modification is done by.the wizard inserting the appropriate import statement at the top of the file. 13.Click Save to save the file. You should only have three errors left. 14.Repeat steps 8-11 and select the The type Remote is ambiguous error and apply the Quick Fix as done earlier. Important: Save the Java file after running each quick fix. Close open Java files. The next step is to clean and rebuild all projects in the workspace.
127
15.From the Project menu, clear the Build Automatically option. 16.From the Project menu select Clean. 17.Select the Clean all projects radio button and click OK. See Figure 6-14.
18.From the Project menu select the Build Automatically option. This ensures projects are automatically built as we make changes. All errors reported by Rational Application Developer are now fixed.
128
This re-runs the analysis tool with the saved configuration. The focus is returned to the Software Analyzer Results view. Notice that the tool creates a new report in the left frame of the view with the date and time stamp. 2. Select the Java Code Review tab. You should not see the 1632 errors reported earlier by the tool. 3. Migrate the WebLogic deployment descriptors entries. The tool creates the appropriate WebSphere binding files. Click the XML File Review tab.
129
4. In the XML File Review tab expand the Use WebSphere bindings to define EJB JNDI names category. See Figure 6-16.
130
5. Right-click the weblogic-ejb-jar.xml entry. From the context menu select Preview Quick Fix. See Figure 6-17. The Quick Preview Editor tool is displayed (Figure 6-17). Examine the code changes before they are committed. In this case, the tool creates the ibm-ejb-jar-bnd.xml binding file and place it in the EJB module. This file did not exist because this is a WebLogic application.
131
6. Highlight the Use WebSphere bindings to define EJB JNDI names category. From the context menu, select Quickfix All. See Figure 6-18.
Important: If you select Quick FixAll category, this applies every quick fix applicable in the analysis. This is a good feature if you already know what changes the tooling will do to the application. This is not suggested for a first time application migration.
132
The WebSphere binding file is created and the EJB JNDI names were copied from the corresponding WebLogic deployment descriptor. Double-click the file and explore its contents. See Figure 6-19.
133
7. In the XML File Review tab click the Use WebSphere binding to define EJB reference names category. From the context menu, select Quickfix All. This rule flags EJB references found in weblogic.xml and weblogic-ejb-jar.xml if the corresponding quick fix has not already been applied. After a quick fix is applied, the WebLogic XML is marked with a comment indicating it has been migrated. This is used to determine whether to run the quick fix. It can be used at the end of migration to identify how much of the XML file has been migrated. The quick fix provided for this rule takes the EJB reference information defined in the WebLogic-specific deployment descriptors and migrates it to the standard deployment descriptors and the WebSphere bindings files, ibm-ejb-jar-bnd.xmi or ibm-web-bnd.xmi. 8. In the XML File Review tab highlight the Use WebSphere bindings to define Message Driven beans JNDI names category. From the context menu select QuickFix All. The provided quickfix copies the destination JNDI name from the weblogic-ejb-jar.xml to the ibm-ejb-jar-bnd.xmi. The quickfix, however, does not set the ActivationSpec JNDI name. For more information about manual intervention, highlight the rule and select the F1 function key. This launches the help section. After launching the help section, select See details to show the best practices for manually addressing issues such as the ActivationSpec JNDI name. 9. Repeat step 8 for the Use WebSphere bindings to define resource reference names category. From the context menu select QuickFix All.
134
10.Migrate your CMP beans from WebLogic to WebSphere Application Server. In this version of the migration toolkit, it defaults to an Oracle back-end. To work around this perform the following steps: a. Open the weblogic-cmp-rdbms-jar.xml file by double clicking it. This launches the deployment descriptor editor. See Figure 6-20.
b. Insert the <database-type>db2</database-type> xml tag into the second-to-last field in the file. See Figure 6-21. Press Crtl + s to save this file. Otherwise, you create an Oracle back end and have to start over again.
135
12.Review the help for the WebLogic Query language constructs by highlighting one of the rule and select the F1 function key. This launches the help section. After launching the help section, select See details. 13.Double-click the weblogic-cmp-rdbms-jar.xml:126 rule in trade3EJB. This shows the weblogic-ql construct. See Figure 6-23. You should see that ORDERBY is used and is a WebLogic construct and not an ejb-ql construct. The ebj-ql equivalent is ORDER BY, as shown in the help, but the weblogic-ql does not accept this. Hand-edit the ejb-jar.xml file after you have converted the CMP Mappings in step 14.
136
14.To convert the CMP Mappings, right-click the rule and select Quick Fix. See Figure 6-24.
15.The quick fix creates the Map.mapxmi file, which is used to map CMP fields to table columns.
137
16.Open the mapping editor to verify everything is mapped. The file is located in the following folder: /trade3EJB/ejbModule/META-INF/backends/DB2UDBNT_V95_1 SeeFigure 6-25.
The database schema is imported and located in the following folder: /trade3EJB/Data Models/TRADE3DB.dbm
138
17.To verify that all EJB elements are mapped to their corresponding table columns navigate to the following folder: /trade3ejb/ejbModule/META-INF/backends/DB2UDBNT_V95_1 Open the Map.mapxmi file and enable the Show only the unmapped objects option. See Figure 6-27.
18.Close the mapping file. Important: Verify that the back end created is the default one. Open the /trade3ejb/ejbModule/META-INF/ejb-jar.xml file with the Deployment Descriptor Editor. On the Overview tab, scroll down and verify that the Backend ID is DB2UDBNT_V95_1. 19.Switch to the Source tab of the EJB deployment Descriptor. Perform the following steps to address the weblogic-ql rule pertaining to ORDERBY. a. Click Ctrl+F to find SELECT OBJECT(o) FROM Orders o WHERE o.account.profile.userID = ?1. There should only be one instance of this in the file. b. Replace this with SELECT OBJECT(o) FROM Orders o WHERE o.account.profile.userID = ?1 ORDERBY o.orderID DESC, which is from the first <weblogic-ql> tag in weblogic-cmp-rdbms-jar.xml. c. Change the ORDERBY to ORDER BY.
139
20.Repeat step 20 for the next rule. Search for SELECT OBJECT(q) FROM Quote q WHERE q.symbol LIKE and replace the entire ejb-ql line with SELECT OBJECT(q) From Quote q WHERE q.symbol LIKE 's:_' OR q.symbol LIKE 's:__' ORDERBY q.change DESC. 21.Save and close the EJB deployment descriptor editor. 22.Return to the Software Analyzer view and right-click the weblogic-ql rule. From the context menu, select Ignore Result. This removes the rule from the view. It also enters a comment in the weblogic-cmp-rdbms-jar.xml file to tell the analyzer to ignore the rule in the next iteration. 23.Run a project clean and review the Problems view. If you missed changing ORDERBY to ORDER BY, RAD will flag this as an error with a red X. Open the Source tab of the deployment descriptor and search for ORDERBY and make appropriate changes. See Figure 6-28.
24.In the XML Review tab expand the WebLogic specific files category and expand all sub-options. Those are the WebLogic specific deployment descriptors files. Delete them because we all migrated all of their entries to the corresponding WebSphere binding files.
140
25.In the Enterprise Explorer view expand the EJB project and browse to the /trade3EJB/ejbModule/META-INF folder and delete the following files: weblogic-ejb-jar.xml weblogic-cmp-rdbms-jar.xml See Figure 6-29.
141
26.In the Enterprise Explorer view, expand the trade3web project and browse to the /trade3web/webContents/WEB-INF folder. Delete the weblogic.xml file. See Figure 6-30.
All errors reported by the migration tool and Rational Application Developer v7.5 should now be fixed.
142
143
The next window provides informational messages before running the J2EE specification migration wizard. Click Next. 2. In the J2EE version drop-down menu, select 1.4 and click Next. See Figure 6-32.
3. In the EJB Module Migration window make sure trade3EJB is selected and click Next.
144
4. In the Web Projects window make sure trade3web is selected and click Finish. The Migration Complete dialog box (Figure 6-33) is displayed. Note: You can click the Details button on the Migration Complete dialog box to see the exact changes the migration wizard performed against the project.
5. Click OK.
145
Tip: You can start the WebSphere Application Server with Rational Tool by clicking the Servers view, highlighting the server and clicking the green arrow. Once the server is started we need to configure WebSphere Application Server V7, open a web browser and access the Administrative Console at the following URL: http://localhost:9060/ibm/console. The major difference compared to Oracle WebLogic Server 9.2 is in how we configure JMS. This is because WebSphere Application Server V7 uses Service Integration Bus, which is an ESB-like approach, as the back end for the default JMS messaging engine that is based on JMS 1.1 specifications. Note: A service integration bus in WebSphere supports applications using message-based and service-oriented architectures (SOAs). A bus is a group of one or more interconnected servers or server clusters that have been added as members of the bus. Applications connect to a bus at one of the messaging engines associated with its bus members. More information about SIB can be found in the WebSphere information center at the following web page: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topi c=/com.ibm.websphere.pmc.nd.multiplatform.doc/concepts/cji_learning. html
Configuring JMS
In this section, we describe how to configure the components necessary for JMS messaging. We use the browser-based administrative GUI, but this task can also be scripted using wsadmin command line tool. This way it takes only a few moments to create all necessary resources on a new server. This task is broken into parts. Each following section describes a part of the overall process: Creating a new bus on page 147 Creating a bus member on page 149 Creating bus destinations for JMS queues and topics on page 149 Creating a JMS connection factory on page 150 Creating the JMS queue on page 152 Creating a second JMS queue on page 152 Creating a JMS Topic on page 153 Creating a JMS activation specification for the JMS queues on page 154 Configuring Message Driven beans on page 155
146
147
4. Save the changes made to the configuration by clicking Save at the top of the window. You should see the newly created bus listed under buses. See Figure 6-35.
148
149
3. Click Default messaging provider. 4. Click Queue connection factories in the Additional Properties section.
150
5. Click New, and create a queue connection factory using the information shown in Table 6-9.
Table 6-9 JMS queue connection factory configuration Parameter Name JNDI name Bus name Values TradeBrokerQCF jms/TradeBrokerQCF bus
6. Click OK, then save the changes you made. 7. Return to Resources JMS JMS Providers. 8. Click Default messaging provider. 9. Click Topic connection factories in the Additional Properties section. 10.Click New, and create a new JMS topic connection factory using the information in Table 6-10.
Table 6-10 JMS topic connection factory configuration Parameter Name JNDI name Bus name Values TradeStreamerTCF jms/TradeStreamerTCF bus
151
152
153
4. Create a second JMS activation specification with the information shown in Table 6-15.
Table 6-15 JMS activation specification configuration Parameter Name JNDI name Destination type Destination JNDI name Bus Value TradeStreamerMDB eis/TradeStreamerMDB Topic jms/TradeStreamerTopic bus
5. Click OK and save your changes. At this point, you have all the necessary components for JMS messaging configured. The next step is to configure the MDBs to use the JMS activation specification and the queues.
154
You have now configured the MDB to use the JCA Activation Specification and Destination configured in the previous section. See Figure 6-37.
155
4. Select TradeSteamerMDB from the list of EJBs. In the WebSphere Bindings section, select JCA Adapter and specify the values shown in Table 6-17.
Table 6-17 Mailer MDBs WebSphere binding configuration Parameter ActivationSpec JNDI name Destination JNDI name Value eis/tradeStreamerMDB jms/TradeStreamerTopic
You have now completed the configuration of the MDBs and JMS messaging.
156
10.Click New to create a new JDBC provider using the information shown in Table 6-18.
Table 6-18 JDBC provider configuration Parameter Database type Provider type Implementation type Value DB2 DB2 Universal JDBC Driver Provider XA datasource
11.We already defined the class path values for the database using WebSphere Variables, the values are already populated, so click Next. 12.The Summary window is displayed, click Finish and save the changes. With the JDBC provider defined and the DB2 JDBC driver path specified, the next step is to create the actual data source and authentication alias. 1. From the administration console, navigate to Resources JDBC JDBC providers, and select the newly created JDBC provider by clicking its name: DB2 Universal JDBC Driver Provider (XA). 2. Click Data sources in the Additional properties section. 3. Click New, and create a new data source using the information shown in Table 6-19.
Table 6-19 JDBC data source configuration Parameter Driver type Server name Database name Value 4 localhost trade3db
4. Click Next. 5. On the Setup security alias window leave all defaults, then click Next. 6. The Summary scre.en is displayed click Finish and save the changes. 7. Select the newly created data source by clicking its name: TradeDataSource. 8. Click the JAAS J2C authentication data in the Related Items section.
157
9. Click New, and create a new alias using the information shown in Table 6-20.
Table 6-20 J2C Authentication Alias Configuration Parameter Alias UserId Password Value TradeDataSourceAuthData db2admin db2adm1n
10.Click Apply. 11.Click OK and go back to the data source just created. From the Component-managed authentication alias drop-down menu, select the J2C alias just created. 12.Click OK and save your configuration. 13.Select the data source you just created from the list and click Test connection.
Migrating EJBs
This section describes how to configure the Trade Session beans and Container Managed beans to run on WebSphere Application Server V7. In our migration example, we used the Deployment Descriptor Editor in Rational Application Developer V7.5 and the migration tool to generate the WebSphere Application Server V7 specific deployment descriptors.
158
3. Repeat step two for each EJB in the list, except for the MDBs. Specify a unique JNDI name for each EJB in the following format ejb/<EJBName>. See Table 6-22.
Table 6-22 Trade EJB JNDI Names EJB AccountProfileEJB HoldingEJB KeyGenEJB OrderEJB QuoteEJB KeySequenceEJB TradeEJB JNDI Name Values ejb/AccountProfileEJB ejb/HoldingEJB ejb/KeyGenEJB ejb/OrderEJB ejb/QuoteEJB ejb/KeySequenceEJB ejb/TradeEJB
159
11.Save changes to the deployment descriptor by pressing Ctrl+S. Or, from the RAD Window menu click File Save. Do not close the EJB deployment descriptor editor. Proceed to Configuring the default data source for CMPs on page 161.
160
161
162
2. Under Available projects, select trade3wls and click Add. The trade3wls project is under the Configured projects. 3. Click Finish. It will take a couple of minutes for the application to deploy to the server. You can expand the server and verify the application status is Started.
163
Browse through the site to check that the application is running correctly. Perform the following steps to test the application: 1. Click the Configuration option in the left navigation pane. See Figure 6-40.
164
2. Select the (Re)-Populate Trade Database option under Benchmark Configuration Tools. This populates the Trade database with fictitious users and stocks. Any existing users are deleted, and a new set of users and stocks are created. (This might take some time to complete). 3. Scroll down to the Trade Configuration section Order-Processing Mode. The three choices are as follows: Synchronous (the default selection) Asynchronous_1-Phase Asynchronous_2-Phase The mode can be changed for subsequent runs of the Trade application by selecting another mode, and clicking Update Config. 4. Close this window and go back to the original Trade Application window. 5. While still in the Configuration utilities, select Reset Trade. Note the Order Processing mode in the table. For the next set of tests, access the following URL: http://localhost:9080/trade/scenario This URL is handled by the TradeScenarioServlet. The servlet emulates a population of users by executing an action for a randomly chosen user on each access to the URL.
6.5.4 Summary
We have completed the migration of the Trade application with minimum changes to the Java code. This application was originally developed for WebSphere, then ported to WebLogic, and we ported it back to WebSphere. Trade is a fairly complex application and uses a large number of vendor-specific deployment descriptors with exactly the same code base. We redeployed the compiled EAR file without having to change much of the Java code. We were able to demonstrate the following concepts: Use of the WebSphere Application Server Migration Tool V1.1 for Rational Application Developer V7.5 for automatic migration of CMP EJB mappings and vendor-specific deployment descriptors. Configuration of JDBC provider and data source, Service Integration Bus, JMS queues and topics and application deployment tasks with WebSphere Application Server V7. Basic development activities using Rational Application Developer V7.5.
165
166
The migration of the xPetstore EJB application is to be done in the following sequence: 1. Build the application from source code using Ant. 2. Configure Oracle WebLogic Server 9.2 to create all necessary resources for the application, such as Data Sources, Mail provider, and so forth. Deploy xPetstore EJB into Oracle WebLogic Server 9.2 to verify that it works properly by running JUnitEE tests provided with the application. 3. Import the EAR file from WebLogic into Rational Application Developer V7.5 to take advantage of its advanced deployment descriptor editing functionality. We do not change source code, but we update resource references and export the EAR file. 4. Configure WebSphere Application Server V7 to create the same resources we created in Oracle WebLogic Server 9.2 for xPetstore EJB application. 5. Deploy the application into WebSphere Application Server V7 and rerun our JUnitEE test cases to make sure they are executed successfully. Note: In the migration process, we remove the dependency on Ant and XDoclet. We do not modify the Ant build script to work with WebSphere Application Server V7. Rational Application Developer V7 includes all the necessary tools for making the builds. This is only done to highlight how Rational Application Developer V7 differs from using Ant and XDoclet. It is recommended that you have an automated build process. We recommend that the build script be created from scratch after the migration is completed successfully.
167
The following list details the subsections contained in this section: Getting the xPetstore EJB application on page 168 Creating the sample application database on page 168 Adding the DB2 JDBC driver to the class path on page 169 Creating a new data source on page 169 Creating a new JMS server on page 170 Creating the JMS module on page 170 Creating the JMS queues on page 171 Creating a JMS connection factory on page 171 Creating a new JavaMail session on page 172 Configuring the application to use DB2 on page 173 Building the sample application on page 173 Deploying the sample application on page 174 Testing the application on page 175
168
Next, we configure the resources necessary to run the xPetstore EJB application on Oracle WebLogic Server 9.2.
2. Click Next. The Transaction Options window is displayed and an informational message is displayed stating that based on the selected driver type, only XA 2 phase commit transactions supported. Click Next.
169
3. In the Connection Properties window enter the information in Table 6-27 in to the database.
Table 6-27 Database Connection Properties Parameter Database Name Host Name Port Database User Name Password Value wl_xp_ej localhost 50000 db2admin db2adm1n
4. On the Test Database Connection page, click Test Configuration. The message Connection test succeeded is displayed. 5. On the Select Targets page, select AdminServer as the target server and click Finish.
170
2. In the Subdeployment drop-down menu, select PetstoreJMSSubDep. In the Targets field, make sure Petstore JMS Server is selected. Click Finish. This queue is used by the Order MDB in xPetstore EJB. 3. Create another JMS queue to be used by the Mailer MDB. Create a new JMS queue in the same way as described earlier, specifying the values in Table 6-30 on page 171.
Table 6-30 Mail MDBs JMS queue configuration Parameter Name JNDI name Value Mail queue jms/queue/mail
171
3. On the Subdeployment drop-down menu, select PetstoreJMSSubDep. In the Targets field make sure Petstore JMS Server is selected. Click Finish. 4. On the JMS connection factory page, click the Transactions tab and select XA Connection Factory Enabled. 5. Click Save.
Target
172
#========================================================= # DB2 configuration #========================================================= db.driver=COM.ibm.db2.jdbc.DB2XADataSource db.url=jdbc:db2:wl_xp_ej db.user=db2admin db.password=db2adm1n db.classpath=${lib.dir}/db2java.zip:${lib.dir}db2jcc.jar:${lib.dir}db2j cc_license_cu.jar db.foreign.key=true hibernate.dialect=cirrus.hibernate.sql.DB2Dialect hibernate.generator.class=native hibernate.outer.join=true
173
The build script is configured by modifying the following property files: <source_home>\conf\as\appserver.properties <source_home>\conf\as\weblogic.properties To make the build, follow these steps: 1. Change the xPetstore EJB target platform to WebLogic by changing the app.server property to weblogic in the <source_home>\conf\as\appserver.properties file. 2. Build xPetstore EJB by running build.bat from the <source_home>\xpetstore-ejb directory. Check the value of your JAVA_HOME variable and reset it in the build.bat file if necessary. Ant uses the default target all to build the application. This makes Ant perform the following tasks: 1. 2. 3. 4. 5. 6. Clean the build directory by removing any temporary files. Run XDoclet to generate source code and deployment descriptors. Compile all source code. Create a jar file containing EJBs. Create a WAR file containing the web application. Create an EAR file <source_home>\dist\xpetstore-ejb.ear containing the EJB and WAR file.
The EAR file contains the following files that make up the complete xPetstore EJB application: xpetstore-ejb.jar xpetstore-ejb.war xpetstore-ejb-test.war
174
2. Populate the database with the sample xPetstore EJB data by opening a command line window and executing the following commands. db2cmd db2 connect to wl_xp_ej user db2admin using db2adm1n db2 -tvf <source_home>xpetstore-ejb\sql\xpetstore-cmp-wls.data.sql Important: Because our WebLogic domain was created to run in development mode, when we deploy the application it creates the tables with an extra column. Hence, the data.sql provided by the xPetstore EJB application does not work. See Appendix C, Additional material on page 375 for instructions on how to download xpetstore-cmp-wls.data.zip. Extract the file into the <source_home>xpetstore-ejb\sql directory. The difference from the original data.sql file is that this one contains the column names where the data is inserted. This is needed because WebLogic changed the container-created tables. 3. Access the application at the following URL: http://localhost:7001/xpetstore-ejb At this point, you have the database with all the sample data populated. The next step is to test the application.
175
176
2. Click Browse and select the xpetstore-ejb.ear EAR file. In our example we have it is located in <source_home>\xpetstore-ejb\xpetstore-ejb.ear. 3. Make sure the Target runtime is WebSphere Application Server v7. Click Next. 4. In the next window do not select any of utility jars and web libraries. Those are included in the EAR upon import. 5. In the Ear Module and Utility JAR Projects, make sure all modules are selected and click Finish. The wizard automatically created four new projects in your workspace as shown in Figure 6-42 on page 177.
The first item in the navigator view is the EAR project. The second item contains the EJB project and the third item the web application project. The last item is the test project, which contains unit tests. Tip: Before proceeding, configure Rational Application Developer V7 not to build the projects automatically after changes to the source. This is done by clearing the Build Automatically option in the Project menu.
177
Import the Java source files that were not generated by XDoclet by performing the following steps: 1. Copy the EJB project's source code folder, located in the <source_home>\xpetstore-ejb\java\xpetstore directory, to the xpetstore-ejb_EJB project's ejbModule\xpetstore folder in the Rational Application Developer V7.5 workspace. You can use the command line, copy and paste, drag and drop, or any other tool to copy files. 2. Copy the WAR project's source code folder, located in the <source_home>\xpetstore-ejb\web\xpetstore, directory to the xpetstore-ejb_WEB project's src\xpetstore folder in the Rational Application Developer V7.5 workspace. 3. Copy the test project's source code folder, located in the <source_home>\xpetstore-ejb\test\xpetstore directory, to the xpetstore-ejb-test project's JavaSource\xpetstore folder in the Rational Application Developer V7.5 workspace. 4. In the Navigator view, select all four projects, right-click and select Refresh. This refreshes the project structure from the file system and displays the files you just copied. 5. Click Project Build All in the menu. Rational Application Developer V7.5 reports errors in the Problems view for the WAR and test projects because it cannot find the source code for the EJBs. 6. Fix the errors by specifying that the project depends on the EJB project. Right-click the xpetstore-ejb_WEB project and choose Properties from the menu. 7. From the Properties window, select Java Build Path Projects and select the xpetstore-ejb_EJB project from the list. Click OK. 8. The test project also references code located in the EJB project, so repeat steps 5 through 7 for the test project. 9. Click Project Build All from the menu. The Problems view in Rational Application Developer V7.5 now contains only warnings about imports that are not used. You should still see two broken links warnings; we do not fix these because they are trivial.
178
XDoclet automatically generates the source code for EJB local and remote interfaces and the value objects when we create an xPetstore EJB build. This source code must be imported separately because it is located in a separate folder. To do so, perform the following steps: 1. Open the ejbModule folder in the EJB project. For each class file in the folder, verify that there is a corresponding Java source file in the same directory. If the source file is missing, it means that the files generated by Ant using XDoclet needs to be copied from the <source_dir>\xpetstore-ejb\build\java directory to the xpetstore-ejb_EJB EJB projects corresponding directories. 2. Once finished, click Project Build All in the menu. You should see no errors in the Problems view. The xPetstore EJB source code is now imported into the new development environment. You can now remove all XDoclet tags from the source code and create a new Ant script to automate the build script.
179
Generate a new database schema for xPetstore EJB by using the top-down approach, using the following procedure: 1. In the Enterprise Explorer view in Rational Application Developer V7.5, right-click the xpetstore-ejb_EJB project. 2. Navigate to Java EE EJB to RDB Mapping(1.x-2.x) Generate Map from the context menu. 3. Choose Create a new backend folder and click Next. 4. Select Top-Down from the list of options and click Next. 5. On the next page, specify the values in Table 6-33. Click Finish.
Table 6-33 Database configuration for wizard Parameter Target database Database name Schema name Value DB2 for Linux, UNIX and Windows V9.5 wl_xp_ej NULLID
You can see the same folder structure in the Navigator view, as in Figure 6-43.
180
6. Verify that the back end is active by double-clicking the ejb-jar.xml file in the Navigator view. This opens the Deployment Descriptor Editor. 7. On the Overview tab, scroll down to the Backend ID section and verify that it is using DB2 V9.5. In the following section, we use the Table.ddl file that was generated by the wizard to create the database schema.
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0286N A default table space could not be found with a page size of at least "8192" that authorization ID "DB2ADMIN" is authorized to use. SQLSTATE=42727
181
You need to import the xPetstore data. We used a modified version of the original data.sql file because the database column names have changed in this new schema. 1. Open the <source_home>\xpetstore-ejb\sql\data.sql file in an editor. 2. Rename all the table names to match the new schema (Table.ddl). This means removing T_ from all table names. 3. Change the LISTPRICE and UNITCOST columns datatype, because they are defined as DOUBLE in the new database schema and as VARCHAR in the data script. This is done by removing the single quotes from all the INSERT commands for the ITEM table, so that the column values are defined as illustrated in Example 6-4.
Example 6-4 Updated INSERT statement
INSERT INTO ITEM VALUES ('EST-1', 'Large', 16.50, 10.00, 'fish1.jpg', 'FI-SW-01'); 4. Rename the modified file to data2.sql 5. Import the data by issuing the following commands from a DB2 CLP window: db2 connect to wl_xp_ej user db2admin using db2adm1n db2 -tvf <source_home>\xpetstore-ejb\sql\data2.sql
182
4. Expand the JSP Conversion tree and right-click the customerEditor.jsp Avoid using a .jsp extension for JSP fragments rule violation. From the context menu select QuickFix. The Refactoring dialog box (Figure 6-45) is displayed.
5. Select the first fix to rename the file and click Finish. 6. Repeat step 5 for the remaining three JSP files.
183
7. Click the XML File Review tab and expand the Use WebSphere bindings to define EJB JNDI names category. See Figure 6-46.
8. Right-click the weblogic-ejb-jar.xml entry file. From the context menu, select Quick Fix. This creates the appropriate JNDI names in the corresponding WebSphere binding file. 9. Repeat step 8 for the remaining rules under the same category. 10.Still within the XML File Review tab, click the Use WebSphere binding to define EJB reference names category. From the context menu select Quickfix All. 11.Repeat step 10 for the Use WebSphere bindings to define Message Driven beans JNDI names and Use WebSphere bindings to define resource reference names categories. 12.Right-click the Use WebSphere extensions to define CMP mappings rule and select Ignore Results. We are ignoring this rule because we already created the back-end folder and mapped the CMP beans to their corresponding database tables and columns. 13.Handle the WebLogic specific EJB query tags. The migration tool does not provide a quick fix for converting WebLogic EJB query tags to the corresponding WebSphere at this point.
184
14.Review the help for the WebLogic Query language constructs by highlighting one of the rules and pressing the F1 function key. This launches the help. Click See Details link from the help. 15.Double-click the first rule under the Do not use WebLogic specific EJB Query language category. This shows you the weblogic-ql construct. You should see the token AS that is used. It is a WebLogic construct and not an ejb-ql construct. The token needs to be removed from the query. See Figure 6-47.
16.Remove the AS from the query and save the file. 17.Repeat this step for the remaining two occurrences in the file as indicated by the migration tool. 18.Return to the analysis tab and right-click the weblogic-ql rules and select Ignore Result. This removes it from the view. It also enters a comment in the weblogic-cmp-rdbms-jar.xml file to tell the analyzer to ignore the next iteration. 19.Save and close the deployment descriptor file. 20.n the XML Review tab, expand the WebLogic specific files category and expand all sub-options. Those are the WebLogic-specific deployment descriptors files. Delete them, because we migrated all of their entries to the corresponding WebSphere binding files. 21.n the Enterprise Explorer view, expand the EJB project and browse to /xpetstore-ejb_EJB/ejbModule/META-INF folder and delete the following files: weblogic-ejb-jar.xml weblogic-cmp-rdbms-jar.xml
185
186
5. Click the Built-in Mail Provider link. Click Mail Sessions in the Additional Properties section. Create a new mail session using the values in Table 6-34.
Table 6-34 JavaMail session configuration Parameter Name JNDI name Server Protocol Value xPetstoreMail mail/xpetstore/MailSession localhost SMTP
187
Create the JDBC provider, data source and J2C authentication alias. The steps to do this follow. 1. From the administration console, select Resources JDBC DBC providers. 2. In the Scope drop-down menu select Node=<Node-name>. 3. Click New to create a new JDBC provider using the values in Table 6-35.
Table 6-35 JDBC provider configuration Parameter Database type Provider type Implementation type Value DB2 DB2 Universal JDBC Driver Provider XA datasource
4. Save the changes and double click the JDBC provider you just created. 5. Click Data sources in the Additional properties section and create a new data source with the characteristics shown in Table 6-36.
Table 6-36 JDBC data source configuration Parameter Name JNDI Name Driver type Host name Port Database name Value Petstore Datasource jdbc/xpetstore 4 localhost 50000 wl_xp_ej
6. Click Finish. Save the changes. 7. Click JAAS J2C authentication data in the Related Items section.
188
8. Click New, and create a new alias using the information shown in Table 6-37.
Table 6-37 J2C Alias Configuration Parameter Alias User ID Password Value xpetstoreAuthData db2admin db2adm1n
9. Click Apply. 10.Click OK and go back to the data source you just created. From the Component-managed authentication alias drop-down menu, select the J2C alias you created. 11.Click Apply. Save your changes. 12.Verify the connection to the database by selecting the data source you just created from the list and clicking Test connection.
Configuring JMS
WebSphere Application Server V7 comes has default messaging provider that is based on JMS specification 1.1. We use the default messaging provider to create the messaging resources required by the xpetstore application. This section has several steps, broken in to the following subsections: Creating a new service integration bus on page 190 Creating a bus member on page 190 Creating a bus destination on page 190 Creating a JMS connection factory on page 191 Creating JMS queues on page 191 Creating a JMS activation specification for the JMS queues on page 192 Configuring Message Driven beans on page 193
189
190
191
4. Click OK and create the second JMS queue in the same way with the characteristics shown in Table 6-40.
Table 6-40 Order queue configuration Parameter Name JNDI name Bus name Queue name Value xPetstore Order Queue jms/queue/order bus xPetstoreQueue
192
5. Create a second JMS activation specification in the same way with the characteristics shown in Table 6-42.
Table 6-42 Mailer MDBs JMS activation specification configuration Parameter Name JNDI name Destination JNDI name Bus Value xPetstore Mail Activation eis/xPetstoreMailActivation jms/queue/mail bus
You now have all the necessary components for JMS messaging configured. The next step is to configure the MDBs to use the JMS activation specification and queues.
193
3. Select the bean tab. You should see a window similar to Figure 6-48.
4. Select the OrderProcessor MDB from the list of EJBs. In the WebSphere Bindings section, select JCA Adapter and specify the values shown in Table 6-43.
Table 6-43 OrderProcessor MDBs WebSphere binding configuration Parameter ActivationSpec JNDI name Destination JNDI name Value eis/xPetstoreOrderActivation jms/queue/order
You have now configured the MDB to use the JCA activation specification and Destination you configured in the previous section. Tip: Every time you make changes in the Deployment Descriptor, save those updates by pressing Ctrl+S.
194
5. Select the Mailer MDB in the list of EJBs. In the WebSphere Bindings section, select JCA Adapter and specify the values in Table 6-44.
Table 6-44 Mailer MDBs WebSphere binding configuration Parameter ActivationSpec JNDI name Destination JNDI name Value eis/xPetstoreMailActivation jms/queue/mail
You have now completed the configuration of the MDBs and JMS messaging.
4. Repeat the previous step for each EJB in the list, except for the MDBs. Specify a unique JNDI name for each EJB in the following format: ejb/<BeanName>Local
195
Figure 6-49 Resource reference page in the EJB Deployment Descriptor editor
196
2. Expand the Petstore bean by clicking the plus sign next to it. Select ResourceRef jms/xpetstore/QueueConnectionFactory from the list and specify the values shown in Table 6-47 the WebSphere Bindings section:
Table 6-47 Petstore EJBs WebSphere bindings Parameter JNDI name Value jms/xpetstore/QueueConnectionFactory
3. Select ResourceRef jms/queue/xpetstore/order from the list and specify the values shown in Table 6-48 in the WebSphere Bindings section.
Table 6-48 Order EJBs WebSphere bindings Parameter JNDI name Value jms/queue/order
4. Expand the OrderProcessor bean, select ResourceRef jms/xpetstore/QueueConnectionFactory and specify the values shown in Table 6-49 in the WebSphere Bindings section.
Table 6-49 OrderProcessor EJBs WebSphere bindings Parameter JNDI name Value jms/xpetstore/QueueConnectionFactory
5. Expand the OrderProcessor bean and select ResourceRef jms/queue/xpetstore/mail and specify the values shown in Table 6-50 in the WebSphere Bindings section.
Table 6-50 OrderProcessor EJBs WebSphere bindings Parameter JNDI name Value
jms/queue/mail
6. Expand the Mailer bean and select ResourceRef mail/xpetstore/MailSession and specify the values shown in Table 6-51 in the WebSphere Bindings section.
Table 6-51 Mailer EJBs WebSphere bindings Parameter JNDI name Value
mail/xpetstore/MailSession
197
6.6.4 Summary
While migrating the xPetstore EJB application, we were able to redeploy it from Oracle WebLogic Server 9.2 into the WebSphere Application Server V7 without changing much of the Java code. We had to update the deployment descriptors, including the mappings of CMP EJBs to the database. This is a sound statement for J2EE portability. Lessons and best practices learned in this migration are discussed in more detail in Appendix A, Development practices for portable applications on page 325.
198
Chapter 7.
199
200
4. Add Java and Ant executables to your path by appending the following code to your PATH user variable or creating a new one if it does not exist: PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin 5. Verify environment variables and Ant installation by opening a new command prompt and checking the outputs of the following commands: java -version ant -version Output shall present the current versions of the tools.
201
jbossws-native-saaj.jar jbossws-native-jaxrpc.jar jbossws-native-jaxws.jar jbossws-native-jaxws-ext.jar 5. Verify installation by starting the server with the run.bat command.
202
203
204
Additional information about this sample application and the download URL can be found at the sample application wiki page: http://community.jboss.org/wiki/SampleJSF-EJB3Application 2. Extract the downloaded archive file to a suitable location. In our case, we used C:\gettingstarted. Hereafter, this is referred to as <jsfejb_home>. 3. Open a command prompt and change to the directory containing the sample application code: <jsfejb_home>\jsfejb3. 4. Build and deploy the sample application by issuing the ant command in the <jsfejb_home>\jsfejb3 folder. The build script terminates successfully with the message BUILD SUCCESSFUL. 5. Open another command prompt and start your JBoss Application Server version 4.2.3 by executing the <jboss4_home>/bin/run.bat command. 6. Copy the jsfejb3.ear file in <jsfejb_home>\build\jars folder to the <jboss_home>\server\default\deploy folder. 7. Point your browser to the following address and test the sample application generating, editing and deleting a couple of TODO items: http://localhost:8080/jsfejb3/
205
3. In the Enterprise Application Import window, browse to the location of the EAR file generated by the ant build, which might be found at the following location: <jsfejb_home>\jsfejb3\build\jars\jsfejb3.ear See Figure 7-1. Click Next to continue.
4. On the Enterprise Application Import window, click Next to continue without selecting jsf-facelets.jar to be imported as a utility project.
206
5. Click Finish on EAR Module and Utility JAR Projects window. The Import wizard runs and creates the necessary project and module structure. See Figure 7-2. Configuring precompiled Java archive (JAR) libraries: We do not have to configure precompiled Java archive (JAR) libraries for the web module or at the EAR level when we use the Import wizard to create the project and module structure. This is done automatically by the Import wizard when importing an EAR file.
207
6. Import the Java source code for the app_EJB module. Expand the project tree in the Enterprise Explorer view and investigate the Imported Classes node. This node lists packages that were imported in a compiled form. Tip: While searching for classes to replace with their respective source files, the following rules apply: In a EJB module, classes might be found in the Imported Classes folder. In a web module, classes might be found under WEB-INF/classes. (While importing from JBoss, also check the WebContent node for classes). 7. The left side of Figure 7-3 shows the class files in our EJB module. We have three classes (in the ImportedClasses folder) in the default package. Import the respective source files for these classes as shown on the right side of Figure 7-3. Click and select ejbModule, then select File Import. from the main menu.
Figure 7-3 Before and after we replace class files with respective source files in EJB module
Note: While importing source files to replace classes imported by import wizard, following rules apply: In an EJB module, source files shall be added under ejbModule node. In a web module, source files shall be added under Java Resources/src node.
208
8. On the Import window, select General File System. The File system import window is displayed. Click Browse and select the folder containing the source code for our project, <jsfejb_home>\jsfejb3\src. 9. Select the source files for the three classes in the ImportedClasses folder: Todo TodoDao TodoDaoInt See Figure 7-4. Click Finish.
10.Because we have imported source codes, we want to remove classes imported by the wizard in binary form. Click and select the default package in the ImportedClasses folder. Selecting File Delete from the main menu displays a delete confirmation dialog box. Click OK. The EJB module, at this moment, looks like the right side of Figure 7-3 on page 208.
209
11.Import source code for the web module. As can be seen in Figure 7-5, we must replace TodoBean class with its source code. Click and select Java Resources/src under the web module, then select File Import from the main menu.
Figure 7-5 Before and after we replace class file with respective source file in web module
12.On the Import window, selecting General File System displays the File System Import window. Click Browse and select the folder containing the source code of our project, <jsfejb_home>\jsfejb3\src. 13.Select the source file for the TodoBean class. Click Finish. 14.Click TodoBean.class under WebContent. Select File Delete from the main menu. Click OK on the deletion confirmation dialog box that is displayed. The web module, at this moment, looks like the right hand side of Figure 7-5.
210
211
Short form remote interfaces and homes Long form local interfaces and homes
To fix the JNDI name in accordance with the aforementioned patterns, perform the following steps: 1. Modify TodoBean.java at the web module by replacing the jsfejb3/TodoDao/local JNDI name string with ejblocal:TodoDaoInt. 2. Save TodoBean.java.
212
There are several approaches on how to include these libraries, including packaging within the application archive file, or using shared libraries. For this sample application, we package external libraries into our application archive. Using shared libraries is demonstrated in the next migration samples. Table 7-2 gives a list of libraries and from where to import them.
Table 7-2 Additional runtime libraries Library antlr.jar cglib.jar concurrent.jar dom4j.jar hinernate3.jar hibernate-annotations.jar hibernate-entitymanager.jar javassist.jar jboss-common.jar log4j.jar Location <jbossV4_home>\server\default\lib <jbossV4_home>\server\default\lib <jbossV4_home>\lib <jbossV4_home>\server\default\lib <jbossV4_home>\server\default\lib <jbossV4_home>\server\default\lib <jbossV4_home>\server\default\lib <jbossV4_home>\server\default\lib <jbossV4_home>\lib <jbossV4_home>\server\default\lib
We import these jar files into EAR module root folder by performing the following steps: 1. Select the top level jsfejb3 application module. 2. Launch the Import wizard by navigating to File Import from the main menu. 3. On the Import window, select General File System to display the File system import window. Click Browse and select the folder containing the libraries to be imported. Select the libraries and Click Finish.
213
4. Repeat steps 1 on page 213 3 on page 213 for the two folders indicated in Table 7-2 on page 213. When this is complete, the application module looks like Figure 7-7.
5. Add dependencies to the EJB module to make the imported libraries available to this module. Click the app_EJB module and open the Properties window by pressing Ctrl+Enter.
214
6. Select Java EE Module Dependencies from list on the left. Select the check boxes next to each library that was imported. See Figure 7-8. Click OK.
215
216
We can continue editing by clicking the source tab of the editor and continue working. To fix this problem perform the following steps: 1. Switch to the source view of Persistence XML Editor. 2. Add grammar information to persistence.xml file by replacing the line containing <persistence> with the text in Example 7-2.
Example 7-2 Replacement grammar information
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> From this point on, use either the graphical Persistence XML Editor, or continue working on the source tab. For simplicitys sake, we give instructions using source view. 3. Perform the following steps to use the WebSphere default data source that uses internal Derby provider: a. Change the name of the jta-data-source property from java:/DefaultDS to DefaultDatasource b. Change the value attribute of hibernate.dialect property from org.hibernate.dialect.HSQLDialect to org.hibernate.dialect.DerbyDialect. 4. Add following property to the properties list: <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLook up" /> Note: For more information about using Hibernate with WebSphere, see the developerWorks article Using Spring and Hibernate with WebSphere Application Server at following web page: http://www.ibm.com/developerworks/websphere/techjournal/0609_alco tt/0609_alcott.html
217
5. Two modifications on resources other than persistence.xml are necessary because of the behavior of DerbyDialect on identity columns in this version of Hibernate. Perform the following steps to make these modifications: a. In the source code of Todo.java, add an identity generation strategy by replacing the line @Id @GeneratedValue with @Id @GeneratedValue(strategy=GenerationType.IDENTITY. This change requires the import of the javax.persistence.GenerationType class. Add it manually at imports section or use the quick fix feature. b. Because the identity column is automatically generated, modify the insert statements in the app_EJB\ejbModule\import.sql file, which is used to populate database before first use. Modify each insert line by removing the ID column and value. The Insert statement shall look as follows: insert into Todo ( title, description) values ( 'This is a title', 'The description is here!') 6. Modify the application class loading mechanism. by performing the following steps: a. Click the jsfejb3 application module. Right-click and select Java EE Open WebSphere Application Server Deployment. b. Scroll down to Application section and change the Classloader mode field to PARENT_LAST. See Figure 7-10 on page 219.
218
Figure 7-10 Configuring class loading for third party persistence providers
c. Click File Save from main menu. Note: This is done because we are using a third party persistence provider. More information about using third party persistence providers can be found at the following web page: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?t opic=/com.ibm.websphere.nd.doc/info/ae/ae/tejb_jpa3rdparty.html
219
Figure 7-11 Software Analyzer configuration with JBoss migration rule set
220
5. Click Analyze. After the analysis is complete, the Software Analyzer Results view is displayed, docked to the bottom panel. In the Software Analyzer Results view, you can see a tab for each domain of analysis. In our case, we see a tab for Java Code Review, XML File Review, and Class-path Review. 6. Expand the XML file review section and the results in this section. Remove the jsfejb3\META-INF\jboss-app.xml file by Delete. See Figure 7-12.
7. Expand the class-path review section and the results in this section. See Figure 7-13.
8. Right-click one of the result lines and click Quick fix all. 9. Run the Software Analyzer again to ensure no more warnings are generated.
221
222
2. Select the target specification level using the J2EE version drop-down menu. See Figure 7-14. Because we are already at level 1.4, the only choice presented is 5.0. Click Finish.
223
3. A summary dialog box (Figure 7-15) is displayed, which reports that migration was completed successfully.
We have migrated our web module from Servlet specification version 2.4 to 2.5, as can be seen in Figure 7-16.
224
Roll back the classloading configuration changes we have performed for the third-party JPA provider and modify the persistence.xml file: 1. Click and select the jsfejb3 application module. Right-click, and select Java EE Open WebSphere Application Server Deployment. 2. Scroll down to Application section and change Classloader mode to PARENT_FIRST, cancelling the change we performed before, as can be seen at Figure 7-10 on page 219. 3. Open the persistence.xml file in an editor by double-clicking it at app_EJB/ejbModule/META-INF/persistence.xml. 4. Remove the provider element. Also remove all property elements. 5. Add the following property element to the properties element: <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> This property instructs OpenJPA to attempt to run the mapping tool on all persistent classes to synchronize their mappings and schema at runtime, creating tables at our database. 6. Save the persistence.xml file using File Save. 7. To deploy the modified application to the server, click the Servers tab at the bottom. Right-click the server instance and select Publish from the context menu. 8. Click the app_WEB\WebContent\index.html file. Right-click and select Run As Run. Test the application with the default persistence provider.
7.3.10 Summary
While migrating the JSF-EJB3 TODO sample application, we were able to demonstrate the following concepts: Source migration to Rational Application Developer for WebSphere Software as a build and test environment. Use of WebSphere Application Server Migration Tool v1.1 for Rational Application Developer. Note that JBoss migration support in this tool is limited at the time of writing, but increasing rapidly. Use of Rational Application Developer for WebSphere Software Specification Level Migration to migrate modules further to newer specification levels when imported. Migrating from third-party JPA providers to WebSphere Open JPA built-in provider.
225
The main points to highlight during this migration are as follows: Differences in default JNDI bindings require rework on JNDI lookups. Libraries that ship with JBoss Application Server distributions and not with WebSphere Application server create additional runtime dependencies that must be taken care of. Different built-in data sources used in this example made it necessary to modify persistence setting such as Hibernate dialect and key generation strategy. Using Hibernate for persistence requires transaction strategy configuration specific to WebSphere. Using a third-party JPA provider requires changes to the classloading configuration.
226
227
6. Select dbuser from user list. Right-click to open context menu and click Properties. 7. Click the Member Of tab. 8. Click Add. 9. Select the DB2ADMNS group. 10.Click Apply, and OK. Next, we create a new database and a new table for this user:. Perform the following steps to do so: 1. Click Start and select Programs IBM DB2 DB2Copy1 (default) Command Line Tools Command Editor. 2. Enter the code in Example 7-3 to the command area.
Example 7-3 Code snippet
CREATE DATABASE TESTDB; CONNECT TO TESTDB USER DBUSER USING passwd; CREATE TABLE "DBUSER"."BOOK" ( "ISBN" VARCHAR(13) NOT NULL, "TITLE" VARCHAR(100) NOT NULL, "AUTHOR" VARCHAR(100) NOT NULL ); ALTER TABLE "DBUSER"."BOOK" ADD CONSTRAINT "PRIM_KEY" PRIMARY KEY ("ISBN");
228
3. Click Execute. A progress indicator is displayed. After the operations are completed, the results view displays the output, as in Figure 7-17. 4. Close the Command Editor.
229
C:\jboss-seam-2.2.1.CR1>seam setup SEAM_HOME: C:\jboss-seam-2.2.1.CR1 Using seam-gen sources from: C:\jboss-seam-2.2.1.CR1\seam-gen Buildfile: C:\jboss-seam-2.2.1.CR1\seam-gen\build.xml init: setup: [echo] Welcome to seam-gen 2.2.1.CR1 :-) [echo] Answer each question or hit ENTER to accept the default (in brackets ) [echo] [input] Enter the directory where you want the project to be created (should not contain spaces) [C:/Projects] [C:/Projects] [input] Enter your JBoss AS home directory [C:/Program Files/jboss-5.1.0.GA] [C:/Program Files/jboss-5.1.0.GA] C:\jboss-5.1.0.GA [input] Enter your JBoss AS domain [default] [default] [input] Enter your GlassFish V2 or V3 home directory (Ignore if you aren't d eploying to GlassFish) [C:/Program Files/glassfish-v2.1] [C:/Program Files/glass fish-v2.1] [input] Enter your GlassFish domain (Ignore if you aren't deploying to Glass
230
Fish) [domain1] [domain1] [input] Enter the project name [myproject] [myproject] [echo] Accepted project name as: myproject [input] Do you want to use ICEfaces instead of RichFaces? [n] (y, [n]) [input] skipping input as property icefaces.home.new has already been set. [input] Select a RichFaces skin [glassX] (blueSky, classic, darkX, deepMarin e, DEFAULT, emeraldTown, [glassX], japanCherry, laguna, ruby, wine) [input] Is this project deployed as an EAR (with EJB components) or a WAR (w ith no EJB support)? [war] (ear, [war]) ear [input] Enter the base package name for your Java classes [com.mydomain.mypr oject] [com.mydomain.myproject] [input] Enter the Java package name for your session beans [com.mydomain.myp roject.action] [com.mydomain.myproject.action] [input] Enter the Java package name for your entity beans [com.mydomain.mypr oject.model] [com.mydomain.myproject.model] [input] Enter the Java package name for your test cases [com.mydomain.myproj ect.test] [com.mydomain.myproject.test] [input] What kind of database are you using? [hsql] ([hsql], mysql, derby, o racle, postgres, mssql, db2, sybase, enterprisedb, h2) db2 [input] Enter the filesystem path to the JDBC driver jar [] [] C:/Program Files/IBM/SQLLIB/java/db2jcc.jar [input] Enter the filesystem path to the license jar [] [] C:/Program Files/IBM/SQLLIB/javadb2jcc_license_cu.jar [input] Enter the Hibernate dialect for your database [org.hibernate.dialect .DB2Dialect] [org.hibernate.dialect.DB2Dialect]
231
[input] Enter the JDBC driver class for your database [com.ibm.db2.jcc.DB2Dr iver] [com.ibm.db2.jcc.DB2Driver] [input] Enter the JDBC DataSource class for your database [com.ibm.db2.jcc.D B2SimpleDataSource] [com.ibm.db2.jcc.DB2SimpleDataSource] [input] Enter the JDBC URL for your database [jdbc:db2:test] [jdbc:db2:test] jdbc:db2://localhost:50000/TESTDB [input] Enter the database username [sa] [sa] dbuser [input] Enter the database password [] [] passwd [input] Enter the database schema name (Enter '-' to clear previous value) [ ] [] dbuser [input] Enter the database catalog name (Enter '-' to clear previous value) [] [] [input] Are you working with tables that already exist in the database? [n] (y, [n]) y [input] Do you want to recreate the database tables and execute import.sql e ach time you deploy? [n] (y, [n]) [propertyfile] Creating new property file: C:\jboss-seam-2.2.1.CR1\seam-gen\buil d.properties [echo] Installing JDBC driver jar to JBoss AS [copy] Copying 1 file to C:\jboss-5.1.0.GA\server\default\lib init: init-properties: [echo] C:/jboss-5.1.0.GA validate-workspace:
232
validate-project: settings: [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo] [echo]
JBoss AS home: C:/jboss-5.1.0.GA GlassFish home: C:/Program Files/glassfish-v2.1 Project name: myproject Project location: C:/Projects/myproject Project type: ear IceFaces: n Action package: com.mydomain.myproject.action Model package: com.mydomain.myproject.model Test package: com.mydomain.myproject.test JDBC driver class: com.ibm.db2.jcc.DB2Driver JDBC DataSource class: com.ibm.db2.jcc.DB2SimpleDataSource Hibernate dialect: org.hibernate.dialect.DB2Dialect JDBC URL: jdbc:db2://localhost:50000/TESTDB Database username: dbuser Database password: passwd Type 'seam create-project' to create the new project
BUILD SUCCESSFUL 3. Enter the seam new-project command to generate a new project. Command ends with a BUILD SUCCESSFUL message. 4. Enter the seam generate-entities command to generate the components for our database table. Command ends with a BUILD SUCCESSFUL message. 5. Enter the seam deploy command to deploy the application to JBoss Application Server. Command ends with a BUILD SUCCESSFUL message. At this stage our application is packaged as an EAR file and has been copied to deployment directory of JBoss Application Server.
233
234
235
3. In the Enterprise Application Import window, browse to the location of the EAR file generated by seam-gen, which can be found at C:\Projects\myproject\dist\myproject.ear. See Figure 7-19. The location of this file is determined by the choices we made during seam setup script execution. Click Next.
236
5. On the EAR modules and utility jar projects window, clear the check boxes next to each library, except myproject.jar and myproject.war. See Figure 7-20. Click Finish.
237
6. Import source files to our project structure. Upon inspection we see that the myProject_EJB module has imported classes. Import the source files of these classes to the ejbModule folder and remove the class files from the project. Figure 7-21 shows the module structure before and after source code import.
Figure 7-21 EJB module structure before and after source code import
7. Click the ejbModule node in the myproject_EJB module, and select File Import. 8. Select General File System in the Import window. The File System Import window is displayed. Import source code from two locations: C:\Projects\myproject\src\hot C:\Projects\myproject\src\main
238
9. Click Browse and select the C:\Projects\myproject\src\hot folder containing source code files for the com.mydomain.myproject.action package. Select all source files, as in Figure 7-22. Click Finish.
10.Repeat step 9 also for the C:\Projects\myproject\src\main folder, which contains source code for com.mydomain.myproject.model package. 11.Delete packages under the ImportedClasses node by selecting them, clicking Delete, and confirming deletion. At this point project structure looks like the right side of Figure 7-21 on page 238. Analyzing the web module, we can see that there are no imported classes that we must replace with source files. Resources such as html and xhtml files, stylesheets and images are imported automatically during EAR import.
239
Figure 7-23 Before and after libraries in EAR moved to shared library
240
4. Paste the copied libraries to <shared_lib_dir>. 5. Delete the selected libraries from EAR module by selecting Delete from context menu. The result is the project structure shown on the right side of Figure 7-23 on page 240. Notice that we do not move myproject.war and myproject.ear. These files are refreshed as corresponding module projects are built. 6. Open the application deployment descriptor by clicking myproject/META-INF/application.xml. 7. In the Overview section of the Application Deployment Descriptor Editor, select the line EJB: jboss-seam.jar and click Remove. 8. Save your changes by selecting File Save from main menu. 9. Select Java EE Update EAR Libraries from the myproject module context menu. There are additional dependencies. These are the libraries that are shipped with JBoss Application Server, but are not a part of WebSphere Application Server distribution. These libraries are also included in our generated project, so we can copy them from our project. For our project, the additional dependencies in Table 7-3 must be copied to <shared_lib_dir> from C:\Projects\myproject\lib.
Table 7-3 .Shared dependencies to be copied antlr.jar commons-collections.jar dom4j.jar hibernate-commonsannotations.jar hibernate-validator.jar jboss-common-core.jar log4j.jar resteasy-jaxrs.jar bsh.jar commons-logging.jar gwt-servlet.jar hibernate-core.jar javassist.jar jboss-seam.jar myproject.jar slf4j-api.jar cglib-nodep.jar concurrent.jar hibernate-annotations.jar hibernate-entitymanager. jar jaxrs-api.jar jboss-seam-flex.jar myproject.war slf4j-log4j12.jar
10.Click the myproject application module. Right-click and select Java EE Open WebSphere Application Server Deployment to display the WebSphere Application Server Deployment window. 11.Scroll down to Shared Library section. Expand the section and click Add. 12.Fill in the Name and Description fields. We used SeamSharedLibs as the shared library name.
241
13.Click Browse on the Class Path section of the window. A file selection dialog box is displayed (Figure 7-24). Using the dialog box, select <shared_lib_folder> and click OK.
We must modify the application class loading mechanism because we are using a third party persistence provider. More information about using third party persistence providers might be found at the following web page: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topi c=/com.ibm.websphere.nd.doc/info/ae/ae/tejb_jpa3rdparty.html 14.Scroll down to Application section and change the Classloader mode to PARENT_LAST. 15.Type CTRL+S to save your changes. 16.While shared library resolves runtime dependencies, the myproject_EJB module also has compile time dependencies on the libraries we moved to the shared library. To resolve the compile time dependencies, select the myproject_EJB module, right-click and select Build Path Configure Build Path. 17.Select the Libraries tab in the Java Build Path window. Click Add External JARs. A file selection dialog box is displayed. 18.Navigate to <shared_lib_folder> and select the following libraries to add to build path: jboss-seam.jar hibernate-validator.jar
242
20.Select Project Clean to rebuild the project. No compile time errors remain.
243
For our project, we use strategy 1, as explained on the aforementioned document. We add @JndiName annotation to session beans, create a seam-specific properties file (the content of which is specified in the Seam documentation), change JNDI matching pattern at components.xml, and add an EJB reference for LocalEJBSynchronizations. Perform the following steps to accomplish these tasks: 1. Start by annotating session beans with the @JndiName annotation. Our single session bean is AuthenticatorBean at myproject_EJB/ejbModule/ com.mydomain.myproject.action.AuthenticatorBean.java. Open this file in the editor. 2. Add the following line between the @Name annotation and the class declaration line: @JndiName("ejblocal:com.mydomain.myproject.action.Authenticator") Note: JndiName uses the name of the localinterface class instead of bean class name. 3. This annotation requires the org.jboss.seam.annotations.JndiName class to be added to imports. Use quick fix on annotation by pressing CTRL+1 on the @JndiName annotation and clicking the Import JndiName option. 4. Open the myproject_WEB/WebContent/WEB-INF/components.xml file in the editor. Replace <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/> with <core:init debug="false" jndi-pattern="java:comp/env/#{ejbName}"/> 5. Create a new file named seam-jndi.properties at myproject_WEB/Java Resources/src. Content of this file is described in the Seam documentation. Copy the contents from the documentation to the generated file and save your changes. Tip: Seam documentation states that the seam-jndi.properties file shall be created at WEB-INF/classes/seam-jndi.properties in the web module. Because this folder is not visible in Rational Application Developer for WebSphere Software, use the src folder, because non-Java resources in this folder are copied to the classes folder during build. 6. Open the myproject_WEB/WebContent/WEB-INF/web.xml file in the editor. Switch to the source tab for easier editing.
244
7. Add the snippet in Example 7-5 inside the web-app element as the last element and save your changes.
Example 7-5 Code snippet
245
5. Select the myproject_EJB check box as shown in Figure 7-26 and click OK to continue.
6. Open the persistence.xml file copied in the editor. Switch to the source tab for faster editing. 7. Add the following snippet to persistence.xml, beneath the <jta-data-source> element: <jar-file>myproject.jar</jar-file> 8. Remove the following line from persistence.xml: <property name="jboss.entity.manager.factory.jndi.name" value="java:/myprojectEntityManagerFactory"/> 9. Add the following line inside the <properties> element in persistence.xml: <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLook up" /> 10.Type CTRL+S to save your changes.
246
11.Fix the persistence unit reference in the web module. Open myproject_WEB/WebContent/WEB-INF/web.xml in the editor. Switch to the source tab. 12.Replace the line <persistence-unit-name>../myproject.jar#myproject</persistence-unitname> with <persistence-unit-name>myproject</persistence-unit-name>.
247
8. Click Add External JARs. A file selection dialog box is displayed. Navigate to the C:\Program Files\IBM\SQLLIB\java folder and select the following JARs and click OK to add. db2jcc.jar db2jcc_license_cu.jar The JDBC provider settings window (Figure 7-27) is displayed. Click Finish.
9. The new JDBC provider is listed in JDBC providers list. Click this line to select DB2 JDBC Provider (XA), and then click Add in the data sources subsection.
248
10.Select DB2 Universal JDBC Driver Provider (XA) in the Create Data Source window (Figure 7-28). Click Next. The Data Source details window is displayed.
11.In the JNDI Name field, enter myprojectDatasource. Remember that this value should match the data source name specified in the persistence.xml file.
249
12.In the Container-managed authentication alias and Component-managed authentication alias fields, select the dbuser authentication alias that we created before using combo box. The window looks like Figure 7-29. Click Next. The Create Resource Properties window is displayed.
250
13.In the Create Resource Properties window (Figure 7-30), select the databaseName Resource Property. In the value field for this property, enter testdb. Select the serverName property. In the value field for this property, enter localhost. Click Finish.
251
14.The Data Sources section of WebSphere Application Server Deployment window now looks like Figure 7-31. Click CTRL+S to save changes.
252
6. Expand the class-path review section and the results in this section.Right-click one of the result lines and click Quick fix all. 7. Run the Software Analyzer again to ensure that no more warnings are generated.
7.4.7 Summary
While migrating our sample seam-gen generated application, we were able to demonstrate following concepts: Source migration to Rational Application Developer for WebSphere Software as a build and test environment. Use of WebSphere Application Server Migration Tool v1.1 for Rational Application Developer. Note that JBoss migration support in this tool is limited at the time of writing, but increasing rapidly. Using shared libraries for managing dependencies. The main points to highlight during this migration are as follows: Differences in default JNDI bindings require rework on JNDI lookups. Seam frameworks requires a fair amount of configuration to work with WebSphere default JNDI bindings. Libraries that ship with JBoss Application Server distributions and not with WebSphere Application server create additional runtime dependencies that shall be taken care of.
253
Using Hibernate for persistence requires transaction strategy configuration specific to WebSphere. Using a third-party JPA provider requires changes classloading configuration.
254
4. Analyze and fix problems reported by the build environment. 5. Build the Online Brokerage sample application using IBM Rational Application Developer for WebSphere Software. Deploy and test the application on the integrated WebSphere Application Server V7 test environment.
255
CREATE DATABASE BRKRGDB; CONNECT TO BRKRGDB USER DBUSER USING passwd; CREATE TABLE "DBUSER "."USERS" ( "USERID" VARCHAR(255) NOT NULL , "NAME" VARCHAR(255) , "PASSWORD" VARCHAR(255) , "ADDRESS" VARCHAR(255) , "CASH" DOUBLE ) ; ALTER TABLE "DBUSER ADD PRIMARY KEY ("USERID"); "."USERS"
CREATE TABLE "DBUSER "."STOCKS" ( "ID" VARCHAR(255) NOT NULL , "NAME" VARCHAR(255) , "PRICE" DOUBLE ) ; ALTER TABLE "DBUSER ADD PRIMARY KEY ("ID"); "."STOCKS"
CREATE TABLE "DBUSER "."USERSTOCKS" ( "ID" VARCHAR(255) NOT NULL , "USERID" VARCHAR(255) NOT NULL , "NAME" VARCHAR(255) , "PRICE" DOUBLE ,
256
"QUANTITY" INTEGER );
"."USERSTOCKS"
INSERT INTO Users VALUES('srini', '6 Inch', 'cheemu','Madivala Bangalore',10000); INSERT INTO Users VALUES('j2ee', 'Lee Whittaker', 'password','Tampa Florida',100000); INSERT INTO userstocks VALUES('00000001', 'j2ee','BTDA',1,10);
INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT
INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO
stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks stocks
VALUES('00000001','BTDA',1.00); VALUES('00000002','Hitech Software',2.00); VALUES('00000003','Bill s Cold Storage',3.00); VALUES('00000004','Colonel s Fried Chicken',300.00); VALUES('00000005','Toyo Motors',30.00); VALUES('00000006','Timbuctoo Airlines',53.00); VALUES('00000007','Happy Undertakers',73.00); VALUES('00000008','Wacko Brothers',54.00); VALUES('00000009','Mental Studios',456.00); VALUES('00000013','ASFG',54.89); VALUES('00000023','BFG',564.50); VALUES('00000033','Mack',3444.50); VALUES('00000043','Ronan & Sons',7.50); VALUES('00000053','Bulls & Bears',553.40); VALUES('00000343','HGHU',456.00); VALUES('00000603','TTTM',77.00); VALUES('00000463','GRASF',88.00);
257
3. Click Execute. A progress indicator is displayed. After the operations are completed, the results view displays the output, as in Figure 7-32.
258
The third alternative is to import the contents of the HAR file (in our case the com.dev.trade.bo package and hbm.xml files) into a web module with other source code. This results in a simpler project structure, as the web module contains all source code. In the procedures that follow, we demonstrate the second alternative. Follow the steps to do so: 1. Launch Rational Application Developer for WebSphere Software using Start IBM Software Delivery Platform IBM Rational Application Developer 7.5 IBM Rational Application developer. 2. Launch the Import wizard using menu File Import. Expand the JavaEE node in the import source tree and select the EAR file. 3. In the Enterprise Application Import window, browse to the location of the EAR file at <brokerage_home>/jboss-artifact/brokerage.ear. Click Finish. 4. Upon inspection we might see that brokerage_WEB module has imported classes under Java Resources/Libraries/Web App Libraries/ ImportedClasses. We shall import the source files of these classes to the Java Resources/src folder in the same module and remove the class files from the project. Figure 7-33 shows the module structure before and after source code importation.
Figure 7-33 brokerage_WEB module before and after source code import
5. Click the Java Resources/src node in the myproject_EJB module, and select File Import from the main menu.
259
6. In the Import window, select General File System. The File system import window is displayed. Browse to the C:\brokerage\src folder and import the source code as seen on Figure 7-34. Note: We are not importing com.dev.trade.bo package source code, as this package is packaged into the brokerage.har file, and is not a part of the web module.
7. Delete the packages under the Java Resources/Libraries/Web App Libraries/ ImportedClasses node by selecting them hitting Delete, and confirming the deletion. The project structure look like the right side of Figure 7-33 on page 259.
260
261
6. To establish dependencies to resources in the HAR archive, rename the brokerage.har file in the brokerage application module root directory to brokerage.jar, by right-clicking this node and selecting Rename. 7. Open the brokerage_WEB module properties by typing ALT+Enter on this node. 8. Select Java EE Module Dependencies, and switch to the Web Libraries tab on this view. 9. Click Add Jars. The Jar Selection window is displayed. 10.Select brokerage/brokerage.jar and click OK. See Figure 7-35.
262
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <!-- name attribute is used for the JNDI name to be used for lookups --> <hibernate-configuration> <session-factory name="java:hibernate/BrokerageSessionFactory"> <!-- Datasource properties, tailored for DB2 -.-> <property name="connection.datasource">java:comp/env/jdbc/HibernateDB</property> <property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property> <property name="hibernate.default_schema">dbuser</property>
263
<!-- WebSphere specific properties --> <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transac tion.WebSphereExtendedJTATransactionLookup</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JT ATransactionFactory</property> <property name="jta.UserTransaction"> java:comp/UserTransaction</property> <!-- Mapping files (for each hbm.xml file in HAR file) --> <mapping resource="Stock.hbm.xml" /> <mapping resource="UserStock.hbm.xml" /> <mapping resource="User.hbm.xml" /> </session-factory> </hibernate-configuration> The following points relating to Example 7-7 on page 263 require your attention: Notice that name attribute of the session-factory element is used later for looking up session factory. Because we are using IBM DB2 as our test database, we add respective dialect. We add WebSphere specific properties related to transaction strategy configuration according to article at the following web page: http://www.ibm.com/developerworks/websphere/techjournal/0609_alco tt/0609_alcott.html We add a mapping element for each hbm.xml file in our HAR archive. 5. Ensure that the Hibernate session factory defined in the brokerage.cfg.xml file is initialized properly before any part of the code looks up for Hibernate session factory using JNDI. The Online Brokerage application contains a single servlet that acts as a front controller, so a good place to initialize the session factory is the init method of this servlet.
264
Note: For larger applications, using servlets to initialize session factories might not be a feasible solution. In this case use startup beans. Startup beans allow business logic to run when an application starts or stops and gives the opportunity to initialize session factories. Details on how to use startup beans can be found at following web page: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topi c=/com.ibm.websphere.nd.multiplatform.doc/info/ae/asyncbns/tasks/tas b_confstb.html 6. Open TradeDispatcherServlet.java in an editor by double clicking it at brokerage_WEB/Java Resources/ src at com.dev.trade.servlet package. 7. At the init method, after the super.init(); line, add the following line: new Configuration() .configure("brokerage.cfg.xml").buildSessionFactory(); The editor marks the Configuration class as not found. 8. Import the org.hibernate.cfg.Configuration class by clicking CTRL+1 on the configuration and selecting this class in the drop-down list. 9. Save the TradeDispatcherServlet by typing CTRL+S.
265
7. Select the entries in the classpath section and click Remove. 8. Click Add External JARs. A file selection dialog box is displayed. Navigate to the C:\Program Files\IBM\SQLLIB\java folder and select the following JARs: db2jcc.jar db2jcc_license_cu.jar Click OK to add. The JDBC provider settings window looks like Figure 7-36. Click Finish.
At this point the new JDBC provider is listed in JDBC providers list. 9. Click this line to select DB2 JDBC Provider (XA), and then click Add in the data sources subsection. The Create Data Source window is displayed. 10.Select DB2 Universal JDBC Driver Provider (XA). Click Next. The Data Source details window is displayed. 11.In the JNDI Name field, type jdbc/HibernateDB.
266
12.In the Container-managed authentication alias and Component-managed authentication alias fields, select the dbuser authentication alias that we have created before using combo box. The window looks like Figure 7-37. Click Next.
267
13.Resource properties window is displayed. Two values we shall define are databaseName and serverName. Specify brkrgdb for databaseName. Similarly, define localhost for serverName. Click Finish. The Data Sources section of WebSphere Application Server Deployment window now looks like Figure 7-38. Click CTRL+S to save your changes.
14.Attach the data source to the already defined resource reference in the web module. Open the brokerage_WEB module deployment descriptor in the editor by double clicking brokerage_WEB/Deployment Descriptor: brokerage. 15.Switch to the References tab and click Add. The Reference window is displayed. 16.Select Resource Reference and click Next. 17.On the References view, click ResourceRef jdbc/HibernateDB.
268
18.In the WebSphere Bindings section, enter jdbc/HibernateDB in the JNDI name field. See Figure 7-39.
269
270
3. Import com.dev.trade.bo package from <brokerage_home>/src into the brokerage_persistence/src folder using the import wizard. See Figure 7-41.
4. Import hbm.xml files from the <brokerage_home>/hibernate folder into the brokerage_persistence/src folder using the import wizard. At this point, the utility module look like Figure 7-42.
271
6. In the Properties window, select Java EE Module Dependencies. Switch the Web Libraries tab. Clear the dependency to brokerage.jar and select the dependency to brokerage_persistence module. See Figure 7-43. Click OK.
7. Delete persistence.jar from the persistence application module. 8. The migration is complete. Test the application as described at Building and running the application on an integrated test environment on page 253.
272
Summary
While migrating our sample seam-gen generated application, we were able to demonstrate following concepts: Source migration to Rational Application Developer for WebSphere Software as build and test environment. Several alternatives on organizing project structure for Hibernate applications using HAR archives. Configuration of Hibernate for WebSphere. The main points to highlight during this migration are as follows: Using Hibernate for persistence requires transaction strategy configuration specific to WebSphere Initializing session factories is not automatic on WebSphere. We must explicitly initialize session factories by startup beans or other means.
273
274
Chapter 8.
275
8.1 Introduction
Apache Tomcat 6.0.26 is an open source implementation of Suns J2EE web container. It implements Java Servlet and JSP specifications and is used in the official reference implementation for the Java Servlet and JavaServer Pages specifications. Tomcat is developed by a community of developers under the umbrella of the Apache Software Foundation (ASF). Tomcat is widely used by a large number of web sites. It is popular for its small footprint, simplicity, and the large number of toolkits and frameworks that run on it. One of its nice features is that it is open source and is free to use. Applications tend to grow over time and need higher quality of services (QoS) and more sophistication than Tomcat can offer (such as centralized administration for clustered domains, failover, advanced role-based security for users and administrators, script-based administration, advanced monitoring tools, portal infrastructure, page fragment and distributed Java caching, transactions, and so forth). That is why applications need to be redeployed or migrated into enterprise-grade application servers, such as WebSphere Application Server V7. The two applications we have selected for migration are built on top of a number open source frameworks: mvnforum-1.2.1-mvnad-1.0.1 Easy JSP Forum 1.0
276
The following software should be installed before starting the migration: Java SE 6 We use Java SE 6 because it is supported by WebSphere Application Server V7 and we need to make sure our applications work well in this Java virtual machine (JVM). The WebSphere Application Server V7 installation includes Java Development Kit (JDK) 1.6.0, so you do not need to install additional JDKs on your machine. Apache Tomcat 6.0.26 This version was chosen because it was the latest version available at the time of writing this IBM Redbooks publication. The Tomcat home page advises all Tomcat users to upgrade to Tomcat 6.x whenever possible. IBM WebSphere Application Server V7 Before migrating to WebSphere Application Server V7, familiarize yourself with the sample applications shipped with the product. Also, examine the publications listed in Related publications on page 377. IBM UDB DB2 9.5 WebSphere Application Server V7 supports many databases, but we have decided to use DB2 for MvnForum. Instructions on how to install and configure DB2 Universal Database V9.5 can be found in Chapter 5, Installation and configuration on page 87. WebSphere Application Server Toolkit V6.1 WebSphere Application Server Toolkit V6.1 was only used for the Easy JSP Forum. The official distribution available at sourceforge.net is not an enterprise package application model. It is required to import to WebSphere Application Server Toolkit V6.1 to create the EAR file.
277
278
279
The distribution package follows the WAR directory structure. Use a compression tool to create the WAR file. You can go to the distribution directory and select mvnplugin, WEB-INF directories, index_mvnforum.jsp, and index.jsp and create a compressed file with this content. After that, rename it with a WAR extension. We want to show that it is possible to migrate an application, such as MvnForum, to WebSphere Application Server V7 without using an IDE. We also want to demonstrate that it is possible to maintain the original development environment.
db2 create db MVNFORUM db2 connect to MVNFORUM user db2admin using your_password db2 -tvf mvnForum_DB2.sql
280
<driver_class_name>com.ibm.db2.jcc.DB2Driver</driver_class_name> <database_url>jdbc:db2://IBM-6474L1BB23C:50000/MVNFORUM</database_url> <database_user>fxavier</database_user> <database_password>password_here</database_password> 2. Create the WAR file and copy it to the <tomcat_home>\webapps directory. 3. From the command line, change to the Tomcat directory: <tomcat_home>\bin. 4. If you have already deployed MvnForum into Tomcat, stop Tomcat by running the shutdown.bat command. 5. Remove the previously deployed application from the <tomcat_home>\webapps directory. Make sure to remove both the mvnforum.war file and the mvnforum directory (exploded war file). 6. Start Tomcat by running the startup.bat command: You should see no errors in the log if the application was deployed successfully. 7. Make sure that you have JavaScript enabled in your web browser. Tomcat builds a root URI for the web application based on the name of the war file. Therefore, you can access the application at the following URL (assuming you kept default port for the Tomcat installation and did not rename the war file): http://localhost:8080/mvnforum To log in to the application, use username admin and password admin.
281
282
deploy the application in one step. Usually, this is an iterative process, but to simplify the description, we are not showing all intermediate deployments and builds that we performed. Considering that the application works with DB2 using the default connection pool, you need to change the connection pool mechanism. The default connection pool provided in MvnForum is not designed for production use, so you must use the WebSphere-provided connection pool. There are many benefits to using the WebSphere connection pool implementation. The connections are obtained through JNDI from the WebSphere data source and automatically participate in the container-managed transactions of the application server. To implement these changes, we need to update the mvncore.xml configuration file. To use WebSphere Application Server V7 data source we need to change two xml parameters. The file is located in the following directory, and is described in Example 8-3. <source_home>\WEB-INF\classes\mvncore.xml
Example 8-3 Define data source in mvncore.xml
<?xml version="1.0" encoding="UTF-8" ?> - <baseElement> - <dboptions> ... <use_datasource>true</use_datasource> ... <datasource_name>jdbc/dsmvnforum</datasource_name> ... </dboptions> </baseElement> Note: We have only two properties defined here. These are the only properties needed by MvnForum to get connected to the database. When developing an application, you generally do not know about the name of the data source on the target application server. In your code, you do not look up the data source directly. Instead, you look up the resource reference from the java:comp/env namespace file. The JNDI resource jdbc/dsmvnforum is configured in next section.
283
We need also to modify context path and server path to fit the WebSphere webcontainer context and port number. In our case the webcontainer is used in port 9080 and the default context path is /mvnforum/mvnforum. The trusted domains entry should also be changed to fit your environment settings. The trusted domains entry should also be changed to fit your environment settings as shown in Example 8-4.
Example 8-4 Define paths and trusted domains in mvncore.xml
284
3. Click Next. Specify the correct path to the DB2 JDBC driver and click Apply. In our migration example, the path to the JDBC driver is as follows: C:\Program Files\IBM\SQLLIB\java 4. Click Finish, then save the configurations to the master configuration. 5. Click Resources JDBC Data sources. Select the scope and click New. Create a new data source with the characteristics listed in Table 8-2.
Table 8-2 Data Source values Parameter Data source name JNDI Name Value DSMNVFORUM jdbc/dsmvnforum
6. Click Next. 7. Select the Select an existing JDBC provider radio button and select DB2 Universal JDBC Driver Provider. Click Next.
285
8. In the Enter database specific properties for the data source panel, enter the values listed in Table 8-3.
Table 8-3 Database specific properties Parameter Driver type Database name Server name Port number Use this data source in container managed persistence (CMP) Value 4 MVNFORUM ibm-6474l1bb23c 50000 Checked
9. Click Next. 10.In the Setup security aliases panel, click in Next. In next window, review the summary and click Finish. 11.Return to the data source you created, Click JAAS - J2C authentication data in the Related Items panel. 12.Click New. 13.Create a new alias and specify the values listed in Table 8-4.
Table 8-4 J2C alias configuration Parameter Alias UserId Password Value JAASMVNFORUM db2admin your_password
14.Click OK and return to the data source you created. From the Component-managed authentication alias drop-down menu, select the J2C alias you created. 15.Verify the connection to the database. Select the data source you created and click Test connection.
286
3. Select Fast Path - Prompt only when additional information is required. Expand Choose to generate default bindings and mappings, and select Generate Default Bindings. Click Next. 4. In the Step 1: Select installation options window, leave all the default options and click Next. 5. In the Step 2: Map modules to servers window, leave all the default options and click Next. 6. In the Step 3: Map context roots for web modules window, enter /mvnforum in the Context Root field, and click Next.
287
7. In the Step 4: Summary window, click Finish. It might take a minute to deploy the application and validate all mappings. After you are finished, save to the master configuration. Next, start the application. 1. From the WebSphere Administrative Console, click Applications Application Types Enterprise Applications, and select the MvnForum application check box. Click Start. You should see the application started and a green arrow to the right of the application name, as shown in Figure 8-1.
288
289
290
291
The article can be found at the following web page: http://www.ibm.com/developerworks/data/library/techarticle/alazzawe/011 2alazzawe2.html Follow the steps shown in Example 8-5 to create the database and the tables manually.
Example 8-5 Creating the database and the tables
db2 create db EASY db2 connect to EASY user fxavier using your_password ------------------------------------------------- Creation commands for table "FXAVIER "."BOXES" -----------------------------------------------DB2 CREATE TABLE "FXAVIER "."BOXES" ( "BOX_NAME" VARCHAR(100) , "SORT_DESC" VARCHAR(100) , "BOX_ID" INTEGER , "MEMBER_ID" INTEGER ) IN "USERSPACE1" ; ------------------------------------------------- Creation commands for table "FXAVIER "."LEVELS" -----------------------------------------------DB2 CREATE TABLE "FXAVIER "."LEVELS" ( "GRADE" VARCHAR(100) , "MIN_POST" INTEGER , "MAX_POST" INTEGER , "DESCRIPTION" VARCHAR(100) ) IN "USERSPACE1" ; ------------------------------------------------- Creation commands for table "FXAVIER "."MEMBERS" -----------------------------------------------DB2 CREATE TABLE "FXAVIER "."MEMBERS" ( "MEMBER_ID" BIGINT NOT NULL , "USERNAME" VARCHAR(100) NOT NULL , "PASSWORD" VARCHAR(100) NOT NULL , "FIRSTNAME" VARCHAR(100) NOT NULL , "LASTNAME" VARCHAR(100) NOT NULL , "EMAIL" VARCHAR(100) NOT NULL , "REGDATE" VARCHAR(100) NOT NULL , "TYPE" VARCHAR(100) NOT NULL ) IN "USERSPACE1" ; ------------------------------------------------- Creation commands for table "FXAVIER "."THREADS" ------------------------------------------------
292
DB2 CREATE TABLE "FXAVIER "."THREADS" ( "THREAD_ID" BIGINT NOT NULL , "BOX_ID" BIGINT NOT NULL , "PARENT_ID" BIGINT NOT NULL , "MEMBER_ID" BIGINT NOT NULL , "SUBJECT" VARCHAR(100) NOT NULL , "POST_TEXT" VARCHAR(1000) NOT NULL , "POST_DATE" BIGINT NOT NULL ) IN "USERSPACE1" ; Now the table Members needs to be populated to log in the application. Run the commands in Example 8-6 in the DB2 Command Window.
Example 8-6 Populate the table Members
db2 connect to EASY user fxavier using your_password db2 INSERT INTO FXAVIER.MEMBERS VALUES (1,'admin','admin','Forum','Admin','[email protected]','Fri May 07 10:44:38 ICT 2010','Administrator') db2 INSERT INTO FXAVIER.MEMBERS VALUES (2,'mod','mod','Forum','Moderator','[email protected]','Fri May 07 10:44:38 ICT 2010','Moderator') db2 INSERT INTO FXAVIER.MEMBERS VALUES (3,'member','member','Forum','Member','[email protected]','Fri May 07 10:44:38 ICT 2010','Member') The DB2 database setup is now complete.
293
3. Specify the correct path to the DB2 JDBC driver and click Apply. In our migration example, the path to the JDBC driver is C:\Program Files\IBM\SQLLIB\java. Click Finish, then save the configurations to the master configuration. 4. Click Resources JDBC Data Sources, select the scope and click New. Create a new data source with the characteristics in Table 8-7 and click Next.
Table 8-7 Data Source values Parameter Data source name JNDI Name Value EASY jdbc/easy
5. Click the Select an existing JDBC provider radio button and select DB2 Universal JDBC Driver Provider. Click Next.
294
6. In the Enter database specific properties for the data source panel, enter the values shown in Table 8-8, and click Next.
Table 8-8 Database specific properties Value 4 EASY ibm-6474l1bb23c 50000 Checked
Parameter Driver type Database name Server name Port number Use this data source in container managed persistence (CMP)
7. On the Setup security aliases window, click Next. Review the summary in next window and click Finish. 8. Return to the data source you just created, Click JAAS - J2C authentication data in the Related Items panel, and click New. 9. Create a new alias, specify the values shown in Table 8-9, and click OK.
Table 8-9 J2C alias configuration Parameter Alias UserId Password Value JAASEASY fxavier your_password
10.Return to the data source you just created. From the Component-managed authentication alias drop-down menu, select the J2C alias you just created. Click OK and save your configuration. 11.Verify the connection to the database. Select the data source you just created from the list and click Test connection.
295
Open the WebSphere Application Server Toolkit V6.1 and follow these steps: 1. Create a new workspace. 2. Go to File New Project. Expand the web option and select Dynamic Web Project. Click Next. 3. Enter a project name. We entered forum as the project name. Leave the other options as default. Click Finish. 4. In the J2EE perspective right-click the forum folder and Import Import. Expand the General list and select File System and click Next. 5. Select all the folders under the forum folder, as seen in Figure 8-2, and click Finish.
Figure 8-2 Files selection from source_home. Do not select the forum folder.
The application has now been successfully imported to WebSphere Application Server Toolkit V6.1. However, the Easy JSP Forum code is not prepared to use data sources. A source code modification is required to access the DB2 database. The application contains three classes that perform all operations: Members.java Threads.java Boxes.java Add the snippet in Example 8-7 before these class definitions.
Example 8-7 Adding the required packages to access the data source
296
To connect to the data source you need to change the connection parameters as follows. Example 8-8 shows how you should perform this operation.
Example 8-8 Changing the connection parameters
Comment out all entries of the following lines: // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Connection con = DriverManager.getConnection("jdbc:odbc:Forum");import javax.sql.*; Add the following lines after comment out part: Context ctx=new InitialContext(); DataSource ds=(DataSource)ctx.lookup("jdbc/easy"); Connection con=ds.getConnection(); During our tests SQL syntaxes did not work when accessing the DB2 database. You need to fix queries so that the application does not show an exception. The problem in our case was the square brackets symbol between the fields. Example 8-9 shows how we fixed this problem. Open the files and remove the square brackets in the following SQL syntaxes:
Example 8-9 Remove the square brackets in the following SQL syntaxes
File Boxes.java Line 121 : String query = "INSERT INTO Boxes (box_id, member_id, [box_name], [sort_desc]) " + File Members.java Line 75 : String query = "SELECT member_id FROM Members WHERE [username]='" + username + "'"; Line 133 : String query = "INSERT INTO Members (member_id, [username], [password], [firstname], [lastname], [email], [regdate], [type]) " + Line 166 : "email='" + email + "' WHERE [username]='" + username + "'"; Line 211 : String query = "SELECT * FROM Members WHERE [username]='" + username + "'"; File Threads.java Line 220 : String query = "INSERT INTO Threads (thread_id, parent_id, box_id, member_id, [subject], [post_text], post_date) " + Line 244 : String query = "INSERT INTO Threads (thread_id, parent_id, box_id, member_id, [subject], [post_text], post_date) " +
297
3. Select the Fast Path - Prompt only when additional information is required check box. Expand Choose to generate default bindings and mappings, and select the Generate Default Bindings check box. Click Next. 4. In the Step 1: Select installation options window, leave all the default options and click Next. 5. In the Step 2: Map modules to servers window, leave all the default options and click Next. 6. In the Step 3: Summary window, click Finish. It might take a few minutes to deploy the application and validate all the mappings. After you are finished, save to the master configuration and synchronize the nodes.
298
Next, perform the following steps to start the application. 1. From the WebSphere Administrative Console, click Applications Application Types Enterprise Applications. Select the forumEAR application check box and click Start. You should see the application started and a green arrow to the right of the application name, as in Figure 8-3.
299
300
Chapter 9.
301
9.1 Introduction
GlassFish is an open source application server project led by Sun Microsystems for the Java EE platform. The proprietary version is called Sun GlassFish Enterprise Server. GlassFish is free software, dual-licensed under two free software licences: the Common Development and Distribution License (CDDL) and the GNU General Public License (GPL) with the classpath exception. For more information about GlassFish licensing information, see the following web site: https://glassfish.dev.java.net/public/CDDL+GPL.html GlassFish is based on source code released by Sun and Oracle Corporation's TopLink persistence system. It uses a derivative of Apache Tomcat as the servlet container for serving web content, with an added component, called Grizzly, which uses Java NIO. Nowadays, there are two distribution packages for GlassFish Application Server: GlassFish Server Open Source Edition Oracle GlassFish Server commercially supported by Oracle. For more information about GlassFish Application Server, its packaging formats and distributions and versions, visit the following web pages: https://glassfish.dev.java.net/public/downloadsindex.html https://glassfish.dev.java.net/public/comparing_v2_and_v3.html
302
To develop and deploy this second application, we are using Netbeans IDE 6.8 bundled with GlassFish V3 (build 74.2). Our test environment is an Intel-based Windows 2003 Server. Using a stable version of GlassFish and WebSphere is always recommended. For that reason, keep in mind that at the time of the publication, it can be available in various versions or in fixes for those products.
303
Figure 9-1 gives an overview of the installation and migration paths used for the Java Pet Store 2.0 Reference application.
304
# java -Xmx256m -jar <glassfish filename>.jar # cd <\GlassFish install home dir> # lib\ant\bin\ant -f setup.xml Important: Make sure to change the folders and filespec (text inside brackets), according to your environment. 5. The build process should end with a BUILD SUCESSFULL message. For more information about GlassFish installation, see the document at the following web page: http://docs.sun.com/app/docs/doc/821-0187/abrar?a=view 6. Issue the commands in Example 9-2 to start GlassFish.
Example 9-2 GlassFish initialization commands
# cd <\GlassFish install home dir> # bin\asadmin start-database # bin\asadmin start-domain 7. (Optional) Start the GlassFish Admin Console: http://localhost:4848 Use the default username: admin and the default password: adminadmin.
# java -Xmx256m -jar <java petstore filename>.jar # cd <glass fish install folder>
305
3. Build Java Pet Store for GlassFish. To do this, modify the properties inside the <petstore home>/bp-project/build.properties file, according to your environment and then issue the following commands: # <glassfish folder>\lib\ant\bin\ant setup # <glassfish folder>\lib\ant\bin\ant run Just like the other one, the BUILD and RUN commands must end with the BUILD SUCESSFULL message. For more information about Java Pet Store building and installation for GlassFish, see index.html within the application JAR file or the Java PetStore official website (see 9.2, Prerequisites and assumptions on page 302).
306
b. After the database is created, you can connect to it, create the tables, and populate the petstore database. Using DB2 Command Editor, issue the connect to <dbname> user <username> using <userpswd>; command.
307
c. Open the \<petstore home folder>\setup\sql\javadb\petstore.sql file. d. Execute the list of commands, as shown in Figure 9-3.
308
Note: For more information about DB2 commands, see the following web site: http://www.ibm.com/developerworks/data/library/techarticle/dm-0406da ng/index.html
309
3. Reset your perspective by choosing the Java EE perspective: a. Select Window Open Perspective Other. b. Select Java EE and click OK. See Figure 9-5.
Figure 9-5 Resetting the RAD perspective to a Java EE Project look and feel
310
4. Create a dynamic web project. Click File New Dynamic Web Project. Select the name and general properties of the project, according to your environment. See the examples shown in Figure 9-6 and Figure 9-7 on page 312. Observe the Context Root and EAR Project Name fields. They define properties and descriptors file and affect the way your application is deployed on WebSphere Application Server and how users access the web interface for Pet Store application.
311
5. After you create a project, copy the source files from the Java Pet Store original distribution to the RAD Workspace: From \<petstore app folder>\src\* To <workspace path>\<web module name>\src
312
6. Copy the JAR repository and external classes library from the Java Pet Store distribution to the RAD Workspace: From \<petstore app folder>\lib\* To <RAD workspace path>\<webodule name>\WebContent\WEB-INF\lib There will be red marks at the Java files, showing that files cannot be found. This situation occurs, because the directory structure for GlassFish, which is slightly different to WebSphere. See Figure 9-8.
To solve this issue, change the location of the source files inside RAD workspace: From <workspace path>\<web module name>\src\java\* To <workspace path>\<web module name>\src\ In summary, move the com folder and all its children to the parent folder. The directory structure should look like the list in Example 9-4 on page 314.
313
<workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web <workspace>\<web
module>\src\com module>\src\com\sun module>\src\com\sun\javaee module>\src\com\sun\javaee\blueprints module>\src\com\sun\javaee\blueprints\petstore module>\src\com\sun\javaee\blueprints\petstore\captcha module>\src\com\sun\javaee\blueprints\petstore\controller module>\src\com\sun\javaee\blueprints\petstore\mapviewer module>\src\com\sun\javaee\blueprints\petstore\model module>\src\com\sun\javaee\blueprints\petstore\proxy module>\src\com\sun\javaee\blueprints\petstore\search module>\src\com\sun\javaee\blueprints\petstore\util module>\src\com\sun\javaee\blueprints\petstore\controller\actions The next step, is related to JSF and DOJO library used in this application for the VIEW layer (see more about MVC in Use MVC on page 331.
7. Extract the ui.tld file from bp-ui-5.jar library, issuing the following command: # jar -xvf <workspace>\<web module>\WebContent\WEB-INF\lib\bp-ui-5.jar META-INF/ui.tld 8. Move the extracted ui.tld file to <workspace>\<web module>\WebContent\WEB-INF. After these steps, the Dojo errors should disappear from RAD environment. Where to look for more information: For more information about the Dojo Toolkit refer to the following web site: http://www.dojotoolkit.org/ 9. Create a resource reference in the WebSphere Web Bindings Descriptor (ibm-web-bnd.xml) by performing the following steps: a. Right-click the web module project and select Java EE Generate WebSphere Bindings Deployment Descriptor. This action should open the design tab of the Web Bindings Editor. b. Click Add and select Resource Reference. Enter the following values: Name: jdbc/PetstoreDB Binding Name: jdbc/PetstoreDB
314
The JPA result list is read-only. The getResultList() implementation method in WebSphere Application Server, returns a un-modifiable list according to the OpenJPA implementation, but apparently this does not occur in the GlassFish Application Server implementation. During our migration steps and, by debugging the error messages in WebSphere log files, it was possible to realize that part of the code in the Java Pet Store application tries to sort the result list returned by a JPA query. This is shown in Example 9-5 on page 316.
315
Example 9-5 Original index.jsp raises an Unsupported Operation exception due to read-only result list from JPA
<% try { CatalogFacade cf = (CatalogFacade)config.getServletContext().getAttribute("CatalogFacade") ; List<Tag> tags=cf.getTagsInChunk(0, 12); // since top 20 come from database or desending refCount order, need to reorder by tag name Collections.sort(tags, new Comparator() { public int compare(Object one, Object two) { int cc=((Tag)two).getTag().compareTo(((Tag)one).getTag()); return (cc < 0 ? 1 : cc > 0 ? -1 : 0); } }); %> To solve this error and avoid changes on persistent objects, we implemented changes in the source code of the index.jsp file, as shown in Example 9-6.
Example 9-6 Modified index.jsp
<% try { CatalogFacade cf = (CatalogFacade)config.getServletContext().getAttribute("CatalogFacade") ; List<Tag> tagsRO = cf.getTagsInChunk(0, 12); List<Tag> tags = new ArrayList<Tag>() ; tags.addAll(tagsRO) ; // since top 20 come from database or desending refCount order, need to reorder by tag name Collections.sort(tags, new Comparator() { public int compare(Object one, Object two) { int cc=((Tag)two).getTag().compareTo(((Tag)one).getTag()); return (cc < 0 ? 1 : cc > 0 ? -1 : 0); } }); %>
316
GlassFish ignores double slashes in the URLs and by that, it can still parse the URL requests, but WebSphere Application Server is more sensitive to these malformed URLs. For example, the URL http://app1.itso.ibm.com//app_context, causes a HTTP error in WebSphere Web Container, due to the double slashes (//) after server and domain names. The development team of Java Pet Store application included an extra slash / when building a baseURL string variable, but it is unnecessary, because the javax.servlet.http.HttpServletRequest.request.getContextPath() method already returns the slash character /. According to the Java Servlet API Documentation, The path starts with a "/" character but does not end with a "/" character. See the following web page for more information: http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/ servlet/http/HttpServletRequest.html#getContextPath%28%29 Example 9-7 shows the Original CatalogXmlAction.java (line 70 in the source code).
Example 9-7 Original CatalogXmlAction.java (line 70)
String baseURL = "http://" + request.getServerName() + ":" + request.getServerPort() + "/" + request.getContextPath() + "/ImageServlet/"; Example 9-8 shows our changes.
Example 9-8 New CatalogXmlAction.java (line 70)
String baseURL = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/ImageServlet/"; This change in CatalogXmlAction.java avoids HTTP 404 errors in WebSphere Application Server when building the image URLs and the Pet Store catalog. By running those steps and using the RAD to assist you during migration, it should not be difficult to migrate this sample application. As already stated, the Java EE standards are evolving in a way that all applications will become more compatible and portable among platforms and application server vendors.
317
318
Figure 9-10 Sample web services application development and migration steps
319
4. Install NetBeans 6.8 Java EE bundle according to the installation guide, and according to your operating system and platform: http://netbeans.org/community/releases/68/install.html 5. Download the sample application CalculatorWS from (NetBeans Project) using the instructions provided in Appendix C, Additional material on page 375. 6. Copy the contents of these files to your NetBeans workspace. 7. (Optional) If you want to test the sample applications on GlassFish, perform the following steps: a. Right-click the CalculatorWSApplication project and select Deploy. b. Right-click ClientConsumerForCalculatorWS and select Run. c. Check the GlassFish console for any relevant messages.
320
3. Reset your perspective by choosing the Java EE perspective: a. Select Window Open Perspective Other. b. Select Java EE and click OK. See Figure 9-12.
Figure 9-12 Resetting the RAD perspective to a Java EE Project look and feel
4. Create a dynamic web project by navigating to File New Dynamic Web Project. Select the name and general properties of the project, according to your environment (examples in Figure 9-6 on page 311 and Figure 9-7 on page 312. Examine the Context Root and EAR Project Name fields. They define properties and descriptors file because they affect the way your application is deployed on WebSphere Application Server and how it will be the web services URL. This is an important step when migrating web services, because current consumer applications for such services already know the URL for WSDL and the operations itself. 5. Expand the WAR Project created. Right-click and perform the following steps: a. Select New Other. b. Select Web Services and click OK. The annotations (@WebService and @WebMethod) on the source code files make all things easier to migrate.
321
Now you can build a new client consumer application, applying the new reference to the WDSL provided by WebSphere or solve the common issues using one of the strategies suggested in 9.5, Major issues when migrating web services applications on page 322. The client consumer application was developed in such a way that it connects to both web services. For example, both URLs for the WSDL files were referenced in the application project and both are used at the main() function for testing purposes. If you manage to start both application servers at the same time and run the application client consumer, you should see an output such as Example 9-9.
Example 9-9 Output messages after running the Client Consumer application for Calculator Web Services
Trying with WAS... Multiplication Result = 12.0 Factorial Result of 3 = 6.0 **************************************** Trying with GlassFish Multiplication Result = 12.0 Factorial Result of 3 = 6.0 BUILD SUCCESSFUL (total time: 3 seconds)
322
If your web service was developed and installed over a three tier infrastructure, you can also make changes only on the upper tier, such as a Load Balancer, NAT, or Reverse Proxy devices (see number 2 in Figure 9-13). In this case, you need to reconfigure these devices to point to the new URL for the web service. Looking to the first tier in your architecture (see 3a and 3b in Figure 9-13), you probably have web servers as front-end devices for static pages, and another web application and proxy for the application server itself. For example, if you using IBM HTTP Server (IHS), you can use the HTTP modules to replace the old URLs with the new ones. For more information, visit the Apache HTTP Modules page (mod_redirect, mod_proxy, mod_rewrite, mod_alias) at the Apache HTTP web page: http://httpd.apache.org/docs/2.2/mod/
323
Because you are likely moving from one application server to another, (layer 4 in Figure 9-13 on page 323) you should consider development issues when building it on RAD. If possible, try to avoid changes on the URLs (server name and server port) and path names (context root and servlet mappings). If you do not change these, it is easier to migrate and keep connectivity with other client applications. It is not possible to keep the same URLs, because you might have to move to other servers or even to another infrastructure. In these cases, you should consider the other options to remap the URLs.
9.6 Summary
As expected, we did not face a lot of problems when migrating Java EE 5 applications from GlassFish to WebSphere. The first application, Sun Java Pet Store Reference, is only a web module in its essence (a WAR file) with Java EE features to serve as an example for practitioners and beginners to the Java EE platform. Such features include Java Server Faces (JSF) with DOJO integration, Java Persistence API (JPA), Servlets and JSPs with full usage of tag libraries. We were able to migrate this application successfully with only two changes: one for the JPA implementation and one for the compatibility issues in Web Container (URLs parser / handler). The second application, which was developed by the authors of this book, is a simple web service application with two operations only and no additional complexities whatsoever. The web service migration is presented to raise up common issues when migrating all web services applications. Although it was originally written with Netbeans to work on GlassFish, we were able to deploy it successfully on WebSphere. As stated before, when migrating web services, there are special concerns about the client consumers for these services. Look at 9.5, Major issues when migrating web services applications on page 322 for an overview of these concerns. Because we had the source code for both applications, we used the strategy to rebuild all applications by importing the source files and external libraries to RAD. Such an approach made the migration process easy to perform and easy to deploy in WebSphere. It is important to keep in mind that most of the GlassFish examples use only Java EE specifications with no vendor features. As usual, minor differences in JDK implementations might cause rewriting of the Java Source. Is the case of web services, it is important to observe the new environment and the new references for the web service.
324
Appendix A.
325
326
327
to understand bits. Further, these bits are easy to test. When layering is done well, the entire business logic of an application can often be migrated with little or no modification.
328
Testing at the GUI level is coarse-grained. A GUI tests how the system behaves at the macro level of the system, meaning that if problems are found, entire subsystems must be considered, making finding any bugs identified extremely difficult. GUI testing usually cannot be done well until late in the development cycle when the GUI is fully defined. This means that latent bugs will not be found systematically until late. Average developers probably do not have access to automatic GUI testing tools. Thus, when a developer makes a change, there is no easy way for that developer to retest the affected subsystem. This actually discourages good testing. If the developer has access to automated code level unit tests, the developer can easily run them to make sure the changes do not break existing function. If automated builds are done, it is fairly easy to add an automated unit testing suite to the automated build process. By doing this, the system can be rebuilt regularly (often nightly) and regression tested with little human intervention. In summary, by using automated unit tests, defects are found sooner, defects are easier to find, testing can be made more systematic, and thus, overall quality is improved.
Documentation
Undocumented code is next to useless. Documentation best practice is fundamental to the design, implementation, and maintenance phases. If code is not properly documented, code maintenance in subsequent iterations can be at best problematic, and at worst, impractical. Code maintenance has many sub areas. Extending, scaling, and fixing applications are all forms of maintenance. Without good documentation, these tasks are much harder to complete. The following list details best practices for creating good documentation for your application code: JavaDoc gives developers a contract JavaDoc is used to document classes, instance variables, and methods. It has clearly defined annotations that can aid the development process considerably. For example, the method JavaDoc comments have annotations to describe input parameter values, output values such as return values and exceptions, and under what circumstances these are produced. As such, the JavaDoc comment method, if properly implemented, represents the method contract.
329
Given that JavaDoc gives such a precise way of documenting the modules in an application, JavaDoc documentation of code is not something that is left to chance. Indeed, JavaDoc comments are artifacts in the development process that are written at design time. There are various ways of doing this. A low-level design document might describe all the modules that are to implement the system. The JavaDoc comments can then be written into the low-level design document. The low-level design then forms the template for developers who have been allocated particular modules. They can cut and paste the JavaDoc comments into their source files. A design tool such as Rational Rose can be used to design components. As components are created, they can have their JavaDoc class, instance variable, and method comments filled in. When the design is complete, design documentation can be generated in the form of UML diagrams through automated design documentation tools such as Rational SoDA. Additionally, Java class shells can be generated. That is, Java source code can be generated from the Rational Rose model including all the class, instance variables, and method signatures along with all the JavaDoc comments. These classes can then be allocated to each developer for implementation. Whether using design documents with JavaDoc comments in them or more sophisticated design tools such as Rational Rose that generate code shells, the outcome of this approach is that the JavaDoc comments that form contracts are placed in front of the developer before they start coding. This keeps the contract for the module in front of the developer as he codes the module. By sticking to the class and method contracts the developer is more likely to achieve the desired outcome: a module that is going to pass unit test first time around. Local comments best practice: why, not what During coding, code is commented where necessary. The comments we are talking about in this case are not JavaDoc comments. They are local comments written in an algorithm inside a method body. The general best practice rule of thumb for writing effective comments is that the comments should explain 'Why?' and not 'What?'. Well-designed, well-written code is itself a documentation of what is happening. If code is so poorly designed or esoterically written that what is happening is not clear, the developer should consider being more explicit in their coding style or re-factoring the code. Why something is being done is not always so clear locally. Variables and method calls often come from separate modules. Non-procedural languages do not put everything in front of the developer at the same time. Explaining why something is being done in a particular way is what local comments are used for.
330
Saving time in code reviews Good documentation of code saves time during code reviews. It allows other developers to read code easily. It also cuts down on findings from reviews. One of the major, and unnecessary, types of finding in code review is the need for more accurate JavaDoc and local comment blocks, if those blocks are found
Use MVC
Cleanly separate business logic (Java beans and EJB components) from controller logic (servlets/Struts actions) from presentation (JSP, XML/XSLT). Good layering can cover a multitude of sins. This practice is so central to the successful adoption of Java EE that there is no competition for the #1 slot. Model-View-Controller (MVC) is fundamental to the design of good Java EE applications. It is the division of labor of your programs into the following parts: Those responsible for business logic (Model: Often implemented using EJBs or plain old Java objects) Those responsible for presentation of the user interface (View). Those responsible for application navigation (Controller: Usually implemented with Java servlets or associated classes such as struts controllers). There are a number of problems that can emerge from not following basic MVC architecture. Most problems occur from putting too much into the View portion of the architecture. Practices such as using JSP tag libraries to perform database access, or performing application flow control within a JSP are relatively common in small-scale applications, but these can cause issues in later development as JSPs become progressively more difficult to maintain and debug.
331
Likewise, we often see migration of View layer constructs into business logic. For instance, a common problem is to push XML parsing technologies used in the construction of views into the business layer. The business layer should operate on business objects, not on a particular data representation tied to the view. However, just having the proper components does not make your application properly layered. It is quite common to find applications that have all three servlets, JSPs, and EJB components, where the majority of the business logic is done in the servlet layer, or where application navigation is handled in the JSP. You must be rigorous about code review and re-factoring to ensure that business logic is handled in the Model layer only, that application navigation is solely the province of the Controller layer, and that your Views are concerned with rendering model objects into appropriate HTML and Javascript. User interface technologies change rapidly and tying business logic to the user interface makes changes to just the interface deeply impact existing systems. Just a few years ago, user interface developers for web applications can choose from servlets and JSPs, struts, and perhaps XML/XSL transformation. Since then, Tiles and Faces have become popular, and now AJAX is gaining a strong following. It is a shame to have to redevelop an application's core business logic every time the preferred user interface technology changes.
332
Struts
Struts is a framework that is implemented according to the MVC pattern. Prior to Struts, developers used combinations of JSPs and Servlets to create the View and Controller layers of an application. Struts took the best practices that emerged from the JSP and Servlet architectures and created an architecture that introduces an action model where JSP form data is submitted to an ActionServlet controller. Struts uses JSP tag libraries extensively. WebSphere Application Server V6 now comes with caching features specific to Struts architectures to reduce the overhead of tag library references. Where possible, JSP, rather than XSLT, is used to render the view layer as XSLT (which is the transformation of XML to HTML pages) is expensive. Form beans should not be passed to the business logic layer. The layers are completely separate. Passing form beans to the back end means that the back end is not independent from the front end in terms of the objects it needs to know about. De facto standard for MVC frameworks: Struts is the de facto standard for MVC frameworks, but there are many other open source frameworks that are more lightweight and easier to use. Java Server Faces (JSF) is a standardization effort that tries to unify a fragmented market. For more information about Apache Struts Project, visit the following web page: http://struts.apache.org/
333
334
program-to-program communication instead of staying within supported mechanisms such as Java 2 Connectors, JMS, or web services. Such design choices cause no end of difficulty when moving from one Java EE-compliant server to another, or even when moving to new versions of the same server. Using elements outside of Java EE often causes subtle portability problems. The only time you should ever deviate from a specification is when there is a clear problem that cannot be addressed within the specification. For instance, scheduling the execution of timed business logic was a problem prior to the introduction of EJB 2.1. Today, of course, the EJB specification now provides for time-based function so we encourage the use of standard interfaces. In this way, maintenance and migration to later specification versions becomes the problem of the vendor, and not your problem.
335
Iterative development of each application layer fosters the application of appropriate patterns and best practices. If you begin with the lower layers of your application and apply patterns such as Data Access Objects and session facades, you should not end up with domain logic in your JSPs and other View objects.
336
337
Take advantage of application server features that do not require your code to be modified
With features such as WebSphere Application Server caching and the Prepared Statement cache, the performance gains are substantial and the overhead is minimal. Be prudent in applying application-server-specific features that modify your code. It makes portability difficult and might make version migration challenging as well. However, there are a suite of application-server specific features available, particularly in WebSphere Application Server, that do not modify your code. Your code is written to the specification, but if you know about these features and how to use them properly you can take advantage of significant performance gains. For example, in WebSphere Application Server you should turn on dynamic caching and use servlet caching. The performance gains are substantial and the overhead minimal, and the programming model is unaffected. The merits of caching to improve performance are well understood. Unfortunately, the current Java EE specification does not include a mechanism for servlet/JSP caching.
338
However, WebSphere Application Server provides support for page and fragment caching through its dynamic cache function without requiring any application changes. The cache policy is specified declaratively and configuration is through XML deployment descriptors. Therefore, your application is unaffected, remaining Java EE specification compliant and portable, and benefiting from the performance optimizations provided from WebSphere's servlet and JSP caching. The performance gains from dynamic caching of servlets and JSPs can be substantial, depending on the application characteristics
339
340
Design patterns
If you have a problem to solve, you can trust that it has been faced and solved before. Commonly used solutions in application architectures fall into categories. These categories are called design patterns. The following subsections discuss generic design patterns that are not specific to Java EE or to the Java language, but are extensively used in Java EE. How to get more information about Java EE design patterns: For further information about Java EE design patterns, visit the following web pages: http://java.sun.com/blueprints/patterns/ http://www.javacamp.org/designPattern/
Important: It is important to know when to use a pattern and how to apply it correctly. This knowledge can only be gained through experience and practice. Java and J2EE applications tend to overuse patterns, which leads to unnecessary complexity.
341
Service Locator
J2EE application servers expose services and components like EJBs through JNDI. A single object can be used to do JNDI lookups for resources such as EJBs and Java messaging resources. Delegating this task to one object that is then called by other objects is far better practice than all objects doing the same JNDI call to look up objects.
EJBHomeFactory
This is a composite design pattern that uses other design patterns. Its purpose is to reduce the overheads when looking up home interface references for EJBs. This design pattern is similar to the service locator pattern. It also uses the singleton pattern, which means it maintains a single instance of itself for use by other modules. It also uses the factory design pattern (that is, its sole purpose in life is to produce instances of a particular object type for other modules).
Facades
The facade design pattern offers a simplified interface by encapsulating a complex interface or collection of interfaces. A session facade pattern is constructed from a stateless session EJB accessing, for example, one or more Entity EJBs. The session facade is based on the facade design pattern. A facade simplifies the interface of a more complex underlying system. In a session facade, the complexity of finding and calling a number of entity beans is simplified to one call to a method on a Session bean. This pattern, in turn, reduces complexity in client layers. This pattern reduces network overhead, caused by remote method invocations, by encapsulating multiple remote calls into one.
342
This pattern also reduces transaction handling overheads by not allowing view objects to access entity beans directly. When view objects access entity beans directly, separate transactions are created which is an extra overhead.
Singletons
Singletons are classes that return an instance of themselves to calling classes. They only return a new instance of themselves to calling classes, if the single instance of themselves that they maintain has not been created yet. The advantage of this is the avoidance of static method calls. Static method calls are not a clean OO approach. Moreover, ensuring that only one instance of a class exists at any one time means all users of the object reference that object rather than maintaining their own instance. Separate instances represent a memory overhead. However, a word of caution about singletons: singletons are only desirable if the object is totally generic in all situations for all calling classes. If this is not the case, the singleton pattern should not be selected.
Factories
The factory design pattern is where an object has a dedicated purpose. The purpose is to produce instances of a particular object class. The factory object is the single point of access for obtaining an instance of the object. The factory design pattern is often used in conjunction with the singleton pattern that ensures that only one instance of the factory object exists in memory.
343
Improves testability JUnit test cases usually do not depend on external systems such as databases or a J2EE container. By coding to interfaces, you automatically improve testability. Changing the concrete implementation of an interface (for example changing a DAO to use an in-memory database instead of an RDBMS) is done in one place only, the container configuration. There are several implementations of the Dependency Injection pattern that are available for download, such as: PicoContainer PicoContainer is a light-weight container that implements the Dependency Injection pattern. For more information, see the following web page: http://www.picocontainer.org Spring Framework Spring Framework contains an implementation of the Dependency Injection pattern. Spring Framework is a more general J2EE framework, and includes many other features than just Dependency Injection. For more information, see the following web page: http://www.springframework.org Tip: Dependency Injection removes the need for implementing many patterns, including the factory, singleton, and service locator patterns. Dependency Injection is a better solution than these patterns combined because it allows you to create code that is less tightly coupled.
Iterative development
During development, there are always unknowns. These unknowns can take the form of the use of new technology, the use of new development staff, or the use of new ideas to solve problems. These unknowns then take the form of risks. The earlier these risks are exposed, the earlier they can be mitigated. Developing iteratively means to go through a number of sub-development cycles in turn to expose risks early. This is in contrast to the waterfall model. In a waterfall development model, because testing occurs late in the cycle, risks (such as the use of new technology and its unknowns) are not exposed until the components that use that technology are built. Worse, they might not be exposed until those components are unit-, integration-, and acceptance-tested.
344
Iterative development steps through sub-iterations of the entire development process. This means that fundamental parts of the application are prescribed, designed, implemented, tested, and deployed in controlled iterative cycles. The key word here is controlled. The objective of the iteration has to be clear and self-contained. Discipline in project management and software development throughout the micro-iteration has to be as tight as it is in the entire macro-iteration. For example, a project called Redbook Application might require the creation of a web front end using Struts technology, an EJB back end including the use of Java Messaging Service technology and an EJB client application. The front and back layers might require many interface and back-end components. However, a first iteration might design, code, and test a single web interface component, a single back-end component, and a single EJB client component. The web interface makes use of Struts in this first iteration and the back-end component makes use of Java Messaging Service technology at this early point. This first iteration is not implementing all the web interface, backed EJB, and EJB clients needed. But what it is doing is creating a single example of each. It is also creating parts of the application that are needed rather than prototyping with functionally irrelevant example code. Finally, it is implementing and testing the use of the specific technologies (such as Struts and Java Messaging Service), which might be new to members of the development team. Furthermore, there might be novel ideas or new design patterns that are being used. An example of these are included also in this first iteration. It is important note that the iteration is producing functionality that is needed in the final application. The iterative approach is similar to prototyping. Prototyping is the practice of building an application to prove theories from the design stage. It is also possible to show a prototype to users and customers to ask Is this the sort of thing you wanted? It is commonly a stage somewhere between requirements gathering, design, and coding stages in the waterfall model. The danger of prototyping are that when it produces an application that tests theoretical and new unknown areas, it is not focused on necessarily producing functionality required in the end product. It is often discarded, which can be seen as a waste of development effort. On the other hand, and in the worst case, if the prototype is concerned with producing final functionality, it might do so in a way that is not robust or well designed, just to get something up and running. This poor design and lack of robustness can then find its way into the final product. It has happened that clients, when shown a prototype, think it is so good (and cheap, because they have something that works in a short period of time) that they want to use that as the final product.
345
The iterative approach takes the benefits of prototyping but avoids its pitfalls. The deliverables of the iteration are deliverables for the final product. By following the iterative approach, risks are identified early and mitigated.
Quality
Quality improves through iterative development. By definition, the application goes through a number of design, coding, and testing cycle revisions. This enhances the applications robustness, performance, and maintainability.
Learning
Members of the team learn lessons. They can apply the knowledge in the same macro-development cycle or project. If a team member needs specific training, these needs are identified earlier and the knowledge learned can be applied in the same project. Team members also learn about the development process itself. The process or the team member's practice of the process can be tweaked and improved upon.
Reuse
Reusable components, or common components, might turn out to be not so generic in practice. Likewise, components, which were thought not to be generic, might emerge as generic as other uses become apparent. These design considerations might not emerge until the project is under way. Also, the use of third party technology (for example a GNU API such as Apache Xerces XML API) might be evaluated. Sometimes, third party technology can turn out to be inappropriate and another alternative needs to be sought; sometimes the technology might have additional, unexpected benefits that one likes to take advantage of too. The iterative approach makes these adjustments possible.
346
In summary, software development projects are learning processes no matter how well planned they are. The iterative model allows for controlled and sub-iterations of the entire life cycle of the software development. This iterative development model allows the team to take advantage of new knowledge earlier. Hindsight is taken advantage of before the macro-iteration of the project life cycle ends.
Requirements definition
Capturing requirements and managing changes to those requirements is fundamental to a successful project. Clear requirements and a process for managing changes to those requirements gives developers a chance to design and implement the right system. If requirements are vague and the process for managing changes to requirements is poor or non-existent, the deliverables are going to be late and might be late and incorrect. The employment of use cases is a best practice when modeling requirements. These use cases can be used to design components and devise test cases. A use case is a scenario in the application that has actors and outcomes. It is a model of the permutations of events that might occur or be allowed to occur during that scenario. Use case diagrams are a part of the Unified Modeling Language (UML) and are a standard way of expressing these scenarios. It is possible to write use cases without creating use case diagrams. It is highly recommended that use cases be identified and created during the requirements stage to achieve a successful development project outcome.
347
Low coupling means that the interfaces of each component that allow the components to interact is kept as simple as possible and calls to interfaces are kept to a minimum. Tip: The success of the approaches is cumulative. If the right decisions are made in making modules and groups of modules cohesive, the goal of low coupling is easier to achieve. If you do not understand this concept, consider the placing of a fire hose on an ambulance rather than on a fire truck. No doubt the ambulance is sometimes in the same place as the fire truck and the firefighters can use the hose. But clearly, it is better if the hose were part of the fire truck. This might seem like common sense but in the abstract world of software development, such clarity can sometimes be harder to come by. When in doubt, applying first principles (such as the laws of high cohesion and low coupling) can help clarify the situation. Good OO approaches and thinking lead to elegance, reusability, and easy maintenance. Good OO approaches and thinking are surprisingly rare among developers using OO languages and technologies. Use of design patterns and IDE tools can help guide the developer into good OO practices but understanding OO design principles is fundamental. Tip: There are two basic OO principles that we suggest because of the many benefits that are associated with their use: Coding to interfaces This principle is coding to interfaces instead of concrete implementations. The interface is the contract between the provider of a service and the client. Changing the implementation does not break this contract; only a change in the interface can do this. Object composition This principle can be seen as an extension of the first one. Using inheritance instead of object composition causes problems because subclasses directly depend on the parent class. A change in the parent class might break classes down further in the inheritance hierarchy. A better strategy is to use object composition in combination with the principle of coding to interfaces. This results in finer-grained objects that are used through a facade that hides the implementation details. The objects are assembled at run time, by Dependency Injection or code, which has the added benefit of allowing you to switch the implementation.
348
Modeling languages
Unified Modeling Language (UML) is a visual way of expressing concepts in software development. Use cases and class architectures, for example, can be expressed unambiguously. UML does not have to be used, but developers need to have a way of communicating design ideas clearly and without extraneous details. UML class diagrams, for example, are one view of the OO component architecture. They show the entities that the developer wants to show and do not show those that confuse issues. Rational Rose and Rational Application Developer V6 both have UML diagram capabilities. It is suggested that developers use this functionality. Note: UML can be used passively, especially with class diagrams. This is important because developers new to UML will find it far easier to read diagrams than to create diagrams. Components such as classes and packages can be created in Rational Application Developer V6 (and other Rational Tools such as Rational Rose). These components can be dropped onto diagram panes and the class diagram UML is automatically generated. These diagrams can be exported to design documents. The auto-generation of UML means that even developers that are relatively new to UML can use it. Developers can passively read the diagrams rather than actively produce the diagrams.
349
350
stage might lead back to the start of the stage again or indeed back to the start of another stage. For example, if during low-level design, a flaw or inconsistency is found in the high-level design, a micro HLD stage is followed again to ensure that the HLD is updated correctly. Indeed, this might even feed back to a micro cycle of the requirements gathering and analysis stage if the flaw in the HLD was found to be due to vagueness in the requirements analysis. Verification and validation The micro iteration approach involves the concepts of verification and validation (V&V). Verification means to prove something is correct. Validation means to prove something is sound and logical. In software and systems development the two words map respectively to two key questions: Are we building the right system? This is the verification question. Is the system that we are building correct in respect to its requirements? This question can be answered by referring to the requirements analysis and design documentation. If anything is not clear or is inconsistent from these stages, then these stages require a further iteration. Are we building the system right? This is the validation question. Is the system soundly and logically constructed? Is it robust? Is it maintainable? Does it conform to standards? This question can be answered with varying degrees of formality. For example, the logic of an algorithm might be reviewed informally by a development team. At the other extreme, the logic of an algorithm might be formally proved using mathematical methods (such as the mathematical formal method language Z). Quality assurance in software development is achieved by a process of V&V in the development life cycle. This involves a cyclical review process where something is produced and is either validated or verified. This process is iterated upon until a satisfactory level of quality is achieved.
351
The next cycle repeats these phases. At the micro level, each phase might go through several iterations of itself. For example, during a construction phase, coding, testing, and re-coding might take place a number of times. Figure A-2 gives an overview of RUP.
As also shown in Figure A-2, RUP identifies a number of disciplines that are practiced during the various phases. These disciplines are practiced during all phases but the amount of activity in each phase varies. Clearly, the requirements discipline is more active during the earlier inception and elaboration phases, for example. RUP maps disciplines to roles. There are many roles but the roles break down into four basic sets of roles: Analysts Developers Testers Managers Members of the team might take on more than one role. More than one team member might have the same role. Each role might require the practice of more than one discipline. RUP can be followed without using Rational Software. It is just a process specification. However, RUP provides specific guidance (called
352
Tool Mentors) on how to use Rational Software when following the process. The disciplines identified in RUP (such as requirements analysis, design or testing) map to specific pieces of Rational software and artifacts that this software generates. RUP is a process that can be employed as much as required. Note: For more information about RUP, visit the following web page: http://www.ibm.com/software/awdtools/rup
Agile development
Agile development is a collaborative, incremental, and iterative approach to software development that can produce high-quality software in a cost effective and timely manner. Unlike traditional software development, agile development emphasizes flexibility, continuous testing and integration, and rapid delivery of functionality. By focusing on collaboration and iteration, agile development teams demonstrate the following skill sets: Increased team efficiency Lower development costs Faster time to market Better quality software Systems better suited to customer needs Repeatable results Teams can adopt and improve agile development strategies for their unique needs and challenges. Agile solutions includes agile practices, process improvement services, training and mentoring services, and products to help companies adopt and tailor agile strategies to meet the unique challenges faced by software delivery teams. For more information about the Agile development, visit the following web page: http://www.ibm.com/software/awdtools/rup Java EE best practices: For more information about Java EE best practices refer to IBM WebSphere Developer Technical Journal article: The Top Java EE best practices, available from the following web page: http://www.ibm.com/developerworks/websphere/techjournal/0701_botzum/ 0701_botzum.html Also, see the IBM WebSphere Developer Technical Journal article: Migrating to IBM WebSphere Application Server, available from the following web page: http://www.ibm.com/developerworks/websphere/techjournal/0107_beaton/ beaton.html
353
354
Appendix B.
Migration questionnaires
This chapter contains sets of questions that you can use to build your own questionnaire based on the unique challenges you foresee. It is not intended to be a final questionnaire, but a base from which you can learn how migration questionnaires are built. Other specific questionnaires might be required. (such as SOA and web 2.0 questionnaires). You can also see 4.3.2, Getting help on page 77 to get help from IBM.
355
Business requirements
Business requirements questions are as follows: 1. What is motivating the business to make this change? 2. Is the application business critical? 3. What is the target version of WebSphere Application Server? 4. What other WebSphere products are involved in this migration? WebSphere Portal Server and WebSphere Edge Server possible are examples. 5. By what date must this application migration be complete? 6. What is the risk to the business if the change cannot be implemented by that date? 7. What is the risk to the business when the application is not running? 8. Is this migration part of a new application release/version? 9. Please describe any important milestones for the migration. Include dates for development, QA, and so forth. 10.How do you describe a successful migration?
General information
General information questions are as follows: 1. What is the name of the application? 2. What URL is used to access the application? 3. What is the current version of the application? 4. What is the audience for the application: internal, external, or both? 5. What is the primary function of the application? 6. What services does this application provide? 7. Who are the users of the application? 8. Describe any upgrades that are considered part of this migration? This might include such things as platform infrastructure (OS or related stack components) or exploitation of features provided by Java EE. 9. Can the migration be partitioned?
356
10.Can the application be divided into smaller pieces that can individually be migrated? Staged migration of the database, JSP, EJB, and so forth, enables incremental migration, providing greater opportunity for quality control and isolation of unexpected problems. 11.How frequently do you schedule an independent review of your application code?
Application architecture
General application architecture questions are as follows: 1. Does the application architecture conform to the Model 2 architecture prescribed by Java EE? 2. Describe the application's use of established design patterns. 3. Does the application, for example, employ well-known patterns such as Facade, Command, Strategy or Proxy?
Dependencies
Dependency questions are as follows: 1. Are there dependency cycles between packages? A dependency cycle results when two or more types are involved in a cycle of references that binds them tightly to one-another. Dependency cycles are not always bad. Cycles are often desired between two or more types. Dependency cycles become a problem, however, when they exist between packages or modules. The danger is that they introduce a tight coupling between those packages or modules, which makes the code generally more brittle and difficult to change. The point of this question is to understand if any such cycles exist between packages. 2. Are there dependency cycles between Java EE modules? A common dependency cycle between Java EE modules involves an EJB module that makes reference to helper classes in a Java utility module that, in turn, makes references back to the EJB module. Such helper classes are typically used as convenience methods for finding EJB homes, for example. 3. Describe any classloading dependencies in the application. Class loading issues and dependency to libraries are common in older Java EE-style applications. The earlier versions of the specifications did not state clearly how the class loading has to happen and how the library classes need to accessed.
357
Persistence
There is one question related to persistence: 1. How is persistence of application data implemented? This question is concerned with understanding how application data is made persistent. Typically, application data is stored in a database and a layer in the application is responsible for moving that data from the database into Java objects and back again. Persistence might be implemented using EJB CMP entity beans, a third-party product such as TopLink for Java, or a custom implementation of a Data Access Object (DAO) pattern. It might also be implemented in an ad hoc fashion using JDBC statements throughout the application code.
National language
National language questions are as follows: 1. What national languages are supported by the application? 2. How is language determined by the application? The application might use the language attribute from the HTTP Request Header, or perhaps profile information provided by a user using a combination of cookies and HTTP session data. 3. How is language data stored by the application?
358
Code
This section has questions related with the code. Approximate answers will suffice for these questions. However, accurate answers yield more accurate results
Java
Java questions are as follows: 1. How many custom classes are defined in the application? A custom class is one that was created by your development team. Do not include classes that are part of the standard Java libraries, middleware, or third-party supplied libraries. Also, do not include classes generated by the container to support your application in run time. 2. How many custom classes in the application are declared as abstract? 3. How many custom interfaces are in the application? A custom interface is one that was created by your development team. Do not include interfaces that are part of the standard Java libraries, middleware, or third-party supplied libraries. 4. How many lines of code are in the application? Provide an indication of useful lines of code (exclude comment lines from this value).
EJB usage
EJB usage questions are as follows: 1. What version of the EJB specification is used? 2. Do all the enterprise beans in the application conform strictly to this version of the specification? 3. How many Stateless Session beans are in the application? 4. How many Stateful Session beans are in the application? 5. How many CMP Entity beans are in the application? 6. How many BMP Entity beans are in the application? 7. How many Message Driven beans are in the application?
359
360
Web services
Web services questions are as follows: 1. Enumerate the external web services your application accesses. By external, we mean external to the application. This includes any web services that are hosted by other applications regardless of the language or platform they are running on. If possible, provide a description of each web service used and note any potential issues that you are aware of that might affect the migration. 2. Enumerate the internal web services your application accesses. An internal web service is one that is part of your application. Your application might, for example, use a web service to implement the Facade pattern between your servlet and EJB layers. 3. Enumerate the web services your application implements. For this answer, list the web services that your application provides for internal or external clients. If possible, provide a description of the function that each web service provides. 4. Are the web services implemented by your application WS-I compliant? If so, indicate the WS-I version.
Database access
Database access questions are as follows: 1. What version of the JDBC specification is used? 2. Does the use of JDBC conform strictly to this version of the specification? 3. How many distinct JDBC queries does the application make? 4. What database managers are used by the application? 5. Do the JDBC queries make use of vendor-specific SQL extensions? 6. Does the application make direct use of DriverManager? 7. Does the application make Use of J2EE connection pooling through data sources? 8. Describe any third-party connection pooling mechanisms in use. 9. Does the application make use, for example, of Oracle Connection Pooling? 10.Are all JDBC connections explicitly closed? 11.Are all JDBC statements explicitly closed? 12.Are all JDBC resources closed inside finally clauses? Code contained in a finally block of an exception handler is guaranteed to run (whether an exception occurs or not). By closing these shared resources in a finally clause, you ensure that these resources can be kept available.
361
JMS
JMS questions are as follows: 1. What version of the JMS specification is used? 2. Does the use of JMS conform strictly to this version of the specification? 3. How many queues does the application make use of? 4. How many topics does the application make use of? 5. What kind of data is passed through JMS? For example: "plain text", "XML", or "serialized objects" 6. Does the application write to JMS queues? 7. Does the application read from JMS? 8. Does the application do blocking reads from JMS? 9. Does the application do blocking reads from JMS in Session or Entity beans?
JNDI naming
JNDI naming questions are as follows: 1. Does the application use JNDI to access resources other than EJB Homes? 2. Do the application's deployment descriptors contain local JNDI resource references? JNDI resource references sections are within web.xml and ejb-jar.xml. 3. Describe a typical JNDI access from the application. Provide a code snippet if possible. 4. Are all JNDI resources (InitialContexts) closed inside finally clauses? Code contained in a finally block of an exception handler is guaranteed to run (whether an exception occurs or not). By closing these shared resources in a finally clause, you ensure that these resources can be kept available.
362
Struts
If the application does not make use of Struts, skip this section. Struts questions are as follows: 1. What version of Struts is used? 2. How many custom ActionForms are in the application? 3. How many custom ActionHandlers are in the application? 4. Describe any modifications you have made to Struts. 5. Struts is an open source framework and is customized by organizations to provide extended functionality. If you have extended Struts, describe that extension.
Transactions
Transactions questions are as follows: 1. Are transactions managed implicitly or explicitly? 2. Does the application require two-phase commits (2PC)? 3. What transactional systems does the application interact with?
363
Threads
This section is concerned with the application's direct manipulation of threads. This section is not concerned with threads managed by the application server. Thread questions are as follows: 1. Does the application create threads? 2. Does the application create daemon threads? 3. Does the application explicitly stop threads using the stop() method? 4. List any third-party thread pool libraries used by the application. Include version numbers if possible. 5. Describe any custom thread pool libraries used by the application. 6. Describe how the application makes use of threads. This question is concerned with how your application makes explicit use of threads. For example, does your application spawn threads to perform work in parallel, or to provide timeouts for various services. If it is the latter, indicate what services the threads are providing timeouts for.
Sockets
Skip this section if your application does not make direct use of sockets. This section is concerned with sockets created and used directly by your application; it is not concerned with sockets managed by the application server. Socket questions are as follows: 1. Describe how the application makes direct use of sockets. 2. Does your application create any daemon sockets? 3. Does your application use secure sockets (SSL)?
XML
XML questions are as follows: 1. What XML libraries does the application use? Include version information. 2. What XSLT libraries does the application use? Include version information.
364
Workstation configuration
Workstation configuration questions are as follows: 1. What hardware is used? 2. What operating system and version is used? 3. How much RAM is installed?
365
366
Development methodology
Development methodology questions are as follows: 1. What development methodology is used? 2. How long is a typical development cycle? 3. How frequently are internal releases of the application delivered? 4. This includes releases for internal testing, or user acceptance testing. 5. How frequently are external releases of the application delivered? 6. How often are new versions of application delivered into the production environment?
Ant
Skip this section if you do not use Ant for builds. 1. What version of Ant is used? 2. Does your build process use one or many Ant scripts? One Many 3. What optional Ant tasks do you use as part of your build?
367
General
General questions are as follows: 1. Will the existing runtime infrastructure be migrated? 2. Will you have to support the existing runtime infrastructure after the migration? Answer yes if you expect to migrate only your current applications and will leave them running on the current infrastructure. 3. Does your runtime infrastructure include a dedicated pre-production staging environment? Your pre-production environment might be called the Quality Assurance environment. Regardless of the given name, this environment is used to test the overall quality of your environment and applications prior to moving those applications into the production environment. 4. Does your runtime infrastructure include a dedicated performance testing environment? Describe the separate runtime environments (production, pre-production, system test, development test, performance test, etc.) that are included in your runtime infrastructure.
Current hardware
Questions about current hardware are as follows: 1. Describe the hardware used to run your current application server. If your environment is heterogeneous, describe each hardware configuration. Indicate the quantity of each configuration. Also indicate the operating system and version currently in use. 2. How many production machines currently host the production application? Describe any additional hardware used in the production environment. Include all the details from firewalls, IP sprayers, web servers, clustering manager, database servers, firewall, intrusion detection systems, and so forth. Indicate software in use (if any) on these systems, including operating system and version.
368
3. Describe how the configuration of the pre-production environment differs from the configuration of the production environment? 4. Is the pre-production environment configured with a similar complexity, but at a smaller scale? Are there key elements missing from the pre-production environment? 5. Describe the hardware you plan to use to run the migrated applications. If your environment is heterogeneous, describe each hardware configuration. Indicate the quantity of each configuration. Also indicate the operating system and version currently in use. 6. How many production machines are used to host the production application? Describe any additional hardware used in the production environment. Include all the details from firewalls, IP sprayers, web servers, clustering manager, databases, firewall, intrusion detection systems, and so forth. Indicate software in use (if any) on these systems, including operating system and version.
Software
Questions about software are as follows: 1. Which version of Java Runtime Environment (JRE) do your current production hosts use? 2. Provide the name of the provider of the JRE. This might be Sun, IBM or another JRE vendor. 3. Describe other software that is installed and used on the same production hardware as the application servers. 4. Describe the infrastructure of the host bridge network if the application employs the connection services to host systems (for example, CICS).
369
HTTP Server
HTTP Server questions are as follows: 1. What HTTP Server is used? 2. Is the HTTP Server configured to provide affinity to a particular application server instance? 3. How many servers will host the web servers? IBM WebSphere is capable of working with almost all web servers in the market today. It is important to understand how the current web server is being used and what is the impact if WebSphere Application Server continues to use the same web server during the production switch 4. Describe any other services provided by the HTTP server. This includes services beyond serving static content and fronting for the application server. Does your HTTP server, for example, provide additional functionality using CGI/Perl? 5. Describe the infrastructure for secure network propagation. 6. Enabling HTTPS on the web server is one way of doing it from the browser to the web server end. Enterprises also use hardware accelerators to improve the speed of the SSL encryption and the decryption process. If so how does it integrate with the web server? 7. Is the communication from the HTTP server plug-in to the application server secure in the current environment?
Network edge
Network edge questions are as follows: 1. What load balancing technologies are used? 2. Is the load balancer configured to provide affinity to a particular HTTP server instance? 3. Describe how failover is provided for your load balancer.
370
Availability
Availability questions are as follows: 1. Describe any existing service level agreements concerned with the availability of the applications. This determines the availability and the amount of flexibility to switch to was run time. 2. Describe how clustering is provided in the current environment. Explain about your current clustering environment. 3. Describe the process for the production release rollout of an application? If the process differs for various applications, describe each of the processes. 4. What is the current backup strategy when a node or server fails or breaks down? Explain in detail your fail over strategy.
Rollout issues
Questions about rollout issues are as follows: 1. Will old applications need to coexist with newly migrated applications? 2. Does the migration include all the applications on the production server? If not, is there a plan to migrate those applications as well? Co-existence is important especially when migrating common frameworks and application development models into a new platform. There can be application dependencies that needs to be maintained when moved into the new platform. 3. Are there any other software updates scheduled to be done to the production machines during the migration process? Migration of the production environment is a important task and mitigation of risk is the key during the migration. Hardware and software updates are only recommended when they are required as part of the migration. It is advised that they be decoupled to keep the number of variables to minimum.
371
Administration
Administration questions are as follows: 1. How many administrators do you have to support the production environment? 2. Do you have dedicated administrators for your production infrastructure? 3. Describe the skill level and experience of the administrators of the production environment. 4. How do you currently deploy the applications? 5. Do the production administrators use deploy scripts to accomplish this task? Does it involve custom scripting? Explain the process. 6. Describe any custom scripts that are used for administering the application servers. 7. Do you use any custom scripts for administering the current set up? If so what they used for? 8. Is the production environment set up to take care of log rotation and file system maintenance? 9. Log files can become really large and can fill up the available space within the production host. Is there a procedure or a process in place to handle file system maintenance?
Security
Security questions are as follows: 1. How important is security in your production runtime infrastructure? Critical Very important Important Not important
2. Describe how internal security of the application server is managed. There are several roles applicable within the production environment, including root administrator, machine maintenance operator, application deployer, and developer. Explain how access to the application server hardware and software is managed with respect to these roles. 3. How are internal security policies enforced? 4. How are users authenticated? 5. How are user authorizations managed?
372
6. Describe your use of application-specific services for user authentication and authorization. 7. Describe your use of custom services for user authentication and authorization. 8. Describe any third-party security mechanisms in use. This might include products such as Netegrity Siteminder. 9. Describe how your production runtime provides (or participates) in a single sign-on solution. Describe any network security measures in place. 10.Are firewalls positioned between tiers in your configuration? If so, how and where are they configured?
Hardware
Questions about the hardware used are as follows: 1. Is dedicated hardware available specifically for user acceptance testing? 2. Is dedicated hardware available specifically for quality assurance testing? 3. Is dedicated hardware available specifically for performance testing? 4. Describe how the testing hardware is different in configuration from the production hardware.
373
8. How frequently are do applications undergo quality assurance testing? 9. Describe the testing stages that an application is taken through when moving from the development environment into production. 10.How do you test applications for compliance with the J2EE specification? 11.Do you have an established set of application development best practices? This includes coding standards and code maintenance and performance best practices. 12.How are application development best practices enforced? 13.What tools do you use to unit test your application code? 14.What tools do you use to function test your application code? 15.What tools do you use to regression test your application code? 16.What tools do you use to performance test your application code? 17.Does the testing procedure contain any harness whose code is dependent on the source platform?
374
Appendix C.
Additional material
This book refers to additional material that can be downloaded from the Internet as described.
375
376
Related publications
The publications listed in this section are considered particularly suitable for a more detailed discussion of the topics covered in this book.
IBM Redbooks
For information about ordering these publications, see How to get Redbooks on page 380. Note that the documents referenced here may be available in softcopy only. Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6, SG24-6690 Migrating WebLogic Applications to WebSphere Advanced Edition, SG24-5956 Migrating WebLogic Applications to WebSphere Advanced Edition V4, SG24-6179 WebSphere Application Server V7: Concepts, Planning and Design, SG24-7708 Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6, SG24-6690 Experience JEE! Using Rational Application Developer V7.5, SG24-7827 MySQL to DB2 Conversion Guide, SG24-7093 WebSphere Application Server V7 Messaging Administration Guide, SG24-7770 Getting Started with WebSphere Application Server Feature Pack for Service Component Architecture, REDP-4633 Migrating WebLogic Applications to WebSphere V5, REDP-0448
377
Online resources
These web sites are also relevant as further information sources: General WebSphere information: http://www-01.ibm.com/software/websphere/ WebSphere Application Server V7.0 information: http://www.ibm.com/software/webservers/appserv/was/ WebSphere Application Server for Developers V7.0 information: http://www.ibm.com/developerworks/downloads/ws/wasdevelopers/ WebSphere Application Server - Express V7.0 information: http://www.ibm.com/software/webservers/appserv/express/ WebSphere Application Server Network Deployment V7.0 information: http://www.ibm.com/software/webservers/appserv/was/network/ WebSphere Application Server for z/OS V7.0 information: http://www.ibm.com/software/webservers/appserv/zos_os390/ WebSphere Application Server for z/OS V7.0 information: http://www.ibm.com/software/webservers/appserv/zos_os390/ Application Migration Tool download location: http://www.ibm.com/developerworks/websphere/downloads/migration_tool kit.html Eclipse IDE download location: http://www.eclipse.org Whats new in WebSphere Application Server V7? white paper: http://www.ibm.com/developerworks/websphere/library/techarticles/080 9_alcott/0809_alcott.html WebSphere Application Server Feature Packs information: http://www-01.ibm.com/software/webservers/appserv/was/featurepacks/ IBM Software Services for WebSphere (ISSW) information: http://www3.software.ibm.com/ibmdl/pub/software/dw/wes/pdf/services/ DevelopDeployFinal.pdf WebSphere education information: http://www-01.ibm.com/software/websphere/education/
378
IBM WebSphere Application Server V7 Information center: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/ com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/welc_howdoi_tprf.html IBM DB2 Information center: http://publib.boulder.ibm.com/infocenter/db2help/index.jsp IBM DB2 Universal Database Express Edition download location: http://www.ibm.com/developerworks/downloads/im/udbexp Java Platform, Enterprise Edition 5 (Java EE 5) Specification: http://jcp.org/en/jsr/detail?id=244 Apache Tomcat 6.0.26: http://tomcat.apache.org/tomcat-6.0-doc/index.html Migrating a Microsoft Access 2000 Database to IBM DB2 Universal Database 7.2: http://www.ibm.com/developerworks/data/library/techarticle/alazzawe/ 0112alazzawe2.html GlassFish licensing information: https://glassfish.dev.java.net/public/CDDL+GPL.html Java SDK 6 download site: http://java.sun.com/javase/downloads/index.jsp GlassFish Application Server download site: https://glassfish.dev.java.net/public/downloadsindex.html Apache Maven website: http://maven.apache.org/ Apache Maven installation instructions: http://maven.apache.org/download.html Seam website: http://seamframework.org/ PMD Source Code Analysis tool http://pmd.sourceforge.net WebSphere migrations: Migrating WebLogic server and application configurations to WebSphere Application Server http://www.ibm.com/developerworks/websphere/library/techarticles/070 6_vines/0706_vines.html
Related publications
379
Application Verification KIT (AVK) http//java.sun.com/j2ee/verified/avk_enterprise.html Set up WebLogic test server in RAD http://www.ibm.com/developerworks/rational/library/06/1121_tarte/ind ex.html?ca=drs
380
Index
Symbols
39 rerunning 129 rule settings 119 rules sets 119 running 182 scope tab 118 Software Analyzer 118 XML File Review tab 120 application packaging 15 application portability 15 applications covered in this book 3 ASF 276 AUTO_INCREMENT columns 19 automated tests 328 Available WebSphere Application Server Feature Packs 55
Numerics
2-phase commit transactions 104
A
abstraction 327 administrative agent 47 administrative scripting 4 Ajax Development Toolkit 63 Ajax implementations 63 Ajax(Asynchronous JavaScript and XML) 61 analyzing migration problems 211, 240, 261 Ant 101, 200 Ant build script 166 Apache Log4j 17 Apache Maven 201 Apache Software Foundation 276 Apache Tomcat 278 Apache Tomcat 6.0.26 2 Apache Wink 62 application class loader 10 application infrastructure 28 application integration 29 application migration 82 Application Migration Tool analyze 120 analyze entire workspace 118 analyze last launched 129 Class-Path Review tab 120 configuring and running 116 downloading 95 fixing errors reported by 122 installing 95 Java code review 116 Java Code Review tab 120 JBoss migration 220 JSP Code Review tab 120 overview 103 plug-in 95 Quickfix All 132
B
Bean-Managed Persistence (BMP) EJB 4 BM ILOG Core Products & Technologies 30 bootstrap 9 business process management 29 business rule management systems 29
C
CalculatorWS 318 classloader modes 11 classloaders 9 ClassNotFound 9 CLASSPATH 9 cleanup phase 81 Cloudscape 42 CMP EJB 2.0 104, 166 compile time dependencies. 240 configuring JMS 146, 188 Session Beans and Container Managed Beans 194 the datasource in WebSphere 294 container-managed persistence (CMP) 13 container-managed transactions 337 Customer Information Control System (CICS) Transaction Server 28
381
D
Data Access Objects (DAO) 342 database schema 13 database servers 42 database-related issues 19 DB2 JDBC driver 168 deploying Java Pet Store on GlassFish 305 deployment descriptors 12, 303 deployment manager 51 design patterns 341 development and deployment tools 63 development environment issues 26 Differences in Java EE implementations 8 Directory servers 43 Dojo Foundation 63 Dojo project 63
G
generating Seam application using seam-gen 230 getting help 77 GlassFish 2.0 2 GlassFish migration 301 CalculatorWS 318 dependency injection 303 deploying Java Pet Store on GlassFish 305 downloading 304 installation 304 Installation and configuration 304 Java Pet Store 2.0 Reference application 303 licensing information 302 major issues 322 prerequisites and assumptions 302 Web Services application 318 GNU General Public License (GPL) 279, 302 graphical user interface (GUI) 36 GUI testing 329
E
Easy JSP Forum application 290 downloading 290 Easy JSP Forum migration 289 Eclipse IDE 95 downloading 95 EJB module 16 EJB to RDB mapping tool 19 EJBHomeFactory 342 enable session persistence 338 enterprise java beans (EJB) 4 enterprise java beans (EJBs) 31 enterprise resource planning (ERP) 36 Entity and Stateless Session EJB 2.0 104 Evolving Java application development standards 38
H
HSQL 19
I
IBM Business Partner 77 IBM Business Partner Technical Strategy and Enablement (BPTSE) 77 IBM DB2 Server Express Edition 97 IBM DB2 UDB 8.2 101 IBM ILOG ODM Enterprise 30 IBM ILOG OPL-CPLEX Development Bundles 30 IBM POWER family of processors 39 IBM Rational Application Developer for WebSphere Software 88 IBM Rational Application Developer V6 102 IBM runtime environment 30 IBM Software Services for WebSphere (ISSW) 77 IBM System i (iSeries) 39 IBM System z processors 39 IBM Tivoli Directory Server 43 IBM WebSphere 27 IBM WebSphere Application Server Feature Packs development and deployment tools 63 IBM WebSphere Application Server Feature Pack for Web 2.0 61 IBM WebSphere Application Server V7 101 IBM WebSphere Developer Services 78 IBM WebSphere Platform 28
F
factory design pattern 343 Feature Pack for XML 56 feature packs 55 Federated Repository Configuration 43 FileNet Business Process Manager 29 fixing Hibernate configuration 263 JNDI lookup 212, 243 persistence configuration 245 persistence settings 216 runtime dependencies 212 the web module dependencies 211
382
IBM z/OS Integrated Security Services 43 IBM z/OS.e Security Server 43 implementation considerations 79 implementation phases 80 importing HAR contents in source form 270 importing the application EAR file 175 importing the application source code 177 importing the EAR file and source code to RAD 205, 235, 258 importing the Trade EAR file 114 installing Apache Tomcat 278 Application Migration Tool V1.1 113 DB2 Universal Database Express Edition 98 IBM Installation Manager 89 IBM Rational Application Developer for WebSphere Software 88 installing the latest fixpack 90 JBoss Application Server 202 JBoss Application Server Version 4.2.3 203 JBoss Application Server Version 5.1.0 202 integrated test environment 253, 269 Intel EM64T or AMD Opteron 39 Intel Pentium processor 39 Intel Itanium 2 processor 39 intelligent provisioning 46 interoperability and integrations 74 iterative model 350
J
J2EE 2 J2EE 1.4 to Java EE 5 migration considerations 21 J2SE 1.4 101 Jakarta Commons Logging V1.2 12 JAR (Java ARchive) 15 Java BluePrints web site 303 Java Database Connectivity (JDBC) 4 Java DataBase Connectivity (JDBC) API 38 Java Development Kit (JDK) 6.0 37 Java EE application clients 20 Java EE application server compatibility 8 Java EE Connector Architecture (JCA) 4 Java Mail 4 Java Management Extensions (JMX) 4 Java Naming and Directory Interface (JNDI) 120 Java Native Interface (JNI) migrating 18 Java Persistence API (JPA) 4, 38, 45 Java Pet Store Reference application 303
Java Platform Enterprise Edition (Java EE) 36 Java Platform Enterprise Edition (Java EE) 36 Java Platform name changes 36 Java SE and EE technologies covered 4 Java Server Faces (JSF) 22, 333 Java Server Page (JSP) 22, 104, 166 taglibs 4 Java Servlet 2.5 (JSR 154) 38 Java source code 18 Java-based applications 30 JavaDoc 329 JavaScript Object Notation (JSON) 62 JavaServer Pages (JSR 245) 38 JBoss 4.2 and JBoss 5.1 2 JBoss Application Server 202 JBoss migration Configuring precompiled Java archive (JAR) libraries 207 creating and populating the database 256 creating the datasource 247 fixing the problems 211 JBoss Application Server installation 202 JNDI lookup 212 JSF-EJB3 sample application 204 managing runtime dependencies 212 migrating a Seam application 226 migrating JSF-EJB3 Sample Application from JBoss 203 migrating Online Brokerage application 254 migration approach 204, 227 persistence settings 216 preparing the environment 200 running the application 222 specifications level migration 222 verifying generated seam-gen application 234 web module dependencies 211 WebSphere built-in JPA provider 224 JBoss Seam Framework 203 JCL 12 JDBC 2.1 104 JDBC resources 25 JDom 12 JMS 21 JMS 1.0.2 104 JMS resources 24 Job manager 50 JUnitEE 166
Index
383
K
Kerberos 55
L
layered application architecture 327 LDAP Server 43 Local Area Networks (LANs) 51 local EJB interface 16 Log4j.jar 17 Lotus Domino Enterprise Server 43 LTPA WSSecurity Default 53
O
Object Oriented (OO) approach 347 offline update 91 Online Brokerage application 255 online update 90 Open JPA 4 OpenJPA 204 OpenLDAP 43 operating systems 40 optimization 30 Oracle WebLogic 9.2 2 OSGi Blueprint service specification 56
M
mapping tool 19 MDB (message-driven bean) 120 Message Driven Beans 2.0 104, 166 messaging 53 metadata 52 Microsoft Access (*mdb) 290 migrate phase 80 migrating a Seam application generated with seam-gen 226 migrating Web Services applications 322 migration considerations 73 implementation 79 problems 17 process 23 process overview 70 to WebSphere Application Server 306, 320 Tomcat 289 WebLogic 169 migration assessment 75 migration assessment report 76 migration issues 3 migration planning 77 migration project plan 78 migration questionnaire review meeting 75 migration questionnaires 75 migration tools 2 MvnForum application 280 downloading 280 MvnForum migration 279 MySQL 19
P
packaging 33 packaging the application 284 Parallel Sysplex 36 PA-RISC processor 39 partial migration 72 Passport Advantage 78 performance tuning and optimization 84 PetStore 166 PicoContainer 344 plain old Java objects (POJOs) 37 portability 197 portals 30 Portlet 2.0 API 46 post deployment 83 prepare phase 80 preparing database schema 227 primary key generation 104 Processor Value Units (PVUs) 34 progressive disclosure 37 proprietary solutions 326
Q
QoS policies 52, 276 Quick Preview Editor 131
R
Rational Application Developer for Assembly and Deploy V7.5 64 Rational Application Developer for WebSphere Software V7.5 66
N
NetBeans installation file 319
384
Rational Application Developer V7.5 86 Rational Software Analyzer technology 95 Rational Software Delivery Platform (SDP) 66 Rational Unified Process (RUP) 5, 351 Redbooks Web site 380 Contact us xxiii Relational Database Synchronization (RDB) 13 Remote EJB interface 16 Resource Adapter archives (RAR) 15 resource definitions 24 RESTful Web services 61 roles and responsibilities 77 Rollout phase 81 rule violation 116 Running CalculatorWS on NetBeans 6.8 and GlassFish 3 319 runtime dependencies. 261 runtime migration 83 runtime migration issues 23
systems management 46
T
test phase 81 thin clients 20 timer and startup services 4 Tomcat migration configuring the source environment 280 creating a new datasource 285 creating the DB2 database 280, 291 default connection pool 282 migrating the Easy JSP Forum application to WebSphere 291 migrating the MvnForum application 282 migration approach 279, 289 Trade 3.1 application 100 types of migrations 71
U S
schema mapping 13 scope of this book 2 Seam application 226 security resources 25 Service Component Architecture (SCA) 4 Service Data Objects (SDO) 38 Service Locator 342 service-oriented architecture (SOA) 27, 61 Servlet 2.3 104, 166 servlets 22 singletons 343 software engineering 341 software installation 277 SPARC workstations 39 Spring Framework 344 SSL WSTransaction 53 Stand Alone LDAP User Registry Configuration 43 standard logging framework 340 standards 44 Stateful Session Beans 2.0 166 Stateless Session Beans 2.0 166 Struts 333 Sun Java Directory Server 43 Sun Microsystems 303 Support from IBM 77 Sybase 42 System z cluster 36 undocumented code 329 Unified Modeling Language (UML) 349 use of native code 18 using vendor-specific features 12 utility.jar 17
V
vendor-specific deployment descriptors 14 Verifying JSF-EJB3 sample application 204
W
Waterfall model 350 Web 2.0 to SOA Connectivity 62 Web application module 16 Web application module (WAR) 15 Web module class loader 11 Web servers 41 Web Services 22, 45 WebLogic classpath 108 WebLogic migration 178 configuring the source environment 186 creating a JMS connection factory 171 creating a new data source 109 creating a new database schema 180 creating a new datasource 156 creating a new JavaMail session 171 creating a new JMS server 170 creating the JMS module 170
Index
385
creating the JMS queues 170 creating the JMS resources 110 creating the sample application database 107, 168 migrating Trade Application J2EE Level 143 xpetstore J2EE Specification Level 185 migrating EJBs 158 migrating from older versions 200 migrating the sample application 113 migrating to WebSphere built-in JPA provider (optional) 224 migration approach 105, 166 Oracle WebLogic Server 9.2 99 release date 100 Oracle WebLogic Server 9.2 installation 102 Oracle WebLogic Server 9.2 migration 100 assumptions 101 prerequisites 101 prerequisites and assumptions 101, 276 specifying Web Application References 161 Trade for Oracle WebLogic Server 9.2 migration 104 xPetstore EJB application downloading 168 xPetstore EJB migration 166 WebLogic migration configuring WebSphere Application Server V7 145 weblogic-cmp-rdbms-jar.xml 141 weblogic-ejb-jar.xml 141 WebSphere 34 WebSphere Adapters 29 WebSphere Application Server Restarting 162 WebSphere Application Server - Express V7.0 34 WebSphere Application Server - Express V7.0 34 WebSphere Application Server Community Edition 28 WebSphere Application Server Family 28 WebSphere Application Server Feature Pack 55 WebSphere Application Server for Developers V7.0 3334 WebSphere Application Server for z/OS V7.0 33, 3536 WebSphere Application Server for z/OS V7.0 3536 WebSphere Application Server Hypervisor Edition 28 WebSphere Application Server Network Deploy-
ment V7.0 35 WebSphere Application Server Network Deployment V7.0 35 WebSphere Application Server V7 30, 34 centralized installation 53 Feature Packs 55 IBM WebSphere Application Server Feature Pack for Communications Enabled Applications 57 IBM WebSphere Application Server Feature Pack for OSGi Applications and Java Persistence API (JPA) 2.0 Open Beta 55 more information 30 new opportunities 84 overview 30 packaging 33 platform 28 security 54 supported hardware and software 39 systems management 46 Web services 52 what is new? 43 WebSphere Business Compass 29 WebSphere Business Events 29 WebSphere Business Modeler 29 WebSphere Business Monitor 29 WebSphere Business Services Fabric 29 WebSphere CloudBurst Appliance 28 WebSphere DataPower B2B Appliance XB60 29 WebSphere DataPower Integration Appliance XI50 29 WebSphere DataPower Low Latency Appliance XM70 29 WebSphere DataPower XML Security Gateway XS40 29 WebSphere Dynamic Process Edition 29 WebSphere education 78 WebSphere Enterprise Service Bus 29 WebSphere Extended Deployment Compute Grid 28 WebSphere eXtreme Scale 28 WebSphere ILOG Business Rule Management Systems 29 WebSphere ILOG JRules BRMS 29 WebSphere ILOG Rules for .NET BRMS 29 WebSphere Industry Content Packs 29 WebSphere Integration Developer 29 WebSphere Message Broker 29 WebSphere MQ 29
386
WebSphere MQ File Transfer Edition 29 WebSphere Partner Gateway 29 WebSphere Portal Server 30 WebSphere Process Server 29 WebSphere Rapid Deployment 67 WebSphere Real Time 28 WebSphere Sensor Events 29 WebSphere Service Registry and Repository 29 WebSphere sMash 28 WebSphere Transformation Extender Industry Packs 29 WebSphere Virtual Enterprise 28 what is not covered in this book 4 which tools to use 68 Wide Area Networks (WANs) 51 Windows Active Directory 43 Windows Active Directory Applications Mode 43 WORA (Write Once, Run Anywhere) 7 WS-Addressing 53 wsadmin 47 WSHTTPS 53 WS-I RSP ND 53 WS-ReliableMessaging persistent 53
X
XDoclet 166 XDoclet tags 26 xPetstore EJB 3.1.3 100
Index
387
388
Back cover
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.