An End-To-End Migration Guide5
An End-To-End Migration Guide5
Seong Steve Yu Barry Searle Dana Duffield Wayne Beaton Tom Alcott Radhika Iyer David Dhuyvetter Sharad Cocasse Jack Snyder
ibm.com/redbooks
International Technical Support Organization Migrating to WebSphere V5.0 An End-to-End Migration Guide April 2003
SG24-6910-01
Note: Before using this information and the product it supports, read the information in Notices on page xi.
Second Edition (April 2003) This edition applies to: WebSphere Studio Application Developer V5.0 Early Availability (EA) WebSphere Application Server V5.0 Base and Network Deployment packages VisualAge for Java V3.5 WebSphere Studio Classic V3.5 WebSphere Studio Application Developer V4.0 WebSphere Application Server V3.5 Standard Edition and Advanced Edition WebSphere Application Server V4.0 Advanced Single Server Edition and Advanced Edition
Copyright International Business Machines Corporation 2002 2003. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii The team that wrote this redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi Comments welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Summary of changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix April 2003, Second Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 How this book is organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2.1 WebSphere Application Server migration paths . . . . . . . . . . . . . . . . . 4 1.2.2 Application API migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2.3 J2EE applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.2.4 Java technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3 WebSphere V5 architecture primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3.1 V5.0 architecture terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3.2 Application server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.3.3 Nodes and node agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3.4 Deployment manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.3.5 Cells and clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.4 Quick reference guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.4.1 Upgrade product prerequisites to support versions . . . . . . . . . . . . . 17 1.4.2 Migrate to IBM WebSphere Application Server Version 5.0 . . . . . . . 17 1.4.3 Migrate administrative configurations . . . . . . . . . . . . . . . . . . . . . . . . 18 1.4.4 Migrate application code and scripts to new API levels . . . . . . . . . . 18 1.4.5 Redeploy applications on Version 5.0 . . . . . . . . . . . . . . . . . . . . . . . . 19 Chapter 2. Migrating strategy and planning . . . 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 The evolution of J2EE . . . . . . . . . . . . . . . 2.1.2 Migration as a form of change. . . . . . . . . 2.1.3 Elements of migration . . . . . . . . . . . . . . . 2.2 Migration strategy . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Divide and conquer . . . . . . . . . . . . . . . . . 2.2.2 Vertical-slice migration . . . . . . . . . . . . . . ...... ...... ...... ...... ...... ...... ...... ...... ....... ....... ....... ....... ....... ....... ....... ....... ...... ...... ...... ...... ...... ...... ...... ...... .. .. .. .. .. .. .. .. 21 22 22 23 23 28 28 29
iii
2.2.3 Dump and chase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.2.4 Run, right, fast, small . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.2.5 Before you migrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.3 Migration scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 2.3.1 Scenario 1: Single application, single server, one machine . . . . . . . 39 2.3.2 Scenario 2: Single application, single server, two machines . . . . . . 40 2.3.3 Scenario 3: Multiple applications on a single server . . . . . . . . . . . . . 41 2.3.4 Scenario 4: Single application on multiple servers . . . . . . . . . . . . . . 41 2.3.5 Scenario 5: Multiple applications on multiple servers (horizontal) . . 46 2.3.6 Scenario 6: Multiple applications on multiple servers (vertical). . . . . 52 2.3.7 Multiple tiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 2.4 Migrating from Version 3.5 to 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 2.4.1 Development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 2.4.2 Code organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 2.4.3 VisualAge for Java features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 2.4.4 Source code management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 2.4.5 Build process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 2.4.6 Interoperability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 2.4.7 Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 2.5 Migrating from Version 4.0 to 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 2.5.1 Development environment and code organization . . . . . . . . . . . . . . 72 2.5.2 Interoperability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 2.5.3 Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 2.6 Migration plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 2.6.1 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 2.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Chapter 3. Development tool migration (GA) . . . . . . . . . . . . . . . . . . . . . . . 81 3.1 Important updates to Version 5 product . . . . . . . . . . . . . . . . . . . . . . . . . . 83 3.2 Targeting WebSphere Application Server V4.0.x versus V5.0 . . . . . . . . . 83 3.3 Migrating from WebSphere Studio Application Developer V4.0.x . . . . . . . 84 3.3.1 Differences between WebSphere Studio Application Developer Version 4.0.x and Version 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 3.3.2 WebSphere Application Server changes and Servlet/JSP conversion tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 3.3.3 Internal changes from Version 4.0.3 . . . . . . . . . . . . . . . . . . . . . . . . . 86 3.3.4 Migrating projects using a software configuration management (SCM) system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 3.3.5 Migrating by exporting and importing your projects . . . . . . . . . . . . . 92 3.3.6 Migrating projects using an existing Version 4.0.x workspace . . . . . 92 3.3.7 Migrating J2EE project structures and/or J2EE specification levels . 95 3.4 Migrating from WebSphere Studio Application Developer Version 5 Early Availability or Beta versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
iv
3.5 Migrating from WebSphere Studio Classic to WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 3.5.1 Creating a new single-server stage for migration . . . . . . . . . . . . . . . 97 3.5.2 Creating a Web configuration descriptor file . . . . . . . . . . . . . . . . . . . 98 3.5.3 Exporting a migration JAR file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 3.5.4 Importing the migration JAR file into WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 3.5.5 Testing your migrated application on a test server . . . . . . . . . . . . . 100 3.6 Migrating from VisualAge for Java to WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 3.6.1 Differences between VisualAge for Java and WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 3.6.2 Team support in WebSphere Studio Application Developer . . . . . . 102 3.6.3 Migrating from VisualAge for Java . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.7 Migrating from WebSphere Studio Application Devloper (Linux) . . . . . . 108 3.8 Migrating enterprise beans from VisualAge for Java to WebSphere Studio Application Developer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 3.8.1 VisualAge for Java EJB Export Tool (migrating map/schema from EJB 1.0 to EJB 1.1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 3.8.2 VisualAge for Java Version 3.5.3 EJB 1.0 JARs versus VisualAge for Java Version 4.0 EJB 1.1 JARs . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 3.8.3 Moving multiple VisualAge for Java EJB groups into WebSphere Studio Application Developer EJB projects . . . . . . . . . . . . . . . . . . . . . . . . 111 3.8.4 Migrating your enterprise beans . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 3.8.5 Known problems and workarounds . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.8.6 Locating EJB information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.8.7 Migrating EJB access beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 3.8.8 Migrating custom finder helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 3.9 Migrating from EJB 1.0 to EJB 1.1 or to EJB 2.0 . . . . . . . . . . . . . . . . . . 116 3.9.1 Migrating code from EJB 1.0 to EJB 1.1 . . . . . . . . . . . . . . . . . . . . . 116 3.9.2 Converting projects from EJB 1.x to EJB 2.0 . . . . . . . . . . . . . . . . . 118 3.9.3 Migrating code from EJB 1.x to EJB 2.0 . . . . . . . . . . . . . . . . . . . . . 118 3.10 Migrating from VisualAge for Java Visual Composition Editor to Visual Editor for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 3.10.1 Saving enhanced design-time metadata from VisualAge for Java 120 3.10.2 Completing the migration (importing into WebSphere Studio) . . . 121 3.11 Converting from VisualAge for Java Persistence Builder to EJB 2.0 . . 121 3.12 Build setup (library JARs, dependent project JARs, Ant builds) . . . . . . 125 3.12.1 Java library JARs and third-party external JARs. . . . . . . . . . . . . . 125 3.12.2 Optimizing multi-project builds using dependent project JARs . . . 127 3.12.3 Automated production builds using Ant. . . . . . . . . . . . . . . . . . . . . 128 3.13 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Contents
Chapter 4. Development tool migration (EA) . . . . . . . . . . . . . . . . . . . . . . 133 4.1 Important updates to Version 5 product and migration documentation . . 134 4.1.1 eFix to WebSphere Studio Application Developer V5 EA . . . . . . . . 135 4.1.2 Migration guide updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 4.2 Targeting WebSphere Application Server V4.0.x versus V5.0 . . . . . . . . 140 4.3 Migrating from WebSphere Studio Application Developer V4.0.x . . . . . . 141 4.3.1 Differences between WebSphere Studio Application Developer Version 4.0.x and Version 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 4.3.2 WebSphere Application Server changes and Servlet/JSP conversion tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 4.3.3 Internal changes from Version 4.0.3 . . . . . . . . . . . . . . . . . . . . . . . . 143 4.3.4 Migrating projects using a software configuration management (SCM) system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 4.3.5 Migrating by exporting and importing your projects . . . . . . . . . . . . 150 4.3.6 Migrating projects using an existing Version 4.0.x workspace . . . . 150 4.3.7 Migrating J2EE project structures and/or J2EE specification levels 153 4.4 Migrating from WebSphere Studio Application Developer V5 Beta . . . . 153 4.5 Migrating from WebSphere Studio Classic to WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 4.5.1 Creating a new single-server stage for migration . . . . . . . . . . . . . . 155 4.5.2 Creating a Web configuration descriptor file . . . . . . . . . . . . . . . . . . 155 4.5.3 Exporting a migration JAR file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 4.5.4 Importing the migration JAR file into WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 4.5.5 Testing your migrated application on a test server . . . . . . . . . . . . . 157 4.6 Migrating from VisualAge for Java to WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 4.6.1 Differences between VisualAge for Java and WebSphere Studio Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 4.6.2 Team support in WebSphere Studio Application Developer . . . . . . 159 4.6.3 Migrating from VisualAge for Java . . . . . . . . . . . . . . . . . . . . . . . . . 159 4.7 Migrating enterprise beans from VisualAge for Java to WebSphere Studio Application Developer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 4.7.1 VisualAge for Java EJB Export Tool (migrating map/schema from EJB 1.0 to EJB 1.1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 4.7.2 VisualAge for Java Version 3.5.3 EJB 1.0 JARs versus VisualAge for Java Version 4.0 EJB 1.1 JARs . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 4.7.3 Moving multiple VisualAge for Java EJB groups into WebSphere Studio Application Developer EJB projects . . . . . . . . . . . . . . . . . . . . . . . . 167 4.7.4 Migrating your enterprise beans . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 4.7.5 Known problems and workarounds . . . . . . . . . . . . . . . . . . . . . . . . . 170 4.7.6 Locating EJB information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 4.7.7 Migrating EJB access beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
vi
4.7.8 Migrating custom finder helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 4.8 Migrating from EJB 1.0 to EJB 1.1 or to EJB 2.0 . . . . . . . . . . . . . . . . . . 172 4.8.1 Migrating code from EJB 1.0 to EJB 1.1 . . . . . . . . . . . . . . . . . . . . . 172 4.8.2 Converting projects from EJB 1.x to EJB 2.0 . . . . . . . . . . . . . . . . . 174 4.8.3 Migrating code from EJB 1.x to EJB 2.0 . . . . . . . . . . . . . . . . . . . . . 175 4.9 Migrating from VisualAge for Java Visual Composition Editor to Visual Editor for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 4.9.1 Saving enhanced design-time metadata from VisualAge for Java . 176 4.9.2 Completing the migration (importing into WebSphere Studio) . . . . 177 4.10 Converting from VisualAge for Java Persistence Builder to EJB 2.0 . . 177 4.11 Build setup (library JARs, dependent project JARs, Ant builds) . . . . . . 178 4.11.1 Java library JARs and third-party external JARs. . . . . . . . . . . . . . 178 4.11.2 Optimizing multi-project builds using dependent project JARs . . . 181 4.11.3 Automated production builds using Ant. . . . . . . . . . . . . . . . . . . . . 181 4.12 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Chapter 5. HTTP Server Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 5.1 V3.5 HTTP Server options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 5.1.1 OSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 5.1.2 Servlet Redirector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 5.1.3 OSE plug-in to V5.0 plug-in mapping . . . . . . . . . . . . . . . . . . . . . . . 187 5.1.4 V4.0 HTTP Server options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 5.1.5 V4.0 HTTP Server Plug-in to V5.0 plug-in mapping . . . . . . . . . . . . 187 5.2 Generation of the V5.0 plug-in configuration . . . . . . . . . . . . . . . . . . . . . . 190 5.3 Apache/IBM HTTP Server migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 5.4 iPlanet/Sun migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 5.5 Domino migration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 5.6 IIS migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Chapter 6. WebSphere system management . . . . . . . . . . . . . . . . . . . . . . 197 6.1 WebSphere Administrative Consoles . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 6.1.1 Version 3.5 GUI/Administrative Console . . . . . . . . . . . . . . . . . . . . . 198 6.1.2 Version 4.0 GUI/Administrative Console . . . . . . . . . . . . . . . . . . . . . 199 6.1.3 Version 5.0 GUI/Administrative Console . . . . . . . . . . . . . . . . . . . . . 200 6.1.4 Common Administrative Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 6.2 Current usage of XMLConfig and wscp. . . . . . . . . . . . . . . . . . . . . . . . . . 204 6.3 wsadmin primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 6.3.1 Background on BSF, JMX, and WebSphere scripting . . . . . . . . . . 207 6.3.2 wsadmin command syntax and usage . . . . . . . . . . . . . . . . . . . . . . 211 6.3.3 WebSphere objects available to scripts . . . . . . . . . . . . . . . . . . . . . 214 6.3.4 Script Launcher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 6.3.5 Properties used by scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 6.3.6 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Contents
vii
6.3.7 Using templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 6.3.8 Modifying attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 6.4 Migration mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 6.4.1 Migration steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 6.4.2 Classification of scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 6.4.3 Migration from V3.5 to V5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 6.4.4 Migration from V4.0 to V5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Chapter 7. Migration assistants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 7.1 Development assistants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 7.1.1 MigrateWC - JSP and Servlet migration assistant . . . . . . . . . . . . . 246 7.1.2 ejbdeploy - deploying EJBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 7.1.3 earconvert - J2EE application conversion . . . . . . . . . . . . . . . . . . . . 252 7.1.4 mb2mdb - JMS listener application conversion. . . . . . . . . . . . . . . . 253 7.1.5 CACT - Class API checker tool introduction . . . . . . . . . . . . . . . . . . 254 7.2 System administration migration assistants . . . . . . . . . . . . . . . . . . . . . . 256 7.2.1 ClientUpgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 7.2.2 WASPreUpgrade. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 7.2.3 WASPostUpgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Chapter 8. WebSphere system configuration and runtime migration . . 263 8.1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 8.1.1 Supported versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 8.1.2 OS upgrade scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 8.2 Migration steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 8.2.1 Planning for migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 8.2.2 Updating the prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 8.2.3 Installation and migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 8.2.4 After migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 8.2.5 Client JAR upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 8.3 WebSphere Application Server V5.0 migration scenario . . . . . . . . . . . . 269 8.3.1 Mapping details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 8.3.2 WebSphere Application Server V3.5 to V5.0 migration . . . . . . . . . 272 8.3.3 WebSphere Application Server V4.0 to V5.0 migration . . . . . . . . . 275 8.4 Test and integration/production environment . . . . . . . . . . . . . . . . . . . . . 276 8.4.1 Coexistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 8.4.2 Interoperability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 8.4.3 Migration of the network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 8.4.4 Network Deployment migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Chapter 9. Development environment migration examples (GA) . . . . . . 287 9.1 Migrating from WebSphere 3.5 Development Environment to WebSphere Studio 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 9.1.1 Example: VisualAge for Java JSP/Servlet sample (LeapYear) . . . . 288
viii
9.1.2 Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean) . . . . . . . . . . . . . . . . 292 9.1.3 Example: WebSphere Studio Classic Version 4.0 Web application (YourCo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 9.1.4 Example: Migrating VisualAge for Java JSP/Servlet samples example to EJB 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 9.2 Migrating from WebSphere Studio 4.0 WebSphere Studio 5.0 . . . . . . . . 308 9.2.1 Example: Migrating YourBank using the Export/Import method . . . 309 9.2.2 Example: Migrating YourBank using the CVS method . . . . . . . . . . 311 9.2.3 Example: Running YourBank in WebSphere Version 5.0 Test Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 9.2.4 Example: Migrating YourBank to J2EE 1.3 . . . . . . . . . . . . . . . . . . . 318 Chapter 10. Development environment migration examples (EA) . . . . . 323 10.1 Migrating from WebSphere 3.5 Development Environment to WebSphere Studio 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 10.1.1 Example: VisualAge for Java JSP/Servlet sample (LeapYear) . . . 324 10.1.2 Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean) . . . . . . . . . . . . . . . . 327 10.1.3 Example: WebSphere Studio Classic Version 4.0 Web application (YourCo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 10.1.4 Example: Migrating VisualAge for Java JSP/Servlet samples example to EJB 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 10.2 Migrating from WebSphere Studio 4.0 WebSphere Studio 5.0 . . . . . . . 344 10.2.1 Example: Migrating YourBank using the Export/Import method . . 345 10.2.2 Example: Migrating YourBank using the CVS method . . . . . . . . . 348 10.2.3 Example: Running YourBank in WebSphere Version 5.0 Test Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 10.2.4 Example: Migrating YourBank to J2EE 1.3 . . . . . . . . . . . . . . . . . . 355 Chapter 11. System and runtime migration examples. . . . . . . . . . . . . . . 361 11.1 Migrating the WebSphere runtime to V5.0 . . . . . . . . . . . . . . . . . . . . . . 362 11.1.1 Example: V3.5 to V5.0 manual migration . . . . . . . . . . . . . . . . . . . 363 11.1.2 Example: V4.0 to V5.0 manual migration . . . . . . . . . . . . . . . . . . . 381 11.1.3 Example: V3.5/V4.0 to V5.0 automated migration . . . . . . . . . . . . 383 11.2 Interoperability and coexistence between V3.5/V4.0 and V5.0 . . . . . . . 391 11.2.1 Example: V3.5 and V5.0 interoperability . . . . . . . . . . . . . . . . . . . . 391 11.2.2 Example: V4.0 and V5.0 interoperability . . . . . . . . . . . . . . . . . . . . 398 11.2.3 Example: V3.5/V4.0 and V5.0 coexistence . . . . . . . . . . . . . . . . . . 399 Appendix A. wsadmin.properties file sample . . . . . . . . . . . . . . . . . . . . . . 405 Appendix B. Comparing WebSphere Application Server versions . . . . 409
Contents
ix
Appendix C. Installing the Big3 application . . . . . . . . . . . . . . . . . . . . . . . 413 Deploying the Big3 application in WebSphere V3.5 . . . . . . . . . . . . . . . . . . . . 414 Deploying the Big3 Application in WebSphere V4.0 . . . . . . . . . . . . . . . . . . . 420 Appendix D. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 System requirements for downloading the Web material . . . . . . . . . . . . . 424 How to use the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Related publications . . . . . . . . . . . . . . . . . . . . . . IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other resources . . . . . . . . . . . . . . . . . . . . . . . . Referenced Web sites . . . . . . . . . . . . . . . . . . . . . . How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . IBM Redbooks collections . . . . . . . . . . . . . . . . . ...... ...... ...... ...... ...... ...... ....... ....... ....... ....... ....... ....... ...... ...... ...... ...... ...... ...... . . . . . . 425 425 425 427 431 431
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
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 illustrates 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. 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 IBM's application programming interfaces.
xi
Trademarks
The following terms are trademarks of the International Business Machines Corporation in the United States, other countries, or both: iSeries z/OS zSeries AIX Domino DB2 Everyplace HotMedia IBM ibm.com OS/390 Passport Advantage Redbooks Redbooks (logo) RS/6000 S/390 System/390 TXSeries VisualAge WebSphere
The following terms are trademarks of other companies: ActionMedia, LANDesk, MMX, Pentium and ProShare are trademarks of Intel Corporation in the United States, other countries, or both. Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. C-bus is a trademark of Corollary, Inc. in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. SET, SET Secure Electronic Transaction, and the SET Logo are trademarks owned by SET Secure Electronic Transaction LLC. Other company, product, and service names may be trademarks or service marks of others.
xii
Preface
The creation of this Migration Guide has been a result of tremendous input from customers requesting guidance on migrating their WebSphere development environment, including applications, integration, and test and production environments. This guide has been compiled using the collective experience of many experts who have supported thousands of installations and migrations. Betsy Matthew Director, WebSphere Customer Support This IBM Redbook has been written to assist in the end-to-end migration of WebSphere Application Server installation. The end-to-end migration path includes the migration of the development environment, the test/integration environment, and the production environment using software engineering methodologies. This guide presents the best practices in migration strategy and planning, migration tools, and practical migration examples. The development environment migration topics include migration from VisualAge for Java and WebSphere Studio Classic to WebSphere Studio Application Developer V5 as well as API migration tools. Step-by-step instructions for many practical migration examples are provided. This migration guide was written and tested with the WebSphere Studio Application Developer V5.0 Early Availability (EA) edition. The WebSphere Application Server migration paths include Version 3.5 to Version 5.0 and Version 4.0 to Version 5.0. The WebSphere Versions 3.5 and 4.0 Single Server Edition and Advanced Edition are mapped to Version 5.0 Base package and Network Deployment package respectively. The WebSphere system and configuration migration topics include the WebSphere system migration, HTTP Server Plug-in migration, migration of XMLConfig and WebSphere to wsadmin scripts, and migration examples using coexistence and interoperability. This guide was written specifically for the WebSphere Application Server on the distributed platforms. This guide does not cover the migration of WebSphere Enterprise edition, WebSphere Express, WebSphere for OS/390, WebSphere for zSeries, WebSphere for iSeries, or the migration of other vendor's application servers. Some of these topics are covered in other migration guides, listed in Related publications on page 425.
xiii
xiv
mainframe-based and distributed systems. He has written and presented extensively on a number of WebSphere runtime and security issues. Radhika Iyer is a software engineer for the IBM Software Group in Austin. She has over four years of experience in Java development and J2EE technology. Radhika has been supporting WebSphere software for the last two years. She holds a Bachelor's degree in Mathematics from the University of Mumbai, India. Her areas of expertise include Java programming, WebSphere Application Server development, testing, and troubleshooting, etc. Before joining IBM, she developed Java applications for Wipro, India. David Dhuyvetter is a Software Engineer in IBM San Diego. He has seven years of experience in transaction processing systems. David holds a Bachelor of Arts degree in Philosophy from California State University, Long Beach and a Master of Science degree in Computer Science from California State Polytechnic University, Pomona. Sharad Cocasse is a Staff Software Engineer on the WebSphere Execution Team in Rochester. His experience includes over four years of writing object-oriented applications and developing/delivering WebSphere education to customers and IBM field technical personnel. Most recently, he has been directly helping customers succeed with their use of the WebSphere Application Server. He has assisted customers with WebSphere-based proofs-of-concept and has provided advanced technical support for mission-critical WebSphere deployments. He has also coauthored a number of WebSphere-related publications. Sharad holds a Masters degree in Electrical Engineering from the University of Alabama. John (Jack) Snyder is a Senior I/T Architect in IBM Pittsburgh. He has over 30 years of experience in computer systems and the engineering field of mining and computer systems. Jack holds B.S., M.S., and Ph.D. degrees in engineering. His areas of expertise include WebSphere Application Server, Java, and process control. Contributing authors: Richard Kaskan is a Software Engineer in the IBM Software Group in Austin. He has worked in the WebSphere Development system management area. Ken Klingensmith is a Senior IT Consultant in the United States. He has been a member of the Worldwide WebSphere Technical Sales Support team since its inception in late 1998. Before he started working with WebSphere, Ken was a Senior Systems Engineer for the IBM Transarc Lab, supporting TXSeries for the Western Region, South America, and Asia Pacific. Ken has both a bachelor of science and a doctorate in physical chemistry. His background includes over 14 years of application design, development and project management on both
Preface
xv
mainframe-based and distributed systems across a wide variety of industries and platforms. He has written and lectured extensively on WebSphere Application Server since the product's first launch at the beginning of 1999, and continues to work on the product. Technical reviewers: Rob High is the WebSphere Chief Architect and Distinguished Engineer, IBM Austin. Leigh Williamson is a Senior Software Architect in IBM Austin. He has 20 years of experience in the software engineering field. Leigh holds a Masters degree in Software Engineering from the University of Texas at Austin. His areas of expertise include distributed systems and systems management. He has written extensively on Java Management Extensions (JMX) and Software Systems Management, including authoring Java and JMX, Building Manageable Systems, published by Addison Wesley. Srinivas Hasti is an Advisory Software Engineer in WebSphere Development in IBM Raleigh. He has four years of experience in middleware technologies. Srinivas holds a Masters degree in Computer Science. Lavena Chan is a software engineer in IBM Austin. She has five years of experience in the middleware field. She holds an MBA degree from the University of Texas in Austin. Her areas of expertise include install, GUI, and scripting programming.
Alex Gregor, Senior Software Engineer, Manager of WebSphere Customer Programs, IBM Austin, provided management support for this redbook project. John Byrd Gail Christensen Linda Robinson International Technical Support Organization, Raleigh
xvi
Your efforts will help increase product acceptance and customer satisfaction. As a bonus, you'll develop a network of contacts in IBM development labs, and increase your productivity and marketability. Find out more about the residency program, browse the residency index, and apply online at:
ibm.com/redbooks/residencies.html
Comments welcome
Your comments are important to us! We want our Redbooks to be as helpful as possible. Send us your comments about this or other Redbooks in one of the following ways: Use the online Contact us review redbook form found at:
ibm.com/redbooks
Mail your comments to: IBM Corporation, International Technical Support Organization Dept. HZ8 Building 662 P.O. Box 12195 Research Triangle Park, NC 27709-2195
Preface
xvii
xviii
Summary of changes
This section describes the technical changes made in this edition of the book from the previous edition. This edition may also include minor corrections and editorial changes that are not identified.
New information
Two new chapters have been added for the General Availability (GA) release of WebSphere Application Developer Version 5: Chapter 3, Development tool migration (GA) on page 81 has been changed from the EA release as follows: Added migration instructions for Early Availability release in 3.4, Migrating from WebSphere Studio Application Developer Version 5 Early Availability or Beta versions on page 96 Changed instructions in 3.9.3, Migrating code from EJB 1.x to EJB 2.0 on page 118 Changed instructions in 3.11, Converting from VisualAge for Java Persistence Builder to EJB 2.0 on page 121
Chapter 9, Development environment migration examples (GA) on page 287 has been changed from the EA release as follows: Changed instructions in 9.1.4, Example: Migrating VisualAge for Java JSP/Servlet samples example to EJB 2.0 on page 301 Changed instructions for step 5, migrating code from EJB 1.1 to EJB 2.0, in 9.2.4, Example: Migrating YourBank to J2EE 1.3 on page 318
Changed information
Two chapters from the first edition were based on the Early Availability (EA) release of WebSphere Application Developer Version 5, and remain in this edition as well: Chapter 4, Development tool migration (EA) on page 133
xix
xx
Chapter 1.
Introduction
This chapter describes the objectives, the focus, and the intended audience of this book. We outline the structure of a Java 2 Platform, Enterprise Edition (J2EE) application, and the WebSphere Application Server V5.0 architecture and topologies.
1.1 Objectives
The new IBM WebSphere Application Server V5.0 complies with Java 2 Platform Enterprise Edition (J2EE) 1.3 specifications. WebSphere V4.0 complies with J2EE 1.2 specifications, while WebSphere V3.5 did not fully comply with J2EE specifications. As the J2EE specification continues to evolve, IBM will continue to support the future versions. Migration and upgrades are a way of life. Our recommendation is to make the applications more adaptable. This migration guide will assist in the migration efforts with best practices. The two major objectives are: To document best practices for a migration effort Provide advice in producing more adaptable applications
Section 1.2.2, Application API migration on page 5 discusses the application API migration. JSP, Servlet, EJB spec level migration - JMS listener to MDB migration - EAR file conversion - XMLConfig and wscp conversion Section 1.3, WebSphere V5 architecture primer on page 9 introduces the WebSphere V5.0 architecture and server configurations.
Development Environment
JSP Servlet EJB
Test/Integration Environment
JSP
Production Environment
JSP
Tool
Servlet EJB
config
Servlet
DB
config
EJB
DB
...
DB
...
DB
Scripts
Scripts
Figure 1-1 Migration of development, test/integration, and production environments using software engineering methodologies
Chapter 2, Migrating strategy and planning on page 21 presents the software engineering methodologies as best practices in migration strategy and planning. A staged migration strategy using coexistence and interoperability is also discussed. Chapter 3, Development tool migration (GA) on page 81 presents the WebSphere development tools migration paths: VisualAge for Java V3.5.x to WebSphere Studio Application Development V5.0 WebSphere Studio Classic V3.5.x to WebSphere Studio Application Development V5.0 WebSphere Studio Application Development V4.0 to V5.0
Chapter 1. Introduction
Chapter 5, HTTP Server Plug-in on page 185 discusses the HTTP Server Plug-in migration. Chapter 6, WebSphere system management on page 197 discusses WebSphere system management migration and WebSphere command-line and admin tools migration. Chapter 7, Migration assistants on page 245 discusses stand-alone migration tools and assistants. Chapter 8, WebSphere system configuration and runtime migration on page 263 discusses the WebSphere Application Server migration. Chapter 9, Development environment migration examples (GA) on page 287 presents development environment migration examples. Chapter 11, System and runtime migration examples on page 361 presents WebSphere system configuration and runtime migration examples.
4.0
AEs AE
Base ND
5.0
SE, AE
3.5
Base, ND
5.0
In one migration path, the level of the migrating WebSphere application server is assumed to be V3.5.3 or greater. However, migration from V3.5.1 or greater is supported. The V3.5.x Standard Edition (SE) is mapped to the V5.0 Base
product. The V3.5.x Advanced Edition (AE) is mapped to the V5.0 Network Deployment (ND) product. The lower portion of Figure 1-2 on page 4 shows this migration path. In the second migration path, the level of the migrating WebSphere application server is assumed to be V4.0.2 or greater. However, migration from V4.0+ is supported. The V4.0.x Advanced Single Server Edition (AEs) is mapped to the V5.0 Base product. The V4.0.x Advanced Edition (AE) is mapped to the V5.0 Network Deployment (ND) product. The upper portion of Figure 1-2 on page 4 shows this migration path. Additionally, a migration path of WebSphere application server V4.0.x JMS listener to WebSphere application server V5.0 message-driven beans (MDB) is discussed.
JSP/Servlet
The MigrateWC tool, described in 7.2, System administration migration assistants on page 256, may be used to assist in the migration of JSP and Servlet source application code. The Class API checker tool (CACT), discussed in 7.1.5, CACT - Class API checker tool introduction on page 254, may be used to analyze compiled code for API deprecation.
EJB
Migration of source code from EJB 1.x to 2.0 is discussed in 3.9, Migrating from EJB 1.0 to EJB 1.1 or to EJB 2.0 on page 116. The EJBDeploy tool, discussed in 7.1.2, ejbdeploy - deploying EJBs on page 250 assists in EJB 1.0 to 1.1 conversions. The Class API checker tool (CACT), discussed in 7.1.5, CACT Class API checker tool introduction on page 254, may be used to analyze compiled code for API deprecation.
Chapter 1. Introduction
EAR
WAR JAR
Deployment Tools
J2EE Application Server Client 1 Tier Browser Applet HTML/XML Web Container JSP Servlet R M I I I O P Tag Lib T r a n s a c t i o n 2 JDBC DataSource
M o n i t o r
Database System
EJB Container
Java Application
Lookup properties, resources, EJBs cnv JNDI Content DataSource Server EJB Home
Tier 1 A browser-based tier for the user interface using the HTTP protocol. Java applications can also interact directly with the Enterprise JavaBean server. Tier 2 A server-side front-end tier that manages user sessions and translates HTTP requests into method calls on business objects in the enterprise server. Java Servlets and JavaServer Pages are used to implement this
Chapter 1. Introduction
component in conjunction with a traditional Web server. One or more firewalls (not shown) are typically present for system security. Tier 3 An object-oriented business logic tier implemented using Enterprise JavaBeans. The Enterprise JavaBeans are mapped onto the underlying database and legacy systems. Multiple Enterprise JavaBeans servers may be interconnected, both locally and remotely, to form complex distributed object-oriented systems. These servers support distributed transactions to maintain data integrity across remote databases. Tier 4 A back-end database tier, sometimes including legacy systems. J2EE uses the concept of containers to separate application business logic from server-provided services such as security, database mapping, transactions, load balancing, and network communications. There are four kinds of containers - applet, application, Web, and EJB. The users application implements just the business logic. The vendor-provided J2EE server's containers handle all other services. Application components are organized into EAR files, which are deployed into containers using deployment descriptors and deployment tools.
Application server
An application server is a JVM running user applications. The application server collaborates with the Web server to return a customized response to a client's request. Application code, including Servlets, JSPs, EJBs and their supporting classes, run in an application server. In keeping with the J2EE component architecture, Servlets and JSPs run in a Web container, and EJBs run in an EJB
Chapter 1. Introduction
container. You can define multiple application servers, each running in its own Java Virtual Machine (JVM).
Node
A node is a logical grouping of managed servers. A node usually corresponds to a physical computer system with a distinct IP host address. Node names usually are identical to the host name for the computer.
Node agent
Node agents are administrative agents that monitor application servers on a host system and route administrative requests to servers. A node agent manages all WebSphere Application Server servers on a node. The node agent represents the node in the management cell.
Deployment manager
Deployment manager is an administrative process that provides a centralized management view for all nodes in a cell, as well as the management of clusters and workload balancing of application servers across one or several nodes.
Cell
Cells are arbitrary, logical groupings of one or more nodes in a WebSphere Application Server distributed network. A cell is a configuration concept, a way for administrators to logically associate nodes with one another. Administrators define the nodes that make up a cell according to whatever criteria make sense in their organizational environments.
Cluster
Clusters are a set of servers that are managed together and participate in workload management. The servers that are members of a cluster may be on different host machines, as opposed to the servers that are part of the same node and must be located on the same host machine. Before discussing this runtime architecture in depth, it may be helpful to refer to the chart below.
Table 1-2 Mapping of WebSphere Application Server editions
V3.0 N/A V4.0 WebSphere Application Server Advanced Single Server Edition (AEs) V5.0 WebSphere Application Server
10
V3.0 N/A
V4.0 WebSphere Application Server-Advanced Developer Edition (AEd) WebSphere Application Server Advanced Edition (AE) WebSphere Application Server Enterprise Edition (EE) WebSphere Application Server for z/OS and S/390
V5.0 WebSphere Application Server for Developers WebSphere Application Server Network Deployment (ND) WebSphere Application Server Enterprise WebSphere Application Server for z/OS
WebSphere Application Server Advanced Edition (AE) WebSphere Application Server Enterprise Edition (EE) WebSphere Application Server EE for zSeries
As depicted in Table 1-2 on page 10, WebSphere Application Server Network Deployment (ND) is the V5.0 analog to WebSphere V4.0 Advanced Edition. WebSphere Application Server-ND adds clustering and workload management (WLM) capability to WebSphere Application Server V5.0. WebSphere Application Server-ND relies on two additional processes, the node agent and the deployment manager, to synchronize and manage multiple application servers running in a V5.0 cell. While not exactly equivalent to the V3.x and V4.0 Administration Server (adminserver) in WebSphere Application Server-ND V5.0, the node agent and deployment manager provide many of the same functions provided by the adminserver. The deployment manager controls the other machines in the cell, and the node agent provides a local process on each machine for control of the processes on that node. The major V5.0 runtime components are depicted in Figure 1-4 on page 12.
Chapter 1. Introduction
11
Extract, Update
Deployment Manager
Node Agent
Node Agent
Process A
JMS Server
Process B
Application Server
Process C
Application Server
Process D
Application Server
Physical System 1
Physical System 2
Note: While Figure 1-4 depicts the V5.0 deployment manager as running on a separate physical computer system from the V5.0 application servers, you may choose to run it on the same physical system that is running the application servers.
12
Both of these administration clients are discussed in further detail in Chapter 6, WebSphere system management on page 197. The architecture for WebSphere Application Server V5.0 is depicted in Figure 1-5.
Admin Console
Config Repository File Browser Application Install Admin UI Config Service User/Runtime MBeans Admin Service (JMX) Workspace Master Repository
Applications
Customer Apps
Scripting Client
J2EE Runtime
Chapter 1. Introduction
13
Config Repository File Sync File Browser Application Install File Transfer Process Management Config Service User/Runtime MBeans Admin Service (JMX)
Customer Apps
J2EE Runtime
As one can see by comparing Figure 1-5 on page 13 and Figure 1-6, some of the administration components in an application server are uninstalled when an application server is federated into a cell. Once in a cell, all administration should be performed via the deployment manager, and not against the individual application servers anymore. While one can choose to reinstall the adminconsole.ear file, and once again perform local administration, which will allow you to manage application servers when the deployment managers is not running, any changes made locally will be overwritten during the next cell synchronization.
14
The deployment manager node is a node that contains only a WebSphere Application Server Network Deployment server process. The deployment manager process runs on the Network Deployment node and communicates with independent node agents, running in each node in the cell as lightweight (partial J2EE environment) JVM processes. Node agents coordinate such administrative operations as configuration synchronization. The deployment manager finds the node agents by way of a configurable discovery address, a port and protocol dedicated to letting WebSphere processes find each other. The administrative application that runs in the deployment manager has some function not available in an application server, including the ability to view the entire cell topology. As noted previously, application servers in V5.0 are designed to run when the deployment manager is not running. When the deployment manager is brought online, it coordinates with the node agent and application servers on each node. The architectural components comprising the deployment manager are depicted in Figure 1-7.
Admin Console
Config Repository File Browser Admin UI Application Install Config Service Master Repository File Transfer/Sync Admin Service (JMX) Workspace Local Per-User Workspace
Applications
J2EE Runtime
Scripting Client
Chapter 1. Introduction
15
(WLM). A cell is comparable to a WebSphere Application Server Version 4 administrative domain. A V5.0 WebSphere cell maintains the configurations pertaining to: Physical hosts on which application servers are installed Application servers and other components that comprise the runtime Applications installed on application servers Resources providing support to applications, such as JDBCTM drivers and data sources for data access Security The deployment manager for a cell retains master configuration files for each server on each node in the cell. Each node also has its own local copies of these configuration files. Any changes to a local node or server configuration file are temporary, if the server belongs to the cell. As noted previously, the local configuration is overwritten during the cell synchronization. Changes at the cell level to server and node configuration files are permanent. Synchronization occurs at designated intervals or when certain events occur, such as when a server starts. Clusters are the equivalent of WebSphere Application Server Version 4 server groups. A cell can have no clusters, one cluster, or multiple clusters. Vertical clusters have servers on the same node under workload management. Horizontal clusters have servers on multiple nodes under workload management. Workload management routes application requests based on server weight, to provide better distribution. Several application servers can run on a single machine, but there is no requirement that they all be in the same cluster. Clustering is a logical grouping, not a physical one. All members of a cluster are independent application servers. The only requirement is that they are identical in the applications configured to run in each server. When you create a cluster, you make copies of an existing application server configuration template. The template will most likely be an application server that you have previously configured. You are offered the option of making that server a member of the cluster. It is recommended that you keep that server available only as a template, because the only way to remove a cluster member is to delete it. Keeping the original intact allows you to re-use that configuration to rebuild.
16
API prerequisites (see 1.2.2, Application API migration on page 5, 7.1.5, CACT - Class API checker tool introduction on page 254, and Appendix B, Comparing WebSphere Application Server versions on page 409)
Chapter 1. Introduction
17
WebSphere 3.5 Development Environment to WebSphere Studio 5.0 on page 288, and 11.1, Migrating the WebSphere runtime to V5.0 on page 362) Migrating from Version 4.0x to Version 5.0 (see 8.3.3, WebSphere Application Server V4.0 to V5.0 migration on page 275 and 11.2, Interoperability and coexistence between V3.5/V4.0 and V5.0 on page 391)
18
Chapter 1. Introduction
19
20
Chapter 2.
21
2.1 Introduction
Change is a part of enterprise application ownership. As business requirements change, new features are added to the application. As performance requirements change, additional hardware may be added or existing hardware reconfigured. As new technologies evolve, applications are adapted to make use them. Of all the forms of inevitable change, migration to a new version of WebSphere Application Server is one of the easiest to predict: a new major version appears every 18-24 months. Migration to future versions of WebSphere Application Server should be a part of your business plan. The mechanical aspects of migration are relatively easy to complete. Upgrading individual server instances can be accomplished in a matter of hours or even minutes (preceded by hours of planning). A complete migration plan must include necessary upgrades to application code and individual application servers, but that plan must also consider business requirements; during the migration, service cannot be negatively impacted in any significant way. That is, business must continue during the migration. Migration to a new version of WebSphere Application Server will have an impact on several aspects of your business. Your WebSphere applications are far more than just application code; along with the application code, there are development environments, build processes, runtime environments and other aspects that must be considered. It is important to consider: Application code Development environment (including source code management) Build processes Testing Runtime environments Deployment processes Education and training
22
As J2EE continues to evolve and encompass more technologies, the standardization process will start to make migration much easier. Even with non-standard technologies, the design patterns called Model-View-Controller (MVC) go a long way toward reducing the cost of change (since MVC separates code into areas of responsibility). You need a strategy for taking advantage of proprietary services while reducing the cost of changing your solution later. Designing for change is a key element in that strategy.
23
application needs to be built and deployed, and developers need to be productive with the new development environment. Every migration plan needs to include these elements.
Development environment
Development environments change over time. When WebSphere Application Server Version 4.0 was introduced, so was a new version of WebSphere Studio. WebSphere Studio is a major change in development environments and some time should be taken to ensure that developers are familiar with the changes. WebSphere Studio represents a major change for developers already familiar with VisualAge for Java. The paradigm for code management has changed and it will take some time for developers to become comfortable with those changes. Between Version 4.0 and 5.0, WebSphere Studio has undergone some changes, but at its core remains the same. Developers already familiar with Version 4.0 should become familiar with the changes relatively quickly. Development environments are composed of more than just an integrated development environment (IDE). Other tools, including a source code management solution, are also an important part. Any tools you are using must be reviewed as part of the migration effort. In some cases, new versions or complete replacements may be required. Note: WebSphere Studio does not support the source code management tools built into VisualAge for Java. As part of a tools migration from VisualAge for Java to WebSphere Studio, some effort must be taken to select an alternative. The development environment as it exists on developer workstations is not generally the complete development environment. Other aspects of development, including test servers, developer process and practices, and methodologies should also be considered as part of the migration effort.
Application code
The application code itself may not be seriously impacted by the migration process. Applications that make use of technologies covered by the J2EE standards tend to migrate with relatively little change. In some cases, deprecated APIs must be replaced with newer ones.
24
WebSphere Application Server Version 4.0 should migrate with a small number of changes. It is likely that Version 3.5 build processes will require more drastic changes. As part of the migration, these processes must be reviewed and evolved.
Runtime environments
Even the most brilliantly written code will not run without a properly configured application server to run. Setting up the production/testing environments is a key requirement for success. Of course, the configuration of the production environment can be quite complex. Starting from scratch, installation and configuration of a WebSphere runtime environment can take several weeks. Upgrading a production environment that must stay live during the process can take longer. Installation of a single WebSphere Application Server node is a relatively easy chore that can be reasonably completed in about a day. Installing a more complex collection of nodes featuring load-balancing and failover can take considerably longer. Don't kid yourself into believing that a reasonably complex installation can be effected over the weekend. A proper migration strategy is required. Given that migrating the runtime infrastructure will likely take some time, an alternative approach that interferes with the running system as little as possible is needed. There are a number of ways to upgrade a running system. The right approach depends on some factors: How much downtime is acceptable? How much additional hardware can you purchase? How is the existing environment configured? Does the existing environment provide load-balancing support? Does the existing environment provide failover support? An obvious approach to migrating your runtime environment is to simply build the WebSphere environment and flip the switch. That is, replace your entire existing environment with a WebSphere Application Server. This works well for small configurations; for larger configurations, the cost of duplicating a large amount of expensive hardware can be prohibitive. Use the migration of a system test environment to learn the ropes and make mistakes. Based on the lessons learned through this migration, formulate a plan to effect the entire migration and test that plan against the QA environment. If it is possible migrate your configuration as vertical slices, measure the time required to migrate a single slice and use that information to estimate the entire effort.
25
By starting with a system test environment and then moving into your quality assurance environment, you can formulate and evolve an effective plan and mitigate the risks of migrating your live production environment. Some runtime migration scenarios are presented in 2.3, Migration scenarios on page 38. Note: Corporate WebSphere environment In general, it is recommended that several environments be configured as part of your corporate WebSphere environment. At a minimum, you should have at least one of each of the following: The production environment is what is used by the end user. This environment generally has very strict availability requirements and is scaled to support your entire user base. The pre-production environment is used to test the overall correctness of both the runtime and the application. It is a scaled down version of your production environment with the same level of complexity. That is, the pre-production environment is configured similar to the production environment (same configuration of firewalls, load balancers, back-end systems, etc.), but on a smaller scale (it may contain fewer nodes, for example). Before changes are made in production, they are made to the pre-production environment. This environment can withstand generally longer periods of down time, which makes it an appropriate environment to test your migration plan. A number of system test environments may be configured, depending on your specific needs and budget constraints. System test environments are used by the administration staff to test patches and configuration changes before they are adopted by the pre-production and production environments. Software developers might use a system test environment to test their code in an environment that closely resembles the production environment. Performance testers might use a system test environment to do their work as well. A system test environment is generally configured to reflect the complexity of the production environment on the smallest possible scale. As such, a system test environment is relatively inexpensive to build and maintain.
Testing
Testing cannot be overlooked as a fundamental part of the migration process. Subtle changes can be introduced with new versions and testing is your best bet to discover problems with the code. No doubt you have existing test practices in place; in most cases, existing test practices can be used with little or no
26
modification. Testing for a migration effort can generally be executed in much the same way as for any new release of your application. Implementations of specifications may introduce clarifications of older versions. Clarifications can translate into subtle changes in behavior that should be tested. A full regression test of application code may be in order as part of a migration to ensure that subtle changes have not introduced errors into your application. The specifications are often the best source of information about changes that have occurred.
Education
The education and training that your people require to work with WebSphere Application Server depends on the nature of the competitive product that WebSphere is displacing. There are a number of different skill sets to consider. In particular: J2EE architecture and coding WebSphere tools WebSphere Application Server installation and configuration WebSphere deployment WebSphere Application Server Version 5.0 is J2EE 1.3 compliant. If you're moving from Version 3.5 of WebSphere Application Server, your developers will likely already be competent Java developers but will benefit from J2EE instruction. If your developers are already familiar with J2EE, perhaps through experience with WebSphere Application Server Version 4.0, they may still benefit from technology training. With the new version of WebSphere Application Server comes new development tools. WebSphere Studio Application Developer (Studio) has changed somewhat between Versions 4.0 and 5.0. Studio is quite different from VisualAge for Java. Developers familiar with older development environments will likely benefit from some amount of tools training. The infrastructure and operations staff are the people who install, configure, and keep the WebSphere production environment running. It is assumed that existing infrastructure staff members are familiar with fundamental administrative issues and the operating systems on which their systems run, and have practical experience managing the day-to-day operations of a Web site. Infrastructure people need to learn how to install, configure, and maintain a WebSphere Application Server production environment. The administration model has changed significantly enough between past versions and Version 5.0 that administrative staff would benefit from training in that area. In any case, it is best that specific needs be assessed against actual skills and that any gaps be filled. This may be a good opportunity to assess skills and fill
27
any other skill gaps before moving forward. The amount of training you need depends very much on your goals. If you're planning to get outside help for the migration, you may be able to forgo some or all of the training for the time being.
28
29
Browser
Controller
Model
Figure 2-1 A vertical slice is roughly analogous to a use case in that it follows exactly one path through your application
In its simplest form, a vertical slice considers exactly one path through the application code. Once the vertical slice itself is fully migrated (and confirmed to function as expected on the new version), branches can be considered as additional slices. The original slice might assume that all data is passed as required. Later slices might consider the actions taken when data is missing (report error back to the user, for example). A vertical slice strategy can also work when migrating a runtime environment. Rather than thinking of application layers, you might consider physical tiers.
30
Most code migration efforts tend to employ a dump-and-chase strategy, especially when tight coupling makes identifying a vertical slice difficult. WebSphere Studio Application Developer is the tool of choice for implementing this kind of strategy. WebSphere Studio Application Developer is the most important tool for migrations to WebSphere Application Server 5.0. The validation features in this product do an excellent job of guiding you through the changes that need to be made to the Java code, JSPs, deployment descriptors, and other artifacts (including such things as XML validation). WebSphere Studio Application Developer includes a test environment that is well-paired with the development environment, which provides great debugging support. Note: Dump and chase is a hockey strategy that is quite popular in North America. In hockey, the ice is divided into zones. When on an attack, a team will often send the puck over the blue line into their opponent's zone. From there, the offensive players on the team cross into the zone and try to make a play. Some may argue that maintaining control by carrying the puck over the blue line into the zone is a more refined approach. However, the dump and chase strategy has been demonstrated to work very effectively. In keeping with the metaphor, vertical-slice migration would be like carrying the puck over the blue line. In a code migration sense, dump and chase is effected by dumping the existing code into WebSphere Studio Application Developer and chasing and fixing the problems that are reported by the tool. With help from the debugger, this strategy is extended into the initial testing phases. There is an element of dump and chase in any migration strategy. At some level, some amount of code must be brought into the development environment and cleared of problems. The big difference is that a pure dump and chase effort tends to involve a huge amount of code; it is also generally difficult to test anything until everything is fixed. Be sure to do a lot of testing to make sure that nothing is missed.
31
In the first step, get your application running on WebSphere Application Server Version 5.0 in the shortest time possible with the smallest number of changes possible. This should be a relatively short-term process with the effect of demonstrating that success is inevitable. During the second step, refactor your application to work out bugs, make use of best practices and conform to the J2EE specification. The main purpose of this step is to improve the overall quality of the application and make the application more resilient to future change. With the application running right, the final stage in code migration is to optimize the code as required. Doing the code migration incrementally provides a lot of value. While making your application code run, you may uncover problems not discovered during the design and code review. By discovering these problems early, you have a better chance of finding time to solve them or changing your priorities to accommodate them. Another advantage of incremental migration is that you can decide whether or not to back off the migration (perhaps to wait for a later version of a technology, or even to rewrite from scratch).
Get it running
The real danger in this step is in trying to do too much. The best approach is to get your application running on WebSphere Application Server Version 5.0 with the minimal number of changes possible. That is, stick to making the existing application run in WebSphere Application Server; avoid making significant design changes to the application. Divide and conquer is an excellent strategy to adopt in this stage. If the application is well-written, then it should be relatively easy to modify and test the parts as necessary. Even if the application is not well-written, it should be possible to employ some form of divide and conquer strategy. An enterprise application can be very complex with numerous interacting streams of functionality. These streams of functionality can be divided into vertical slices of the application. Start with one feature and migrate it completely. Additional features should be added incrementally with testing done along the way. While doing the migration, test cases should be migrated along with the code. If no test cases exist, consider creating them. Creating test cases, especially for existing code, is very helpful in making the purpose of individual features clearer. These test cases will also be very helpful later when updating or upgrading the application code. This effort is very similar to that of any application development effort: Understand the requirements Understand the existing design Develop a unit testing plan
32
Implement unit tests on existing implementation Select a vertical slice of the application, modify as necessary, test and deploy to IBM WebSphere Application Server Repeat
Extreme Programming Explained: Embrace Change, by Kent Beck, has lots to say about the development process. Fortunately, extreme practices usually work well in this context. A minimum set of recommended practices that can be followed includes:
Work on the important features first Tackle hard problems early Do one thing at a time Do the simplest thing that can possibly work Test, test, test Release often Divide and conquer There are a lot of reasons to migrate important features first. Migrating important features first helps the decision makers to feel more at ease with the process to see their key features implemented in a timely manner. In the end, if something has to slip, it's good to know that the important stuff is done. It is very likely that the hard problems are somehow related to the most important features. The hard problems will take the longest amount of time to implement. Hard problems are also very difficult to estimate, so taking care of them first can give you a little more time if you need it later.
33
Test, test, test and test some more Before you migrate the existing code, make sure it works as expected on your current version of WebSphere Application Server. If you know how it works on that platform and you have results from test cases to prove it, you can prove that your migrated code functions as expected. These test cases will also be very valuable later when it comes time to reevaluate the architecture. Run your test cases frequently -- they will save you grief. Release often Make WebSphere Application Server Version 5.0 running on the deployment operating system (and hardware) available to the developers. The migrated application should be tested on the deployment test server periodically. There may be subtle differences between the development and deployment platforms. Attempt to determine any problems associated with these differences early. Divide and conquer During this effort, use a divide-and-conquer approach at all levels of granularity. Sure, you can divide the entire application into vertical slices, but each of those slices can likely be divided as well (and then divided again). For example, you may consider a slice of the application that uses the typical Model-View-Controller pattern: a. b. c. d. e. f. g. h. i. j. Write your test code for the model Confirm the results of your tests on the competitive application server Migrate the model code Confirm that the migrated code functions as expected Write tests for the Servlets and JSPs Confirm the results of your tests on the competitive application server Migrate the Servlets and JSPs Confirm that the migrated code functions as expected Integrate with the collective migration effort Repeat
Summary
It is worth stating again that this effort should focus on getting the existing code to run in WebSphere Application Server with the smallest number of changes possible. Salvage as much of the existing code as possible. Unit tests should exist before the application development process begins. Unit tests may evolve during the migration process.
34
normal development process (in fact, some amount of refactoring should naturally occur during the Code Migration stage). It is during this stage that the major surgery takes place. Major surgery can take many forms. The application's architecture should be reviewed and updated. The Model-View-Controller (MVC) architecture is a well-known and generally accepted architecture. The work you do here to take advantage of such established practices will pay off in the long run. Maintenance will be easier, as will migration to future versions of WebSphere Application Server. Even if you're currently using MVC, this stage presents an opportunity to ensure that you're doing it right. By adopting standards, you can mitigate the migration pain you're feeling now on future efforts. On a smaller scale, application of best practices can yield significant improvements in robustness, scalability and performance. For example, existing JDBC code that depends on DriverManager or proprietary connection pooling solutions can be updated to make use of data sources. Classic Servlets that generate HTML output can be updated to make use of JSPs. EJBs might be updated to actually make use of EJB features. Old workarounds can be updated (or removed completely) to take advantage of standard features. Having good unit tests in place makes refactoring a lot easier. Unit test allow you to make changes with confidence; if a change breaks something, that will be revealed by the tests. If you don't have unit tests, it might be a good idea to start introducing them at this stage (if you didn't get around to it in the Get It Running stage, for example). You don't have to go crazy and build thousands of tests providing full coverage; as you make changes, make tests. Over time, the number of tests will increase providing broader coverage. Testing, like refactoring, should be a natural part of the development process. Consider investing some time in a good unit testing tool such as JUnit (found at http://www.junit.org).
Make it small
The final stage of run, right, fast, small is to reduce the code volume to be as small as possible. Assuming that enhancements and migration will be a part of life as you move forward, anything that you can do to make future changes (and migration) easier will save time and money.
35
By reducing the code to the smallest size possible, you may be able to work out complexity and bulk. By reducing these factors, the code will be easier to maintain.
Assessment
The main goal of an assessment is to determine what the overall effort will be to complete the migration (assessment should really part of any effort). As part of an assessment, all the pieces involved in enterprise application ownership should be reviewed. This includes such things as the development and production environments, but also includes such things as the skills of the people involved (see 2.1.3, Elements of migration on page 23). As projects evolve, very often many details are lost. An assessment presents an opportunity to discover these lost details. The product of an assessment should be a template for a plan to move forward within a migration effort. The template should document: An appropriate high-level migration strategy An estimate of overall migration effort Problem areas Risk factors and unknowns Use of proprietary or third-party technologies Required education
Education
Education takes many forms. Classroom training is an obvious way to get education for a large number of people. Mentoring is another very effective learning mechanism.
36
Research
Research is typically part of every migration assessment effort. Your applications may make use of code libraries provided by a third party. Confirmation that these libraries will function in WebSphere Application Server Version 5.0 is required. New versions of these libraries may exist. In any case, the third-party vendor may be required to provide some kind of certification that these libraries will function in the new environment. Other kinds of research may also be required.
Code preparation
Coding practices can have a direct impact on the complexity of migration. Code that is generally easier to understand is generally easier to modify. Layered architectures are a huge win when change is required. Refactoring describes a discipline of code development with which code is constantly changed into simpler forms. As a matter of practice (regardless of your chosen software development methodology), refactoring improves overall code quality. As part of the refactoring discipline, code that is not used should be removed. This simple act can reduce the effort considerably because it reduces the amount of code that needs to be considered as part of the migration effort. The
37
ethic of removing what you don't use can be extended to the runtime environment. Unused resources, such as data sources, should be removed as a matter of general practice. More pragmatically, new versions of WebSphere Application Server tend to support more recent versions of specifications. In anticipation of an upcoming migration, you can update existing code to conform to the most recent version. WebSphere Application Server Version 3.5 supports multiple versions of the JSP and Servlet specification. In anticipation of a migration, you might consider updating to the most recent version while still running on Version 3.5.
Plan
Migration plans should be flexible. As part of the assessment, you can document risks and unknowns. Assume that additional unknowns will make themselves known during the migration process. Any migration plan should include lots of time for testing and remediation. A common mistake is to leave time for testing but no time for fixing problems that testing may uncover.
38
Note: These scenarios represent conceptual paths through a migration process. A collection of application servers may or may not be organized into domains. Scenarios involving multiple servers make no distinction between physical and logical representations of nodes. In scenarios 4, 5, and 6, the number of servers shown in the examples is not significant; these scenarios can be expanded as required. These scenarios apply equally to any combination of WebSphere Application Server versions (even though Versions 4.0 and 5.0 are indicated throughout).
Pros
This is a very simple upgrade path and no additional hardware required.
Cons
Extended downtime may be required. A limited amount of downtime must be assumed to actually effect the migration itself. It is strongly advised that additional time be budgeted for testing and remediation. It is difficult to back out of the migration if difficulties arise. It is possible to keep multiple versions of WebSphere Application Server installed on a single server; if the previous version is kept on the machine, it is a relatively easy task to bring it back into service. However, as part of the installation of WebSphere Application Server Version 5.0, new versions of related software may be required. It may be
39
necessary, for example, to install a different version of your HTTP server and database. Even if new versions of this software are compatible with the old version of WebSphere Application Server, additional configuration will likely be needed to bring that older version back into service.
Comments
While not required, consider adding additional hardware, which will add failover capability, increase capacity and make ongoing maintenance generally easier.
Pros
It is easy to back out an upgrade. A new server can be tested before the switch. If some unexpected problem occurs after the switch, the configuration can be switched back to the original. A relatively small amount of down time is required. A few minutes of downtime is inescapable as one machine is taken out of service and replaced by another. Again, depending on your network configuration, other options may reduce the required downtime even further.
Cons
Additional hardware is required.
Comments
Consider keeping any new hardware that is obtained to provide failover capacity.
40
Pros
It is relatively easy to back out. Should problems occur, the HTTP servers can be reconfigured to direct the traffic intended for the errant application to the older version.
Cons
Additional resources (RAM, disk, CPU) may be required to support two versions of WebSphere Application Server concurrently. Some downtime will be required as part of the installation process. Downtime can be reduced by introducing additional hardware (similar to scenario 2). Some downtime will be required as HTTP Server Plug-ins are reconfigured to redirect traffic.
Comments
If the code for all applications is upgraded prior to runtime migration, see scenarios 1 and 2.
41
A potential runtime configuration is shown in Figure 2-2. From this configuration, a branch is selected and severed from the load balancer. The severed branch includes at least one HTTP Server; the HTTP Servers must be upgraded to run the plug-in for Version 5.0. The severed branch also includes some number of application servers. These application servers must be removed from the plug-in configuration for the HTTP Servers that remain in service. The plug-in on the servers HTTP Servers need not be modified at this point.
Load Balancer
The load balancer will continue to service incoming requests to remaining branches at reduced capacity. The severed branch, shown in Figure 2-3 on page 43 contains some number of nodes still in service.
42
Load Balancer
Upgrade to 5.0
Figure 2-3 As the migration starts, a branch is severed from the load balancer
Once severed, the branch is upgraded to Version 5.0. A new version of the HTTP server may be required; the Version 5.0 plug-in must, at least, be installed. Each node running an application server must be updated along with the application. The servers branch is then tested and reintroduced to the load balancer as shown in Figure 2-4 on page 44. At this point, some incoming requests may be serviced by the application running in Version 5.0 and some on the older version of WebSphere Application Server. Note: Migrating the first branch will be the most time-consuming and difficult task. Once completed, however, this branch can become the model for the remaining effort.
43
Load Balancer
Figure 2-4 The severed branch is reintroduced to the load balancer. Incoming requests can now be handled by either Version 4.0 or Version 5.0.
At this point, some servers are running Version 5.0, and some are running the previous version. User requests may be handled by an application server running either version. To maintain a consistent user experience, the application must be functionally equivalent on both versions. Additional branches are migrated to Version 5.0. In end, as shown in Figure 2-5 on page 45, all nodes are running WebSphere Application Server Version 5.0.
44
Load Balancer
Figure 2-5 Additional branches are migrated until everything has been moved to Version 5.0
Comments
Different versions of WebSphere Application Server cannot share configuration information and runtime state. A WebSphere Application Server Version 5.0 instance could not, for example, be part of an existing Version 4.0 domain. This means that, for example, persistent HttpSessionState cannot be shared across versions of WebSphere Application Server. For stateless applications, this is not of concern. However, for stateless applications, some form of server affinity, provided by the load balancer, will mitigate this issue. Within a single branch, failover of state may be possible. State will be lost in the event that failover is required across branches. In general, other services, such as databases, can be shared by applications running on different versions of WebSphere Application Server.
Pros
This is a relatively simple and common migration process. The load balancer does not require additional configuration.
45
Each component is relatively simple. Each HTTP Server is configured with exactly one WebSphere Application Server plug-in. Each physical node contains one instance of WebSphere Application Server. Fewer parts and simple configuration means that there are fewer things that can break.
Cons
Depending on the number of nodes that are involved, there may be a situation where adequate failover support cannot be provided. In Figure 2-3 on page 43, a single HTTP server is left in service while the other is upgraded. Care should be taken to ensure that adequate capacity is available during the migration process. As a general rule, a minimum of three of everything is desired to support high-availability requirements. A single large application may take time to migrate to the new platform. Application code must remain functionally equivalent on all branches to ensure a consistent user experience. If the application needs to be changed during the migration process, it must be changed (and consistently maintained). Moving forward, consider factoring a single large application into many smaller ones. Smaller applications will take less time to migrate in the future.
46
Load Balancer
The HTTP Servers are upgraded to include a plug-in for WebSphere Application Server Version 5.0 as shown in Figure 2-7 on page 48.
47
Load Balancer
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
Figure 2-7 The Version 5.0 plug-in is installed on the HTTP Servers
Several application server nodes are selected and taken out of service (the HTTP Server Plug-in configuration is updated to exclude these nodes) as shown in Figure 2-8 on page 49. The HTTP Servers will continue to direct traffic to the remaining application servers at reduced capacity.
48
Load Balancer
Upgrade to 5.0
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
Figure 2-8 Several nodes are taken out of service and upgraded
The selected nodes are upgraded to WebSphere Application Server Version 5.0 as shown in Figure 2-9 on page 50. The number of nodes selected to upgrade depends on the distribute of traffic for the applications. In this example, app1 is being migrated. Based on performance characteristics of app1, an appropriate number of nodes is selected. In this example, app1 consumes approximately half the available bandwidth, so half the application servers are selected for upgrade. During this process, the application servers will be working at reduced capacity. If the existing configuration does not include excess capacity, this upgrade must be scheduled during a period of low activity. Once the nodes themselves are updated to Version 5.0, the migrated application (app1) is installed. The HTTP Server Plug-in configurations must be updated so that the Version 5.0 plug-in starts handling requests for app1 instead of the Version 5.0 plug-in.
49
Note: While this switch is occurring, there may be a point in time where either both plug-ins will attempt to handle requests for the application, or neither will. The plug-ins periodically check to see if their configuration has changed. For the switch to complete, both plug-ins must re-read their configurations and reconfigure themselves. Since these plug-ins are independent, they will likely attempt to rebuild their configurations at different times.
Load Balancer
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
Figure 2-9 The selected nodes are upgraded to Version 5.0 and one application (app1) is moved to the upgraded nodes. The plug-in configurations are upgraded to direct traffic to the appropriate nodes.
As additional applications are migrated, more of the capacity is switched to Version 5.0 as shown in Figure 2-10 on page 51.
50
Load Balancer
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
app2 app3
app2
Figure 2-10 As additional applications are migrated, more application server nodes can be upgraded to 5.0
Figure 2-10 shows that when app2 is moved to WebSphere Application Server Version 5.0, an additional node is migrated and app2 is installed on all migrated nodes. Based on this figure, one might assume that app2 consumes approximately 25% of the available capacity.
Pros
Not all applications need to be upgraded at once. As applications are made ready to run on Version 5.0, the runtime environment can be upgraded. It is relatively easy to back out of the upgrade in the event of failure. The migrated application can continue to exist on the previous version of WebSphere Application Server. Should problems occur, the HTTP servers can be reconfigured to direct the traffic intended for the errant application to the older version. Load balancers need not be reconfigured.
51
Cons
Multiple applications running on a single server permits the applications to share capacity. As servers are taken off the previous version of WebSphere Application Server and converted to Version 5.0, the applications that run on those servers will not be able to share capacity with servers still running Version 4.0. This is particularly true for the first and last applications to migrate. It may also be the case where the first (or last) applications require a relatively small number of servers; if a small number (for example, one) of servers is migrated to Version 5.0 to support a single small application, additional hardware may be required to provide failover support. Figure 2-10 on page 51 shows a case where a single node is running a previous version of WebSphere Application Server; in this case, that server becomes a single point of failure. To provide more reliable service, additional hardware may be required until that final application is migrated. There are no automatic mechanisms for sharing information across different versions of WebSphere.
52
Load Balancer
WebSphere Application Server Version 5.0 is installed on each application server box as shown in Figure 2-12 on page 54. The Version 5.0 plug-in is installed on each HTTP Server (HTTP Servers may need to be restarted as part of the installation process). Once installed, the HTTP Server Plug-ins are configured to direct traffic to the Version 5.0 instances. It should be possible to perform this installation with minimal downtime.
53
Load Balancer
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
The migrated application (app1) is then installed on the Version 5.0 instances (Figure 2-13 on page 55). For the migrated application to go into service on Version 5.0, the plug-ins must be updated. To do this, the application must be removed from the Version 4.0 plug-in configuration and added to the Version 5.0 plug-in configuration. The plug-ins will automatically reload their changed configurations, but will only do so on a periodic basis (the period is configurable). Unfortunately, since the plug-ins are completely independent, there is no guarantee that they will reload their configurations at the same time. This means that there will be a short period of time where either both configurations will attempt to handle traffic for the application, or neither will. To avoid this situation, shut down the HTTP server before changing the plug-in configurations.
54
Load Balancer
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
Figure 2-13 Migrated applications are moved from previous version of WebSphere Application Server to Version 5.0
As additional applications are migrated, the process can be repeated as shown in Figure 2-14 on page 56.
55
Load Balancer
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
HTTP Server WebSphere Application Server 4.0 Plug-In WebSphere Application Server 5.0 Plug-In
app2 app3
app2
app2 app3
app2
Figure 2-14 As additional applications are migrated they are moved to WebSphere Application Server Version 5.0
Pros
Applications can continue to share capacity, although overhead of having two versions of WebSphere Application Server on a single workstation should likely diminish overall capacity. There is relatively easy backout. If an application does not work on the V5.0 runtime, it can be easily moved back to the previous version. In fact, the application can be left installed on the old version (though not accessible from the HTTP Server) until there is confidence that it is running well on Version 5.0. For a short while, the application will have to run on both versions. Note: The application will consume resources while left on the old version of WebSphere Application Server and should be removed as soon as possible.
56
Cons
This scenario may require additional resources (CPU, RAM, disk) to mitigate the effects of reduced capacity due to multiple installed versions of WebSphere Application Server. Before moving forward with this scenario, it should be thoroughly tested on system test hardware to confirm that adequate resources are available. Care must be taken to avoid conflicts between the two versions running concurrently. Ports, for example, cannot be shared by both versions.
57
Load Balancer
Load Balancer
In Figure 2-16 on page 59, the Web tier is upgraded to Version 5.0. As long as the application code does not change the way that communication works (it uses the same protocol and message format), the business logic tier can remain in Version 4.0.
58
Note: If the message format is to be changed as part of the upgrade of the application, a phased approach is recommended. As part of the first phase, the existing code is changed as minimally as possible to get it running on WebSphere Application Server Version 5.0 and the entire migration is effected. Once the migration is effected, then consider changes to the message format.
59
With the Web tier migrated, the business logic tier can be considered. As shown in Figure 2-17 on page 61, the business logic tier can be migrated using an appropriate migration scenario (in this case, scenario 4). It is possible for a single load balancer to distribute HTTP traffic across application servers running different versions of WebSphere Application Server. It is not strictly required that one tier migration be completely effected before another is started. However, by considering the tiers separately -- reducing the number of variables -- the risk is mitigated.
60
Load Balancer
Load Balancer
Figure 2-17 Consider one of the previously mentioned scenarios when migrating the remaining tiers
If IIOP is used to communicate between tiers, there are some subtle differences. A possible configuration using IIOP is presented in Figure 2-18 on page 62. In this configuration, the Object Request Broker (ORB) is responsible for distributing the load across multiple application servers in the bottom tier. The ORB represented in this diagram is not a physical entity; it is included as part of WebSphere Application Server.
61
Load Balancer
Orb
Figure 2-18 A possible multiple-tier configuration using IIOP. In this diagram, the ORB is a logical entity, not a physical one.
Figure 2-19 on page 63 shows the partially complete migration. In this diagram, the Web tier is migrated to Version 5.0 while the bottom tier remains 4.0. Note: Changes to the ORB between WebSphere Application Server Version 3.5 and 4.0 can complicate this scenario when migrating from Version 3.5 forward. In order to be able to communicate between versions using IIOP on Version 3.5 nodes.
62
Figure 2-19 The top tier can be migrated independent of the bottom tier
As the migration of the business logic tier is effected, there are actually two migrations underway. As nodes in the business logic tier are upgraded to Version 5.0 and are reintroduced into service, nodes in the Web tier must be configured to find them. Some of the Web tier nodes direct their traffic to the Version 5.0 nodes in the business logic tier, while other nodes continue to direct their traffic to the Version 4.0 nodes (as shown in Figure 2-20 on page 64).
63
Load Balancer
Orb
Orb
Figure 2-20 During the migration of the bottom tier, IIOP messages cannot be distributed across different versions of WebSphere Application Server
The Web tier nodes will have to be reconfigured so that InitialContexts are created to point to the desired nodes (see Chapter 8, WebSphere system configuration and runtime migration on page 263 for more details). InitialContext is a Java class that implements the Context interface and serves as the entry point to a naming system.
64
65
Figure 2-21 VisualAge for Java projects can contain all enterprise application artifacts
With J2EE 1.2, these artifacts are all separated into separate modules. WebSphere Studio provides a similar organization. Web artifacts (Servlets, JSPs, style sheets, etc.) are maintained in a Web project. EJB artifacts are maintained in an EJB Project. Other project types exist for other types of artifacts. Note: WebSphere Studio Version 4.0 has the ability to maintain and edit all application artifacts. VisualAge for Java provides editing support only for Java artifacts and limited support for maintaining others. JSPs, for example, can be managed and edited in the same Web project as related Servlets. JSP debugging support is also much-improved: breakpoints can now be added into Java code fragments. As part of the migration process, the application code must be restructured. Restructuring the code can be as simple as moving code from one project into others; this can become more complicated if the application code contains a large number of dependencies. Figure 2-22 on page 67 shows an example of how application code might be refactored while still in VisualAge for Java. In this example, code is moved from a single project into a number of special-purpose projects. The project named Human Resources EJB contains EJB code. The project named Human Resources Web contains Servlets (when this project is moved in to WebSphere Studio, the JSPs for this application can be included). The Shared project contains code that is common to both the EJB and Servlet code.
66
The code in the EJB project will be migrated into a WebSphere Studio EJB Project; when packaged, that project will become an EJB-JAR file. Similarly, code in the Web project will be migrated into a Studio Web project; when packaged, this project will become a Web Archive (WAR) file. This refactoring can be done in VisualAge for Java prior to the start of the migration effort, or can be done while importing into WebSphere Studio as part of the migration.
67
Visual components should be maintained in a VisualAge for Java code repository to ensure that the associated metadata is maintained. Alternatively, VisualAge-generated code can be exported with metadata (which can then be later re-imported), by checking the Generate meta data method option in the Options window in VisualAge for Java as shown in Figure 2-23.
Figure 2-23 With the Generate metadata method option checked, visual components can take a round trip from Studio to VisualAge and back again
VisualAge-generated methods should not be modified outside of VisualAge for Java if VisualAge will be used on a continuing basis to edit the components. Changes to added methods, and changes in user code sections will be preserved as code is round-tripped from Studio to VisualAge and back again.
68
WebSphere Studio Application Developer Version 5.0 includes a window builder. That builder is concerned exclusively with layout and does not include any concept of connections between visual components. VisualAge-generated window code can be imported into WebSphere Studio and edited. Once edited, however, it cannot be returned to VisualAge for Java.
This method can exist in VisualAge for Java; this change need only be made once and maintained with the VAP-generated code. The VAP-generated code
69
does not run in an EJB container; the code only makes use of the interfaces defined by EJB. VisualAge for Java can be used to edit these components, which can then be re-exported into Studio for further development. VAP-generated code should be migrated to EJB 2.0 container-managed entity beans with local interfaces.
70
2.4.6 Interoperability
There are a number of interoperability options supported between Versions 3.5 and 5.0 of WebSphere Application Server. For more information about interoperability, see Chapter 8, WebSphere system configuration and runtime migration on page 263.
2.4.7 Administration
Partially as a result of J2EE standardization of packaging, the administration process also changes. With Version 3.5, much configuration information now specified in deployment descriptors had to be manually (or through scripts) provided by administrators. In this regard, deployment on Version 5.0 of an application can be little more than dropping an EAR file on the application server.
71
With WebSphere Application Server Version 5.0, the administration model has completely changed. Existing deployment and configuration scripts will have to be recreated as part of the migration. Existing skills will also have to be updated.
2.5.2 Interoperability
There are a number of interoperability options supported between Versions 4.0 and 5.0 of WebSphere Application Server. For more information about interoperability, see Chapter 8, WebSphere system configuration and runtime migration on page 263.
72
2.5.3 Administration
With WebSphere Application Server Version 5.0, the administration model has completely changed. Existing deployment and configuration scripts will have to be recreated as part of the migration. Existing skills will also have to be updated.
Assessment
Before any migration is attempted, the effort should be assessed. The amount of time required to assess an application depends on a number of factors. The most significant factors are complexity of the application and the runtime configuration. Assessing the migration complexity for a single application running on a simple runtime configurations will likely take a day or two. A more complex application running in a complex runtime configuration involving a number of firewalls and other considerations will require more time to assess. In general, allow the assessment times as follows: One day to assess each application One to two days to assess the runtime environment One day to assess build and deploy processes and for general education Two to three days to assess documentation discoveries
Education
There are two separate streams for education, since Java development and application server administration are typically handled by different groups of people. For Java developers, education may require the following topics: J2EE (relevant changes to the base technologies, packaging) WebSphere Studio Application Developer
73
Source code management Apache Ant Obviously, developers familiar with WebSphere Application Server Version 4.0 already have experience with J2EE. Java developers who are not formally familiar with J2EE will likely have some experience with the based technologies, including such things as Servlets, JSPs, and EJBs. Subtle changes occur in these specifications between versions; those changes should be discussed as part of the education. When migrating from WebSphere Application Server Version 3.5, assume that classroom education will take at least a week or less than a week for developers already familiar with Version 4.0. Expect that developers will require at least a few weeks of soak time to become familiar with the new environment and return to full productivity. Administration staff will benefit from specific WebSphere Application Server administration training. Expect that the formal education should take approximately a week and should be followed up with several weeks of soak time to adapt the knowledge learned in the classroom to your requirements. Note: Consider sending all your people for all training. It is helpful for your developers to have some understanding of the issues faced by administrators and vice versa. As part of the assessment, a more complete picture of education requirements can be developed.
Development environment
Some research may be required to handle any special considerations, for example are you using any special tools? You must determine if the special tools work with WebSphere V5.0. If not, replacements must be found. WebSphere Studio Application Developer will be only part of your WebSphere Application Server Version 5.0 development environment. A development environment is also composed of source code management (SCM) tools, test servers, databases and other systems. These must all be considered as part of the migration of the development environment. Developers should not be expected to be 100% productive immediately. They will require some time to acquaint themselves with the changes.
74
Build
Coming from Version 3.5, a new build process will almost certainly be required. Apache Ant is a popular choice. A number of template Ant scripts exist that can be leveraged as part of this process. In any case, Ant skills must either be imported or developed.
Application code
Standard iterative development practices can be followed. You may choose to have a special migration team do the work or have the general development population involved in migration.
Testing
Always include lots of time for testing as part of any migration plan.
75
2.6.1 Documentation
As part of the planning process, the various tasks must be captured and documented. To keep things simple, separate the dissemination of tasks with the scheduling of their application. There are a number of popular ways to capture this information; ultimately, you should pick a documentation strategy that you are comfortable with. One approach might be to break the migration problem into reasonable-sized tasks. You might consider Developer Education as a single task. For each task, estimate the effort required and identify prerequisite tasks. An example of a collection of project tasks is presented in Table 2-1 below. The tasks identified in this example are for a specific migration effort. Your migration tasks and prerequisites may be different. You may consider using this as a template for your project plan.
Table 2-1 Sample migration project tasks
Task ID number 1 2 3 4 5 6 7 8 9 10 11 12 Task Assessment Developer Education Developer soak time Administrator Education Administrator soak time Evaluation and selection of SCM Update DB2 test server Install SCM Install development environment Develop/modify build scripts Migrate application code Regression tests 6 7, 8 1 3, 9 10, 11 Unit test code is migrated with application code. Unit testing occurs during this task. Functional tests are probably not necessary, since were not changing function. 1 2, 9 1 4 Administrators work on system test environment. Evaluate CVS/ClearCase. Update DB2, migrate existing data, test. Effort depends on selection of SCM. Ten developers take 1/2 day each to do their own installation. Prerequisite task number Comments
76
Task ID number 13
Comments Existing deployment and configuration scripts are updated. Dont have too many of these. Update, migrate existing data, test.
14 15 16 17 18 19 20
Update preproduction DB2 Preproduction migration phase I Testing phase I Preproduction migration phase II Testing phase II Preproduction migration Phase II Testing 5,12,14 15 16 17 18 19
First branch is migrated. Spend a lot of time testing to make sure this works before going to production. Second branch is migrated.
Remaining servers are migrated. Make sure this really works before going to production.
This task list stops short of tasking the rollout into the production environment. With the migration tasks identified, the next step is to estimate the time required to complete each task. As part of a more robust task list, the number of resources required to complete a task is a useful inclusion. The captured task information can be used to generate a schedule. The captured prerequisites will help you to organize the tasks, apply dates, and allocate resources for the migration effort. There are a number of very good software packages available to assist in this regard.
Scheduling
Scheduling is a matter of stringing these tasks together (this is where software can be helpful). Many of these tasks can be completed in parallel, which can make scheduling a difficult chore. Figure 2-24 on page 78 shows an example of a very high-level migration schedule.
77
Prepare
Development Remediate Install Development Environment Educate Assess Install System Test Environment
Migrate
Test
Deploy
Check Point
Check Point
Test
Check Point
Migrate Code
Educate Administration
Migrate QA Environment
2.7 Summary
When planning a migration, it is important to look at the application code and runtime environments. There are other aspects of enterprise application ownership that must be considered. Code migration itself may take only days to effect; once migrated, the application will likely continue to be evolved and enhanced. This requires that developer skills be migrated as well. Similarly, administrator skills must also be migrated. Other less obvious issues must be considered including such things as build and deployment processes. Individually, each of these issues may take a relatively small effort to effect, but they are important. The key part of every migration effort is careful planning. Careful planning starts with assessment. It is during the assessment that the parts of enterprise application ownership are considered. Every application and runtime configuration is different. It is difficult to assemble a single plan that is appropriate for everyone. The migration strategies and scenarios presented in this chapter represent ideal situations. These strategies and scenarios must be combined to provide the best match for your specific situation. Careful planning is the key. New versions of WebSphere Application Server will be produced; expect to undergo a migration every 18-24 months. Include migration as part of your ownership plan.
78
Further reading
Extreme Programming Explained: Embrace Change, by Kent Beck, published by Addison-Wesley, 1999 Refactoring: Improving the Design of Existing Code, by Martin Fowler, published by Addison-Wesley, 1999
79
80
Chapter 3.
81
Migrating from VisualAge for Java Visual Composition Editor to Visual Editor for Java Converting from VisualAge for Java Persistence Builder to EJB 2.0 Build setup (library JARs, dependent project JARs, Ant builds) Downloads and information for new WebSphere Studio development products (WebSphere Studio Application Developer and WebSphere Studio Site Developer) may be found at: http://www.ibm.com/Websphere/developer/zones/studio/transition.html The IBM WebSphere Studio Application Developer V5.0 supports both the WebSphere Application Server V4.0 and V5.0 test environments. The new Application Developer V5.0 product is more stable and provides more functions than its predecessor Application Developer V4.0 product. In light of these advantages, the Application Developer V5.0 product is recommended for use in development of applications for both V4.0 and V5.0 WebSphere Application Servers. Information about using IBM WebSphere Studio Application Developer can be found in the Getting Started guide and the online help. Read the installation guide prior to installing WebSphere Studio Application Developer. After you have successfully installed WebSphere Studio Application Developer, read the Getting Started guide and complete the Getting Started tutorials. The tutorials will introduce you to Application Developer, Java development, and Web services. After you have completed the tutorials, read this guide to migrate your resources into WebSphere Studio Application Developer. In this version of WebSphere Studio Application Developer Version 5, you can migrate code from VisualAge for Java, or WebSphere Studio Classic or WebSphere Studio Application Developer Version 4.0.x or WebSphere Studio Application Developer Version 5 Beta. If you wish to migrate previously developed applications from an IBM WebSphere Application Server Standard Edition environment to the WebSphere Application Server - Express environment, refer to Migrating Applications from WebSphere Application Server Standard Edition to WebSphere Application Server-Express V5 at http://www.ibm.com/redbooks/redpapers/abstracts/redp3618.html. This chapter uses Windows conventions throughout. In most instances, the Windows convention can apply to Linux as well. For example, "WS_Installdir\" in Windows is equivalent to "WS_Installdir/" in Linux.
82
83
3.3.1 Differences between WebSphere Studio Application Developer Version 4.0.x and Version 5
The following is a partial list of enhancements since Version 4.0.x: WebSphere Studio Application Developer Version 5 can generate code for either WebSphere Application Server Version 4.0.x or Version 5, and includes both WebSphere Application Server Version 4.0.3 and Version 5 Test Environments.
84
The enterprise applications archives (EARs) J2EE level has changed from 1.2 to 1.3 for WebSphere Application Server Version 5 projects. J2EE 1.2 EARs will run on either WebSphere Application Server Version 4.0.x or WebSphere Application Server Version 5. The Enterprise Java Beans (EJB) specification level has changed from 1.1 to 2.0 for WebSphere Application Server Version 5 EARs. EJB 1.1 projects are still supported, and may be part of either WebSphere Application Server Version 4.0.x J2EE 1.2 EARs or Version 5 J2EE 1.3 EARs. The Web applications (WARs) J2EE level has changed from 1.2 to 1.3 for WebSphere Application Server Version 5 projects. The JSP level has changed from 1.1 to 1.2 and the Servlet level has changed from 2.2 to 2.3. J2EE 1.2 Web projects (WARs) are still supported, and may be part of either WebSphere Application Server Version 4.0.x J2EE 1.2 EARs or Version 5 J2EE 1.3 EARs. In Version 5, you can create static Web projects as well as J2EE Web projects. In a static Web project you will only be able to create content served by a traditional HTTP server (HTML, JavaScript, images, text, and so on). The underlying workbench, which is based on the Eclipse open-source project, has changed from Version 1.0 to Version 2.0: There is a new and much improved Java builder There is a new and much improved VCM interface for SCM vendors Page Designer Classic and Page Designer are both available. For more information, see 3.3.3, Internal changes from Version 4.0.3 on page 86.
85
MigrateWC takes a .91 or 1.0 JSP and converts it to a 1.1 JSP. It also takes a 2.1 Servlet and converts it to a 2.2 Servlet. XMLconvert converts XML configuration files from Release 3.02.x or Release 3.5.x to Release 4.0 format.
Version 5 Web WARs are source location incompatible with Version 4.0.3
Because of the WebSphere Studio Application Developer internal changes described in the two Web sections below, a Version 5 J2EE 1.2 Web WAR, when exported with Java source, will import into WebSphere Studio Application Developer Version 4 but will not build (even though it is at the same J2EE 1.2 runtime level). The source folders will be in the Version 5 structure, and must be manually moved to the old Version 4 structure location before building. The WAR still executes correctly on WebSphere Application Server Version 4 (since it ignores any embedded source); it is only a development tool difference.
86
87
4. A Configuration Changes window opens. Select the check box within the Detected changes field that includes Page Designer Classic (5.0.1). 5. Click Finish. The Install/Update window opens. 6. Click Yes. The workbench will restart to make the changes effective. To change the default HTML/JSP editor: 1. Select Window -> Preferences -> Workbench -> File Associations. 2. In the File types field, select *.html or *.jsp or both, or whatever you would like to assign to Page Designer Classic. 3. In the Associated editors field, select Page Designer Classic and click Default. If you do not want to change the default to become Page Designer Classic, you can still select an HTML or JSP file, click it, and then select Open With -> Page Designer Classic.
88
Tag Checker, Accessibility Checker WebSphere Transcoding Publisher annotation support Insertion of ActiveX controls Image pasting with logo/photo frame creation Page editing assist for ruler or various wizards for component insertion URL editor, heading editor, Table of Contents generation WYSIWYG View Bi-Directional (BiDi) language support Color gallery prepared by professional designers
89
3. Install Version 5. 4. Close WebSphere Studio Application Developer Version 4 and start WebSphere Studio Application Developer Version 5. Tip: In Version 4, the workspace directory was located in the installation directory, by default. In Version 5, this default has changed to a directory called workspace in the My Documents directory. If you wish to override the location where you work is stored, use the -data option on the wsappdev.exe command when you start the workbench. Do not use -data to point to an existing Version 4 workspace, since that is a different unsupported approach to migrate. (For more information, refer to 3.3.6, Migrating projects using an existing Version 4.0.x workspace on page 92.) 5. Click Windows -> Preferences -> Workbench and uncheck Perform build automatically to avoid build errors as individual dependent projects are loaded. 6. For CVS: Load all of the projects that you want to work with from the SCM repository into WebSphere Studio Application Developer Version 5. 7. For ClearCase: Use a clean Version 5 workspace, then for each project to be loaded, select File -> Import -> Existing WebSphere Studio 4.x ClearCase Project into Workspace. 8. Click Windows -> Preferences -> Workbench and check Perform build automatically to restore your settings. 9. Do a full rebuild (click Project -> Rebuild All), and save the resulting projects back into your repository in your new Version 5 stream. (Do not mix these resources with your ongoing Version 4 stream.) Note: These projects are now Version 5 projects and cannot be used by WebSphere Studio Application Developer Version 4.0.x Post migration considerations: Version 4 CVS files were stored as binary (no CarriageReturn/LineFeed translations). If you work in a mixed (DOS/Windows plus UNIX/Linux) platform environment, you might wish to now mark source files as text (by clicking Team -> CVS -> Change ASCII/Binary Property) and resave them in CVS. Version 4 Web projects from a CVS repository require that you prune empty directories. Click Window -> Preferences -> Team -> CVS -> Prune empty
90
directories setting (the default is that it is enabled). If it is not disabled, and you load a Web project with an empty source folder (such as the MyHomePage Web example), then you will get the following errors at check-in:
The project was not built since it is involved in a cycle or has classpath problems. Missing required source folder: /MyHomePageExample403/source.
For Web projects saved and loaded from a ClearCase repository, you need to have a file checked out before you can open it in the editor. If it is not checked out, you receive an error activating this view. (Null pointer exceptions in logs for Page Designer notify the user of known problems and ways to avoid them.) With web.xml editor, editing a web.xml file you need to have web.xml, ibm-web-bnd.xml, and ibm.web-ext.xmi checked out. (There are indications that you need these files to be checked out on the status line, which states that they are read only, but it is easily missed.) If your projects have circular dependencies, Version 5 reports a build error. Click Window -> Preferences -> Java -> Compiler, select the Other tab, and clear the Stop building when an invalid class path is detected check box. The .vcm_meta (or .cc_meta) files could now be deleted from the Version 5 project because they are not used by Version 5 (it uses a new .project file instead) and because you are using a new repository branch (stream) for these Version 5 projects. Note that these files are still needed in the ongoing Version 4 branch (stream).
91
2. For each server configuration, in the Server Perspective, Server Configuration View window, right-click the server and click Open. a. You will get a similar autocorrect window. b. Click Yes. c. Save and then close the editor window.
92
3. Back up the contents of workspace_directory, where workspace_directory is the fully qualified directory name that contains the Version 4.0.x workspace. By default, the Version 4.0.x workspace subdirectory is located in the same directory where the product is installed. You will need this backup if you ever want to work with WebSphere Studio Application Developer Version 4.0.x again. Once you have pointed to a Version 4.0.x workspace from a Version 5 IDE, you can no longer go back to using that workspace in WebSphere Studio Application Developer Version 4.0.x. 4. Install WebSphere Studio Application Developer Version 5. 5. When you start WebSphere Studio Application Developer Version 5 with a Version 4.0.x workspace from a command prompt, use the -data option to specify a fully qualified path to the Version 4.0.x workspace directory on the wsappdev.exe command. This will cause an upgrade of the .metadata information. 6. When prompted to confirm that you wish to convert to the new user interface format, click OK. 7. Before doing any rebuilds or validating any projects that are in the workspace, select all of the projects in the Navigator view within the Resource perspective and then select Refresh from the pop-up menu. This will ensure that all files are synchronized with their appropriate metadata. 8. Open any closed projects (see Known problems and limitations on page 94). 9. Verify your class path variables (see Known problems and limitations on page 94). 10.Some builders and validators have been added, removed, or modified in Version 5. To ensure that the correct errors and warnings are shown, you must rebuild all the projects by selecting Project -> Rebuild All, and then select Run Validation for each Java project. 11.Some user preferences might be maintained, but many others will not be. Check your preference settings in Version 5 to be sure that they are as you want them.
93
a. A window pops up with the message: The absolute path of one or more modules has changed since the last time this Application was saved..... Would you like to autocorrect? b. Click Yes. c. Save and then close the editor window. 2. For each Server configuration, in a Server Perspective, Server Configuration View, right-click the server and click Open. a. You will get a similar autocorrect window. b. Click Yes. c. Save and then close the editor window.
For previously SCM shared projects, the Team menu contains Share Project
Team support has changed significantly between Eclipse 1.0 and 2.0. The method of sharing projects with the repository has changed as well. If you select Team -> Share Project, a wizard will guide you through the migration process. When you are finished, your project will be shared and the Synchronize view will open. You will see conflicting changes on every file. This is because of changes in the way sync information is stored between Eclipse 1.0 and 2.0.
94
If you do not have any outgoing changes (which you should not have if you committed all your outgoing changes before upgrading as recommended above), then you can simply select the project in the Synchronize view and select Override and Update which will load the current contents from the server. If you do have outgoing changes, you can pull down the triangle menu in the Synchronize view and select Compare File Contents. After some work, the Synchronize view will show you only the files that are actually different. You can then use the Synchronize view to resolve these conflicts.
95
Note that this changes the internal WebSphere Studio Application Developer project structures into the new Version 5 internal structure, but it does not convert the J2EE level of that project. If you wish to convert an existing project (either in the old Version 4 structure or the new Version 5 structure) into the new J2EE specification level (which will also automatically convert any old projects into the new Version 5 structure), then: 1. Right-click the project 2. Select Migrate -> J2EE Migration Wizard Note that this changes the project J2EE level, but does not change any code. EJB beans are not migrated to EJB 2.0, and Servlet and/or JSP code is not changed (that is left to the developer).
3.4 Migrating from WebSphere Studio Application Developer Version 5 Early Availability or Beta versions
WebSphere Studio Application Developer Version 5 Beta was a limited availability beta, and the WebSphere Studio Application Developer Version 5 Early Availability was available to the Passport Advantage subscribers. No migration is required. The Version 5 Early Availability or the Version 5 Beta workspaces may be used (or shared) directly with Version 5 General Availability. The Version 5 Early Availability or the Version 5 Beta projects in Software Configuration Management (SCM) systems (CVS or ClearCase) may be used (or shared) directly with Version 5 Early Availability.
3.5 Migrating from WebSphere Studio Classic to WebSphere Studio Application Developer
This section documents how to migrate from WebSphere Studio Version 4.0 (both Advanced and Professional Edition) to the WebSphere Studio Application Developer. Migrating from WebSphere Studio Classic Version 4.0 to WebSphere Studio Application Developer Version 5.0 involves the following steps: 1. Create a new single-server stage for migration. 2. Create a Web configuration descriptor file. 3. Export a migration JAR file.
96
4. Import the migration JAR file into WebSphere Studio Application Developer. 5. Set up your server and test your migrated application. Note: The following instructions are for migrating from WebSphere Studio Version 4.0. If you want to migrate from an earlier version of WebSphere Studio, you should migrate to WebSphere Studio 4.0 first, then migrate to WebSphere Studio Application Developer. The advanced publishing feature (mapping files to publishing stages) and the Page Detailer feature (analysis of Web pages) of WebSphere Studio Classic is not available in WebSphere Studio Application Developer. Some other features from the Version 4.0.x CD media pack are also no longer available, for example the Page Detailer feature for analysis of Web pages, the HotMedia feature for rich media types, the Voice XML editor (moved to WebSphere Everyplace Toolkit and Portal Toolkit), and the DataBaseWizard for pervasive devices. You should be aware of the following limitations before you migrate any of your WebSphere Studio data: WebSphere Studio Application Developer uses an XML-based SQL editor, so your .sql files cannot be used in it. Project publishing information and stage information cannot be migrated. WebSphere Studio server configuration information cannot be migrated. Version control information cannot be migrated. During the migration process outlined below, WebSphere Studio creates a JAR file that contains all of your project files, publishable and source, for a single server. All the files visible in the Publishing view for the default server will be packaged into the JAR file. You can then import the JAR file into WebSphere Studio Application Developer. When you migrate existing projects, all the project publishing information and the stage information are lost during the migration. If your stage has multiple servers, only files published to the default server are kept. Therefore, for the purpose of migration, you will create a new stage that has only one server.
97
3. Click Add. 4. Click OK. 5. Click Project -> Publishing Stage and select Migration from the list of available stages. 6. While in the publishing view, click Insert -> Server. 7. Type a server name, such as localhost. 8. Changing the server or changing the publication stage does not propagate the Servlet mapping information for WebSphere Application Server Version 4.0. Go to the Publishing view, and, for each Servlet, click Properties -> Publishing -> Servlet Mapping and then copy the actual Servlet mapping.
98
3.5.4 Importing the migration JAR file into WebSphere Studio Application Developer
1. Start WebSphere Studio Application Developer. 2. Create a Web project (File -> New -> Project -> Web Project). 3. In the Project name field, type the name of your Web project. This should be the same name you specified in step 1 in 3.5.3, Exporting a migration JAR file on page 98. 4. Specify the name of a new or existing EAR project that will contain the new Web project for purposes of deployment. 5. In the Context Root field, type the Webapp Web Path name you specified when you created the migration JAR file in WebSphere Studio. Click Finish. 6. In the Navigator view, select the Web project you just created. 7. Import the JAR file. a. Click File -> Import. b. Select the WAR file and click Next. You must import the JAR file using the WAR file option; otherwise it will not work properly. c. Enter the path to localhost.jar in the WAR File field or click Browse to search for it. (You can only browse for a WAR name, not a JAR name.) d. Select the Web project that you created. The Context Root field is automatically populated with the value you specified earlier. e. Select the EAR project you created earlier. f. Click Finish. WebSphere Studio Application Developer unpacks localhost.jar. 8. You may have several unresolved references or missing import files. These will appear in the Tasks view. To fix this, you must change the Java build path for the Web project: a. Right-click the project and click Properties -> Java Build Path. b. Click the Libraries tab. Click Add External JARs. c. Import any JARs that you need from the following directories: i. plugins/com.ibm.etools.websphere.runtime/lib ii. plugins/com.ibm.etools.websphere.tools/runtime 9. In the Navigator view, right-click the project and select Rebuild Project.
99
3.6 Migrating from VisualAge for Java to WebSphere Studio Application Developer
This section documents how to migrate from VisualAge for Java Professional Edition or VisualAge for Java Enterprise Edition to WebSphere Studio Application Developer. Migrating from VisualAge for Java to WebSphere Studio Application Developer involves the following steps, which are explained in more detail later in this section: 1. Export your Java files and project resource files from VisualAge for Java. 2. Start WebSphere Studio Application Developer and create new projects to contain your code. 3. Import your Java and project resource files into WebSphere Studio Application Developer. 4. Use the web.xml editor to ensure that any Servlets are correctly defined (Web project only). 5. Migrate your VisualAge for Java project and workspace build and execution settings. 6. Set up your server and test your migrated application(s). 7. Deploy your applications from WebSphere Studio Application Developer to WebSphere Application Server. 8. Share the WebSphere Studio Application Developer project settings between multiple developers (post-migration). The instructions given in this section are for migrating from VisualAge for Java Version 3.5.3 or 4.0 for Windows. If you want to migrate from an earlier version of VisualAge for Java to WebSphere Studio Application Developer, you should first migrate from your earlier version of VisualAge for Java to Version 4.0 for Windows (if you have enterprise beans) or Version 3.5.3 or 4.0 for Windows (without enterprise beans), before migrating to WebSphere Studio Application Developer. Version 4.0 includes a special tool (the EJB Export Tool) for exporting
100
enterprise beans, which you need in order to migrate EJB applications to WebSphere Studio Application Developer. All other data can be migrated from either Version 3.5.3 or Version 4.0. Note: [Windows] Instantiations, Inc., an IBM Business Partner, distributes a product called CodePro Studio that provides productivity enhancements to VisualAge for Java and WebSphere Studio Application Developer, including migration and co-existence facilities. To help VisualAge for Java customers begin their migration, Instantiations is offering a free, unlimited-use VisualAge for Java to WebSphere Studio Application Developer export facility as part of their time-limited evaluation copy of CodePro Studio. You can download the evaluation copy from http://www.instantiations.com/vaj-migrate. For further information on Instantiation's advanced migration and co-existence support including full bi-directional export/import of files, creation of export/import sets, project synchronization, and task automation, refer to the Instantiations, Inc. Web site at http://www.instantiations.com/codepro/ws.
3.6.1 Differences between VisualAge for Java and WebSphere Studio Application Developer
The following is a partial list of changes from VisualAge for Java: The Enterprise Java Beans (EJB) specification level has changed from 1.0 to 1.1 (EJB 2.0 is also supported for applications that will be deployed to WebSphere Application Server Version 5). For Web applications, the JSP level remains at 1.1 (1.2 for WebSphere Application Server Version 5 applications). For Web applications, the Servlet level remains at 2.2 (2.3 for WebSphere Application Server Version 5 applications). The level of the Java 2 platform that is supported has changed from 1.2 to 1.3. (The compiler can target 1.4 code generation, but the WebSphere Application Server runtime environment is still 1.3.) The Visual Composition Editor has been replaced by the Visual Editor for Java. VisualAge for Java version control and the propriety source code repository have been replaced by support for software configuration management (SCM) plug-ins. The VisualAge for Java Tools API has been replaced by the WebSphere Studio Workbench plug-in architecture. The VisualAge for Java XML tools have been replaced by WebSphere Studio Application Developer XML tools.
101
The VisualAge for Java project concept has been replaced by multiple types of WebSphere Studio Application Developer projects. Convertors in VisualAge for Java EJB AccessBeans (not Data AccessBeans) are not available in WebSphere Studio Application Developer EJB AccessBeans. Use EJB convertors/composers in the underlying EJBs instead. For more information about EJB convertors/composers, refer to the online help documentation.
102
Exporting your Java files and project resource files from VisualAge for Java
There is no support for the bulk migration of versioned projects and resources from the VisualAge for Java repository. You can only migrate projects and resources that are in your VisualAge for Java workspace. If you want to migrate a versioned copy of a project or resource into WebSphere Studio Application Developer, you must bring it into your VisualAge for Java workspace and then migrate it. Note: If your project contains more than one kind of data (for example, enterprise beans and Java source code files), you should split up your data into different JARs based on their type. Export your projects to a JAR file by following these steps: 1. If the projects that you want to export are not currently in your VisualAge for Java workspace, add them to the workspace now. 2. In the VisualAge for Java Workbench window, select your project(s), right-click, and click Export. 3. Select the Jar file radio button and click Next. 4. Specify the name of the JAR file. 5. Select the .java check box to export your Java files and the resources check box to export your resource files. 6. Fill in the other fields as required. Refer to the VisualAge for Java online help for more information on how to perform this task.
Starting WebSphere Studio Application Developer and creating new projects to contain your code
Start WebSphere Studio Application Developer, then create the appropriate projects. The following is a set of general migration guidelines to help you decide which kind of WebSphere Studio Application Developer project you should import your files into: If your code is part of a Web application, you should import the code into a Web project: Import all Java files into the Web project source directory (the proper hierarchy based on their package statements will automatically be created by WebSphere Studio Application Developer) Import all resource files into the Web project webApplication directory.
103
If your code is straight Java (for example, an application that will run stand-alone), you should import the code into a Java project. If your code is enterprise beans, you should import the code into an EJB project. Note: The preceding is only a general set of guidelines to help you decide which kind of WebSphere Studio Application Developer projects you should use. We recommend that you read the WebSphere Studio Application Developer online help and become familiar with the different kinds of WebSphere Studio Application Developer projects before you create any projects or import any code.
Importing your Java and resource files into WebSphere Studio Application Developer
1. Open WebSphere Studio Application Developer and switch to the Resource perspective. 2. Click File -> Import -> the zip file. Click Next. 3. Browse to the appropriate JAR file. 4. Select the files you want to import and the project or folder you want to contain your files. Note: When you import your files into WebSphere Studio Application Developer, you should ensure that they go in the appropriate directory. We recommend that you read the WebSphere Studio Application Developer online help and become familiar with the different kinds of WebSphere Studio Application Developer projects before importing your code. This will help you determine which folders should contain which kind of code.
Using the web.xml editor to ensure that Servlets are correctly defined (Web project only)
If your application uses Servlets, then you need to define the Servlet-URL mappings in the web.xml file. Follow these steps: 1. In the Web perspective, open the web.xml file, which is located in the webApplication/WEB-INF subdirectory of your Web project. 2. Click the Servlets tab. 3. Click Add, and select the Servlet radio button. 4. Type the Servlet name and click OK.
104
5. Click Browse to change the Servlet class value to the appropriate package name. 6. (Optional) The display name is a short name used to identify the Servlet. In the Display name field, type a short name for the Servlet. 7. A URL mapping defines a Servlet and a URL pattern. Click the Add button located next to the URL mappings field, then type the name of the URL mapping. 8. Save the changes (File -> Save web.xml) and close the web.xml file.
Resource associations
If you set up an association between a file type and an executable, you can open a file that sits outside the workbench from within it. In VisualAge for Java, you set up your resource associations in the Options window (click Window -> Options -> Resources -> Resource Associations). After you have migrated your resource files to WebSphere Studio Application Developer, you can set up your resource associations using the Preferences window (click Window -> Preferences -> Workbench -> File Editors).
Code formatter
In VisualAge for Java, you set up your code formatting options in the Formatter page of the Options window (click Window -> Options -> Coding -> Formatter). After you have migrated your code to WebSphere Studio Application Developer,
105
you can set up your code formatting in the Preferences window (click Window -> Preferences -> Java -> Code Formatter).
106
your_WebSphere_Studio__Web_project/webApplication/WEB-INF/web.xml file in WebSphere Studio Application Developer. For example, if you have modified Servlet names and Servlet paths in the default_app.webapp file, you would make the corresponding changes in your web.xml file.
Setting up your WebSphere V4 test environment and testing your migrated application(s)
If the application is a Java project, then you just use the normal WebSphere Studio Application Developer Run or Debug support for Java projects to test it. If the application uses WebSphere Application Server (Web projects and EJB projects do), then test it using the built-in WebSphere Application Server. This requires that a default test server be created and started. For an EJB project, right-click the EJB project and select Run on Server to run the EJB Test Client. For a Web project, right-click the main HTML page and select Run on Server to launch the Web browser. For information on testing other types of projects, refer to the online help.
Deploying your applications from WebSphere Studio Application Developer to remote WebSphere Application Server
If you are using the WebSphere Application Server as your runtime environment, deploy your application using the Server Tools feature of WebSphere Studio Application Developer.
Sharing WebSphere Studio Application Developer project settings between multiple developers (post-migration)
WebSphere Studio Application Developer projects (and their associated settings) can be shared between developers. To do this, save a project into the WebSphere Studio Application Developer software configuration management (SCM) server, then extract it onto another team member on the WebSphere Studio Application Developer.
107
3.8 Migrating enterprise beans from VisualAge for Java to WebSphere Studio Application Developer
This section provides instructions on how to migrate your VisualAge for Java enterprise beans to WebSphere Studio Application Developer. Migrating VisualAge for Java enterprise beans to WebSphere Studio Application Developer involves the following steps: 1. Export VisualAge for Java enterprise beans as a 1.1 JAR using the VisualAge for Java EJB Export tool. 2. Import the EJB 1.1 JAR WebSphere Studio Application Developer. 3. Generate deploy code and data source binding information. 4. Create a server configuration and instance. 5. Add data source information to your configuration. 6. Test the enterprise beans with the new EJB test client. This section also contains information about: Items migrated Code changes due to EJB 1.0 specification versus EJB 1.1 specification VisualAge for Java Version 3.5.3 EJB 1.0 JARs versus VisualAge for Java Version 4.0 EJB 1.1 JARs
108
Moving multiple VisualAge for Java EJB groups into WebSphere Studio Application Developer EJB projects
3.8.1 VisualAge for Java EJB Export Tool (migrating map/schema from EJB 1.0 to EJB 1.1)
VisualAge for Java Version 4.0 includes a special tool (the EJB Export Tool) for migrating enterprise beans. Therefore, all enterprise beans must be migrated from that version to WebSphere Studio Application Developer. Note that the tool migrates VisualAge for Java EJB 1.0 map/schema metadata into EJB 1.1 map/schema XML files, but does not change the code in any way (it is still EJB 1.0 code). Note: It is recommended that all of your database tables contain a table qualifier prior to exporting using the VisualAge for Java Version 4.0 EJB Export Tool. Most databases require a table to have a qualifier, and the WebSphere Studio Application Developer workbench does not handle empty qualifiers when one is expected for the database vendor. There is an Export tool for EJB 1.1 fixpack (be sure to get the latest Version 4.1.5 or later), available from the VisualAge Developer's Domain (see http://www7.software.ibm.com/vad.nsf/Data/Document4624) which fixes certain defects with the tool. One defect the fixpack fixes is a problem the EJB tool has if a group has relationships with two or more ForeignKeys mapping to the same two or more tables. Refer to the fixpack's Readme file for more information about the defects the fixpack fixes.
Items migrated
The following items are migrated when you migrate your enterprise beans: Entity beans (CMP, BMP) Session beans (both stateful and stateless) Finder helpers (method and where custom finders) Inheritance (with multi-levels) Associations Mappings and schemas Deployment and control descriptions
109
3.8.2 VisualAge for Java Version 3.5.3 EJB 1.0 JARs versus VisualAge for Java Version 4.0 EJB 1.1 JARs
In VisualAge for Java Version 3.5.3 you can generate an undeployed EJB 1.0 JAR, or generate a deployed EJB 1.0 JAR (with deployment code, stubs, tie code, and so on). You can import the EJB 1.0 JAR into the WebSphere Application Server Version 4.0 Application Assembly Tool AAT) and use that to generate deployment and control descriptors and to run the EJB Deploy Tool to generate deploy code, stubs, and so on into an EJB 1.1 format JAR (enterprise applications archives). The net result of the previous steps is that you can have a deployed JAR that can be run in WebSphere Application Server Version 4.0, and hence can also be run in WebSphere Studio Application Developer (since its WebSphere Test Environment is a WebSphere Application Server Version 4.0 server). However, runtime execution does not imply ongoing development capability. You can include the previously generated Java code into the corresponding EJB JARs and import that into WebSphere Studio Application Developer, and WebSphere Studio Application Developer would parse and understand the EJB session support, security information, finder information, and assembly descriptor (const methods, and so on). However, extensions (class inheritance and ForeignKey associations) and the map and schema information are all lost. They can only be retained if you use the VisualAge for Java Version 4.0 EJB Export Tool, to create an EJB 1.1 JAR containing the map and schema XML information and extension XML information. As well, the names of generated stub classes are different in 1.0 from 1.1 enterprise beans. The net result is that neither an EJB 1.0 JAR nor an EJB Deploy Tool EJB 1.1 JAR retains the basic design metadata to allow them to be used for ongoing development in WebSphere Studio Application Developer. The VisualAge for Java Version 4.0 EJB Export Tool produces an EJB 1.1 JAR that contains all the EJB design metadata, including the map and schema information and the extensions (class inheritance and ForeignKey associations), so that you can immediately continue to develop within WebSphere Studio Application Developer and regenerate deployment code anytime it is required. This is the only supported method of migrating VisualAge for Java enterprise beans into WebSphere Studio Application Developer, and the use of the VisualAge for Java Version 4.0 EJB Export Tool is the only method that will work for ongoing EJB development within WebSphere Studio Application Developer.
110
3.8.3 Moving multiple VisualAge for Java EJB groups into WebSphere Studio Application Developer EJB projects
In VisualAge for Java, you may have multiple EJB groups, with each group being used for intragroup inheritance or associations. Typically, you would export each VisualAge for Java EJB group (using the VisualAge for Java 4.0 EJB Export tool) into a matching JAR, and then import that JAR into a matching WebSphere Studio Application Developer EJB project. WebSphere Studio Application Developer EJB projects correspond to EJB modules. Where intragroup inheritance or associations are not required, you may wish to keep the EJB groups as separate EJB projects - you can close individual projects and hence keep the overall memory requirements down. WebSphere Studio Application Developer has the concept of enterprise-level grouping, using WAR and EAR files, so several EJB groups can be logically combined that way, and then deployed as if they were a single unit. If you import multiple EJB groups into the same EJB project, then any XML in them may not be correctly merged (the last imported group overwrites).
111
d. After you have imported your EJB files, follow the instructions in 3.8.6, Locating EJB information on page 114 to help you find out where to find your EJB and method properties, your schemas, maps, and so on. 3. Generate deploy code and data source binding information: a. In the J2EE Hierarchy view, expand the EJB Modules folder and select the newly imported EJB JAR. b. From the EJB JAR's pop-up menu, click Generate -> Deploy and RMIC Code. Select to generate code for all your beans. c. From the EJB JAR's pop-up menu, click Open With -> EJB Deployment Descriptor. d. In the EJB deployment descriptor, select the Overview tab. e. Select your EJB JAR, and type the WebSphere binding JNDI name and the Data Source Binding JNDI name. Record this data source name, since you will use it later when you configure your data source in the test server instance. f. Save your changes and close the EJB deployment descriptor. 4. Create a WebSphere Studio Application Developer server configuration for your test server, if you do not already have one: a. Switch to the Server perspective. b. Click File -> New -> Server Project. c. In the Project name field, type ServerTest. Click Finish. d. In the Navigator view, select ServerTest. From its pop-up menu, click New -> Server Instance and Configuration. e. Type the name of the server, for example, MyServer, and select ServerTest from the Folder list. f. In the Server instance type field, expand WebSphere Version 4.0 and select Test Environment. In the Template field, click None. g. Click Next. Specify a server port number of 8080. h. Click Finish. A new server configuration and instance will be created. 5. Add data source information to your server configuration: a. In the Server Configuration view, expand Server Configurations and select your server. b. Right-click it and from your pop-up menu, click Open. c. Select the Data source tab.
112
d. In the JDBC Driver List, select the appropriate database driver (for example, Db2JdbcDriver if you are using DB2) and click Edit. e. Verify that the Class path field contains the correct path to db2java.zip. Click OK. f. If you are not using DB2, add a new driver. Ensure that you use the J2EE JDBC driver that the Database vendor provides. g. Select your JDBC driver, and click the Add button that is to the right of the Data source field. h. In the Add a data source window, type a data source name. In the JNDI name field, type the same name you used in step e on page 112. Enter the name of your database and click OK. i. Save your changes. 6. Test the enterprise beans with the new EJB test client: a. In the Server Configuration view, expand Server Configurations and select your server. Right-click it, and click Add Project. Select the EAR project that contains your EJB module. b. In the Servers view, select your server instance. Right-click it and from its pop-up menu, click Start. c. The project will be published and the server will start. After a few moments, click the Console tab to view the console window. You should see a message saying the Default Server is open for e-business. Scroll through the console to verify the EJB JAR has been started. d. In the J2EE Hierarchy view, expand the EJB Modules folder, select the enterprise bean that you want to test, right-click it, and click Run on server.
113
If you set up the Preferences page (in WebSphere Studio Application Developer) to stop an automatic build from being done every time you save changes, you must perform the following steps to generate the EJB deployed code and RMIC stubs: a. Select your EJB project, right-click and select Generate -> Deploy and RMIC Code. b. Because the RMIC compiler can only see compiled code and since the generated Java classes were not compiled yet, it will give an error. Switch to the Java perspective and build the project. c. Repeat step a. You should not receive any errors this time. d. Repeat step b, since you want to compile your newly generated stubs so you do not receive runtime errors when you deploy your enterprise beans.
114
Item Isolation levels or find for update or readme methods marking EJB environment variables
Location Expand the EJB Modules folder in the J2EE Hierarchy view and select the EJB JAR that you want to work with. From its pop-up menu, click Open With -> EJB Deployment Descriptor. In the deployment descriptor, click the Access tab. Expand the EJB Modules folder in the J2EE Hierarchy view and select the EJB JAR that you want to work with. From its pop-up menu, click Open With -> EJB Editor. In the editor, click the Beans tab.
115
becomes:
Context env = (Context)(new InitialContext()).lookup("java:comp/env"); String homeName = (String)env.lookup("ejb10-properties/TARGET_HOME_NAME");
116
CMP enterprise beans ejbCreate(...) methods should return the bean's primary key class (instead of void). New HomeHandle interface, and EJBHome interface requires new getHomeHandle() method:
public javax.ejb.HomeHandle getHomeHandle() { return null; }
You should consider enhancements to match EJB 1.1 changes such as: Entity bean primary keys can now be java.lang.String objects. Entity bean finder methods should define FinderException in their throws clause. Entity bean finder methods return java.util.Collection. Check the format of your JNDI names (and local namespaces are now supported). There are now security roles, and isolation levels are now defined at the method level (they were defined at the EJB level for EJB 1.0). You should review the EJB 1.1 changes in general to see what other application changes are appropriate. For detailed information, refer to the following publications and Web sites:
Enterprise Java Beans Specification, Version 1.1, available at http://java.sun.com/products/ejb/docs.html (see Section 1.3, Application compatibility).
The IBM WebSphere InfoCenter, found at http://www.ibm.com/software/webservers/appserv/doc/v40/aes/infocente r/index.html. Refer to the following sections: Transitioning to Version 4.0 (Click Application Server AE ->Migration -> Transitioning to Version 4.0 and read the Role-based security section) Migrating to supported EJB specifications (Click Application Server AE -> Migration -> 3.3 Migrating APIs and specifications -> 3.3.1 Migrating to supported EJB specifications) Migrating from Version 3.x (Click Application Server AE ->Migration -> 3.2 Migrating from previous products versions -> 3.2.2 Migrating from Version 3.x)
WebSphere Version 4 Application Development Handbook, SG24-6134, available at http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246134.pdf (See the section Migrating 1.0 EJBs to 1.1 EJBs on pages 267-268).
117
Programming J2EE APIs with WebSphere Advanced, SG24-6124, available at http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246124.pdf (See the section on EJB 1.1 code changes on pages 113-114). EJB Development with VisualAge for Java for WebSphere Application Server, SG24-6144, available at http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246144.pdf (See Appendix B).
118
deployment tools is a concern, then care should be taken to write all EJB Query Language queries strictly according to instructions described in Chapter 11 of the EJB 2.0 specification. 4. For any CMP 1.x finder, return java.util.Collection instead of java.util.Enumeration. 5. For any CMP 1.x bean, change all occurrences of this.field = value to setField(value) in ejbCreate() and elsewhere throughout the code. 6. Update your exception handling (rollback behavior) for non-application exceptions: Throw javax.ejb.EJBException instead of java.rmi.RemoteException to report non-application exceptions. In EJB 2.0 and 1.1, all non-application exceptions thrown by the instance result in the rollback of the transaction in which the instance executed, and in discarding the instance. In EJB 1.0, the container would not roll back a transaction and discard the instance if the instance threw the java.rmi.RemoteException. 7. Update your Exception handling (rollback behavior) for application exceptions: In EJB 2.0 and 1.1, an application exception does not cause the container to automatically roll back a transaction. In EJB 1.1, the container performs the rollback only if the instance have invoked the setRollbackOnly() method on its EJBContext object. In EJB 1.0, the container was required to roll back a transaction when an application exception was passed through a transaction boundary started by the container. 8. Update any CMP setting of application-specific default values to be inside ejbCreate (not using global variables, since EJB 1.1 containers set all fields to generic default values before calling ejbCreate, which will overwrite any previous application-specific defaults). This approach will also work for EJB 1.0 CMPs. Important Note: In Application Developer Version 5, there is a J2EE Migration wizard to migrate the EJB beans within an EJB 2.0 project from 1.x into 2.0 (you cannot just migrate individually selected beans). It will perform migration steps #1 to #2 above, but not perform steps #3 to #7. It will also migrate EJB 1.1 (proprietary) relationships into EJB 2.0 (standard) relationships, plus other benefits. It will also maintain EJB inheritance.
119
To access the J2EE Migration wizard, right-click the EJB project and then select Migrate -> J2EE Migration Wizard. For more information about the different wizard options, press F1 while in the J2EE Migration wizard.
3.10 Migrating from VisualAge for Java Visual Composition Editor to Visual Editor for Java
This section provides instructions on how to migrate applications created in the Visual Composition Editor feature of VisualAge for Java to the Visual Editor for Java within WebSphere Studio Application Developer: Saving enhanced design-time metadata from VisualAge for Java Completing the migration (importing into WebSphere Studio)
120
3. Version the current application code into the VisualAge for Java repository (so you can return to this version in case of any ongoing VisualAge for Java development). 4. For each of your graphical applications within VisualAge for Java, select one or more of the graphical programs (typically XxxxxView), right-click, and then do the following: a. Click VCE Code Generation/Export, and be sure the Export to a directory after code regeneration option is selected. b. Leave Directory as the selected export destination, and click Next. c. Select your target directory, unselecting the .class option and selecting the .java option (since you want the source code), and then click Finish. d. Optionally, reload your VisualAge for Java code with its previous version (right-click and then select Replace with -> Previous edition).
3.11 Converting from VisualAge for Java Persistence Builder to EJB 2.0
This section provides an overview of how to convert your VisualAge for Java Persistence Builder applications to EJB 2.0 in WebSphere Studio Application Developer Version 5.0. Note: Complete details are found in an article posted on the WebSphere Developers Domain, which has a link from the WebSphere Studio Application Developer Transitions Web page at http://www.ibm.com/websphere/developer/zones/studio/transition.html.
121
Do the following steps: 1. Migrate and export the Persistence Builder Model as an EJB 1.1 JAR: a. Use the VisualAge for Java 4.0 tool to migrate the Persistence Builder Model into an EJB 1.0 Group (click OnlineHelp -> Tasks -> Adding Persistence -> Migrating Persistence Builder Model to EJB) b. Use VisualAge for Java EJB 1.1 Export Wizard to export an EJB 1.1 JAR 2. Import EJB 1.1 JAR into EJB 1.1 project, convert to EJB 2.0 project: a. Import an EJB 1.1 JAR into WebSphere Studio Application Developer EJB 1.1 project. Note: EJB 2.0 primarily provides server-side performance improvements. You should be able to get your Persistence Builder application converted and running using EJB 1.1 if you wish (and this might be a nice project stepping-stone before undertaking the EJB 2.0 conversion in order to achieve the performance enhancements). Alternatively, you can convert your server-side code to EJB 2.0 first, and then get your client and overall application running. b. For each bean within your EJB 1.1 project, set your read-only access intents (Read, or Update) and isolation levels (Repeatable read, or Read committed, or Read uncommitted, or Serializable). These are not exported out of VisualAge for Java and must be manually set. i. For each EJB project, right-click Open with -> EJB Deployment Descriptor Editor and open the Access tab. ii. Click Access Intent for Entities 1.x -> Add, or Edit, or Remove (as appropriate) iii. Click Isolation Level -> Add, or Edit, or Remove (as appropriate) 3. (Optional) Convert the client application and get the server running, all at the EJB 1.1 level: See details in step 6 on page 123, "Convert Persistence Builder client application into EJB client application". 4. Convert to EJB 2.0 project: Convert EJB 1.1 project into EJB 2.0 project by selecting your EJB project, then right-clicking File -> Migrate -> J2EE Migration Wizard. 5. Convert EJB 1.1 code to EJB 2.0 and set application profile declarations: a. Use the J2EE (EJB Bean) Migration wizard to convert from 1.x CMPs into 1.1 CMPs into 2.0 CMPs.
122
i. Refer to 3.9.3, Migrating code from EJB 1.x to EJB 2.0 on page 118 for additional (manual) changes. ii. This will also migrate your access intents from Entity 1.x to Entity 2.x format iii. This will also migrate any 1.1 (proprietary) relationships into 2.0 (standard) relationships using local interfaces. This also migrates any relationship accessor access intents. Client code (including existing session beans) will have to change to match the new method signatures. b. Manually adjust your access intents i. Entity 2.x access intents are more powerful (Optimistic/Pessimistic Read/Update, Pessimistic Update Exclusive, and so on). If you an optimistic type (wsOptimisticUpdate or wsOptimisticRead), then you can also select the Read Ahead Hint check box. This adds the ability to Preload (ReadAhead) related enterprise beans across relationships in a single query. ii. For each bean within your EJB 2.0 project, adjust your migrated access intents. For each EJB project, right-click Open with -> EJB Deployment Descriptor Editor and open the Access tab. Then click Access Intent for Entities 2.x -> Add, or Edit, or Remove (as appropriate). 6. Convert a Persistence Builder client application into an EJB client application: Important note: Persistence Builder provides the ability to create stand-alone applications (as well as distributed applications). There is no facility for stand-alone EJB applications. The distributed alternatives are: Install a WebSphere Application Server and run everything on one machine. Install the WebSphere Application Server "light server" to provide the client-side environment to access remote servers. Do not use EJBs at all (use JDBC, or the new database access beans for rowset JDBC access, or other approaches). Additional note: Persistence Builder provided Visual Composition Editor (VCE) palette items for visually building client applications. There are no corresponding components within Application Developer. Alternatives are: Convert the client-side Java program by removing the use of the Persistence Builder visual components.
123
Convert the client-side Java program into a Web browser-based program accessing server-side Servlets. a. Use session beans to abstract layer(s) of business logic above entity beans: Refer to "Rules and Patterns for Session Facades" found at http://www.ibm.com/websphere/developer/library/techarticles/01 06_brown/sessionfacades.html. If your Persistence Builder applications used the recommended Persistence Builder "TaskWrapper pattern" (see http://www7b.software.ibm.com/vadd-bin/httpdl?1/vadc/techartic le/0010_lanuti.pdf), then your application Servlets and JSPs do not directly use the business objects nor associated transactions. Instead all persistence and transaction exceptions are encapsulated and the data flowing into and out of the TaskWrapper is typically only serializable objects. Such a TaskWrapper application should convert fairly easily into EJBs plus session beans. The session beans now control transaction demarcation. They use EJB Container Managed Persistence (CMPs) with container managed transactions ('TRANSACTION_REQUIRED'). No rollbacks are available to the client calling the session bean, so they must have recover logic. Manually convert any Persistence Builder ConflictResolution code into EJB TransactionRolledBack exception handling. Where Persistence Builder provided nested transactions, clients now would use multiple session beans with REQUIRES_NEW and with recovert/compensation logic in case of errors. Important reference: "WebSphere Application Server, Development Best Practices for Performance and Scalability", found at http://www.ibm.com/software/webservers/appserv/ws_bestpractice s.pdf.
b. Manually convert Persistence Builder business logic from persistence builder model to use new session beans: Persistence Builder clients used to use MyobjectImpl implementation classes. New (converted) EJB clients (or more typically their new application session beans) will now use the EJB MyObject classes (remote interface, and hence indirectly the MyobjectBean object). If the developer had any business methods in the previous implementation classes, then they need to be copied into the new EJB bean (and promoted to the remote interface), including any required exception handling.
124
c. Manually convert from Persistence Builder Lite Collections to EJB 2.0 Dependent Values. Alternatively, single-value finders can return a single field - which may be suitable in some cases. Alternatively, a session bean can directly use JDBC - which may be suitable in some cases.
3.12 Build setup (library JARs, dependent project JARs, Ant builds)
This section covers the following migration topics: Java library JARs and third-party external JARs Optimizing multi-project builds using dependent project JARs Automated production builds using Ant
125
2. Click Browse and locate the JAR file directory. 3. Import it into your WebProject/webApplication/WEB-INF/lib folder, where WebProject is the name of your Web project. 4. Click Finish. The JAR file will be automatically added to the Java build path, and no further changes are required at runtime.
Recommended way to use a third-party JAR for use with multiple EJB or Web projects
The recommended way to use a third-party JAR file with two or more EJB or Web projects is to import it (keeping it as a JAR file) into your Enterprise Application (EAR) project. This is the only J2EE-defined, portable way to use a JAR file, and will ensure that you do not have to make any changes when deploying to another server. To use an external JAR file with multiple EJB or Web EJB projects, follow the steps below. If you only need to use the JAR file in a single Web project, follow the steps in the previous section. 1. Select File -> Import -> File System (not Zip file) in order to ensure that the JAR file is not expanded when it is imported. Click Next. 2. Click Browse and locate the JAR file directory. 3. Import the JAR file into the Enterprise Application project that contains the EJB or Web projects. 4. Click Finish. The JAR file will automatically be added to the Java build path, and no further changes are required at runtime. 5. Follow the steps in the next section to add the JAR to the module dependencies of the Web or EJB project.
126
Application Server does not need any specific setting for module visibility (deprecated).
Alternative way to use external JAR files (global build and server classpath)
You may also leave the JAR file outside of WebSphere Studio Application Developer and add it to both the Java build path and the server instance's class path. This is not recommended, because your application will not be easily portable. When you move to a different server, you will always have to update the server's class path. As well, you need to ensure that your class files do not conflict with other versions of similar class files already on the server classpath (and needed by the server or its other applications). If you do decide to take this approach, do the following: 1. Add the external JAR file to the Java build class path of the project that requires the JAR file. a. Select the project, right-click it, and select Properties from its pop-up menu. b. Click Java Build Path. c. Click the Libraries tab. d. Click Add External JARs. Select the JAR file, and click Open. e. Click OK. 2. Add the external JAR file to the server instance's class path: a. Open the Server Configuration view, and expand the Server folder. b. Select the server instance that the project is deployed on. Right-click it and click Open. c. Click the Paths tab. d. Within ws.ext.dirs, click Add External JARs. Select the JAR file, and click Open. Note that ws.ext.dirs is used for application JAR files, and the CLASSPATH is used for server JAR files. e. Close the server instance and save your changes.
127
performance, see the WebSphere Developer Domain article Optimizing complex builds in WebSphere Studio Application Developer found at http://www.ibm.com/websphere/developer/library/techarticles/0204_searle /searle.html.
128
WebSphere Version 4 Application Development Handbook: http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246134.pdf Programming J2EE APIs with WebSphere Advanced: http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246124.pdf EJB Development with VisualAge for Java for WebSphere Application Server: http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246144.pdf
WebSphere Application Server Version 3.5 to 4.x - Migration Hints & Tips: http://www7b.software.ibm.com/wsdd/library/techarticles/0208_wright/ wright.html WebSphere Studio Application Developer Service Portal: http://www.ibm.com/software/ad/studioappdev/support/ WebSphere Studio Application Developer Frequently Asked Questions (FAQ): http://www.ibm.com/support/search.wss?rs=457&tc=SSBRLP&dc=D800 WebSphere Application Server Service Portal: http://www.ibm.com/software/software/webservers/appserv/support.html WebSphere Application Server Frequently Asked Questions (FAQ): http://www.ibm.com/support/search.wss?rs=180&tc=SSEQTP&dc=D800 Further reading that may be of interest: An article on using Ant with WebSphere Studio Application Developer (including J2EE project builds/exports): http://www.ibm.com/websphere/developer/library/techarticles/0203_sea rle/searle1.html An article on optimizing complex builds in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/0204_sea rle/searle.html An article on J2EE class loading (J2EE modules and class paths) in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/0112_deb oer/deboer.html An article on developing J2EE utility JARs (Java JARs in J2EE modules) in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/0112_deb oer/deboer2.html
129
An article on team support in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/ 0108_karasiuk/ 0108_karasiuk.html An article on migrating Enterprise Access Builder components from VisualAge for Java to WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/techjournal/0201_minocha/mino cha.html An article on EJB application design using the Session Facade to talk to CMPs http://www.ibm.com/websphere/developer/library/techarticles/ 0106_brown/sessionfacades.html An article on WebSphere Application Server Best Practices: http://www.ibm.com/software/webservers/appserv/ws_bestpractices.pdf An article on WebSphere Best Practices zone: http://www.ibm.com/websphere/developer/zones/bp/ WebSphere Developer Domain main Web page: http://www.ibm.com/websphere/developer WebSphere Developer Domain technical articles: http://www.ibm.com/websphere/developer/techjournal/ Information about the WebSphere Studio family, and the features and directions of WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/zones/studio/transition.html IBM WebSphere Studio family of development tools: http://www.ibm.com/websphere/developer/library/techarticles/0108_stu dio/studio_beta.html External Application Developer newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.application-sit e-developer External workBench (Eclipse) newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.workbench External WebSphere Application Server newsgroup: news://news.software.ibm.com/ibm.software.websphere.application-server An article on deploying a J2EE application from WebSphere Studio Application Developer to WebSphere Application Server: http://www.software.ibm.com/vad.nsf/Data/Document3584 Application Developer software configuration management (source code management) vendors: http://www.ibm.com/software/ad/studioappdev/partners/scm.html
130
Migrating applications to Application Developer from competitors development tools: http://www.ibm.com/websphere/developer/zones/studio/migration.html Migrating VisualCaf WebLogic applications to Application Developer (still deploying to WebLogic): http://www.ibm.com/websphere/developer/library/techarticles/0209_sea rle/searle1.html Eclipse.org: http://www.eclipse.org WebSphere Developer Domain Plugin Central: http://www.ibm.com/websphere/developer/downloads/plugin/ Eclipse workbench plug-ins (not part of Eclipse.org): http://www.eclipse-workbench.com/jsp/plugins.jsp Eclipse plug-ins (not part of Eclipse.org): http://www.eclipse-plugins.2y.net/eclipse/plugins.jsp
131
132
Chapter 4.
133
Migrate from VisualAge for Java Visual Composition Editor to Visual Editor for Java Convert from VisualAge for Java Persistence Builder to EJB 2.0 Build setup (library JARs, dependent project JARs, Ant builds) Downloads and information for new WebSphere Studio development products (WebSphere Studio Application Developer and WebSphere Studio Site Developer) may be found at: http://www.ibm.com/Websphere/developer/zones/studio/transition.html The IBM WebSphere Studio Application Developer V5.0 supports both the WebSphere Application Server V4.0 and V5.0 test environments. The new Application Developer V5.0 product is more stable and provides more functions than its predecessor Application Developer V4.0 product. In light of these advantages, the Application Developer V5.0 product is recommended for use in development of applications for both V4.0 and V5.0 WebSphere Application Servers. Information about using IBM WebSphere Studio Application Developer can be found in the Getting Started guide and the online help. Read the installation guide prior to installing WebSphere Studio Application Developer. After you have successfully installed WebSphere Studio Application Developer, read the Getting Started guide and complete the Getting Started tutorials. The tutorials will introduce you to the workbench, Java development, and Web services. After you have completed the tutorials, read this guide to migrate your resources into WebSphere Studio Application Developer. In this version of WebSphere Studio Application Developer Version 5, you can migrate code from VisualAge for Java, or WebSphere Studio Classic or WebSphere Studio Application Developer Version 4.0.x. or WebSphere Studio Application Developer Version 5 Beta.
134
Installation steps
1. Start the EA GM driver. 2. Select Help -> Software Updates -> Update Manager. 3. Right-click in the Feature Updates view and choose New -> Site Bookmark. 4. Give the site a name such as EA_Fixes (it's not important which name you choose). 5. In the URL field, put http://www3.software.ibm.com/ibmdl/pub/software/websphere/studiotool s/wsadea/ and then select Finish. 6. Expand the newly created site bookmark and expand all the interactors until you get to WebSphere Studio Application Developer V5.0 EA APAR JR17565 1.0.0. 7. Select it and you should see details about the fix in the Preview view. 8. Click the Install button in the Preview view. The rest should be straightforward.
135
136
9. Meet-in-the-middle mapping support added for self-referencing tables. 10.Implements a fix for data source fields in 1.1 CMPs and JARs in a 2.0 EJB project. These were removed since they were invalid. The migration action will also migrate from a 1.1 CMP data source to a CMPConnection Factory binding at both the EJB 2.0 JAR level and the bean level if necessary.
Installation steps
1. Start the EA GM driver. 2. Select Help -> Software Updates -> Update Manager. 3. Right-click in the Feature Updates view and choose New -> Site Bookmark. 4. Give the site a name such as EA_Fixes (it's not important which name you choose). 5. In the URL field, put http://www3.software.ibm.com/ibmdl/pub/software/websphere/studiotool s/wsadea/ and then select Finish. 6. Expand the newly created site bookmark and expand all the interactors until you get to WSAD V5.0 EA APAR JR17576 1.0.0. 7. Select it and you should see details about the fix in the Preview view. 8. Click the Install button in the Preview view. The rest should be straightforward.
137
138
2. If you migrate an EJB 1.1 project to an EJB 2.0 project, you must regenerate RMIC and Deploy code even if the EJBs are left as 1.1 EJBs (since the entire EJB 2.0 project now runs as a J2EE-1.3 module inside a J2EE-1.3 container on the Application Server). If you do not regenerate the RMIC and Deploy code, you will get runtime errors. 3. If a J2EE-1.3 EJB project contains Container Managed Persistence (CMP) beans, then that project must be configured to use only Application Server Version-5 data sources, even if some or all of the CMPs are only EJB-1.1 beans. In a J2EE 1.2 application (EAR), all JDBC applications, Servlets 2.2, or EJB (must be 1.x) beans must use an Application Server Version 4 data source. In a J2EE 1.3 application all EJB 1.1 modules (which can only contain EJB 1.x beans) must use Application Server Version 4 data sources. In a J2EE 1.3 application all JDBC applications, or Servlet 2.3, or EJB 2.0 Modules (which may have CMP Version 2.0 and/or 1.x) must use Application Server Version 5 data sources. If you incorrectly configure an Application Server Version 4 data source, then at runtime there is no Resource Reference for this data source (required by the J2EE-1.3 container) and you will get the runtime error:
68c343ee ConnectionFac W J2CA0122I: Resource reference jdbc/YourBank could not be located, so default values of the following are used: [Resource-ref settings] res-auth:1 (APPLICATION), res-isolation-level:0 (TRANSACTION_NONE), res-sharing-scope:false (UNSHAREABLE), res-resolution-control:999 (undefined).
4. If you run a J2EE-1.3 Enterprise Application (EAR) that contains an EJB 2.0 JAR containing an EJB 1.1 CMP, then you must specify the CMP Factory JNDI name for such CMPs. Select the EJB project and open the ejbModule\META-INF\ejb-jar.xml file with the Deployment Descriptor editor. In the Beans tab, select your 1.1 CMP bean, and in the WebSphere Bindings section in the CMP Factory JNDI Name field, enter the data source JNDI name. You could also use the Default JNDI-CMP Connection Factory binding on the Overview page to set a default Connection Factory used by all beans in the project (Note that this only applies to 1.x beans, not 2.x beans as shown in the editor text).
139
If they are not specified, then the following runtime exception occurs when you try to access the CMP:
51496130 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
5. If you run a J2EE-1.3 Enterprise Application (EAR) that contains a EJB 2.0 JAR containing a mix of both EJB 1.1 CMP and EJB 2.0 CMP, then you will need to download an eFix for Application Developer to support this. Refer to the eFix Web site at http://www14.software.ibm.com/webapp/download/product.jsp?type=s&id= SPA-524G3S 6. If you configure an Application Server Version 5 data source (for CMP EJBs), the default (the first item in the pull-down field) Datasource Helper is com.ibm.websphere.rsadapter.DB2390DataStoreHelper. As the 390 implies, this helper class is only valid for System/390. You must select com.ibm.websphere.rsadapter.DB2DataStoreHelper from the pull-down choices for the data source to work in Windows. If you incorrectly accept the System/390 default and try to start a Windows Application Server, you will get an exception:
com.ibm.websphere.cpi.CPIException: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "KEEP UPDATE LOCKS" was found following "? FOR UPDATE WITH RS". Expected tokens may include "(space)". SQLSTATE=42601"
140
For information on differences between WebSphere Application Server Version 4 and Version 5 functions, please refer to the WebSphere Application Server Version 5 online InfoCenter documentation. Most applications developed and tested on WebSphere Application Server Version 4 will run unchanged on Version 5. However, if the application uses newer specification level features/functions (J2EE 1.3, Servlet 2.3, JavaServer Pages (JSP) 1.2, Enterprise JavaBeans (EJB) 2.0, Web J2EE 1.3, and so on) then that application will only work on WebSphere Application Server Version 5. Note that some wizards in WebSphere Studio Application Developer create J2EE projects or resources, and they default to J2EE 1.3. To change the default to J2EE 1.2, select Window -> Preferences -> J2EE Preference -> Select the highest J2EE version to be used -> 1.2.
141
Application.xml deployment descriptor editor, select the modules, and then select Add -> myModules.
4.3.1 Differences between WebSphere Studio Application Developer Version 4.0.x and Version 5
The following is a partial list of enhancements since Version 4.0.x: WebSphere Studio Application Developer Version 5 can generate code for either WebSphere Application Server Version 4.0.x or Version 5, and includes both WebSphere Application Server Version 4.0.3 and Version 5 Test Environments. The enterprise applications archives (EARs) J2EE level has changed from 1.2 to 1.3 for WebSphere Application Server Version 5 projects. J2EE 1.2 EARs will run on either WebSphere Application Server Version 4.0.x or WebSphere Application Server Version 5. The Enterprise Java Beans (EJB) specification level has changed from 1.1 to 2.0 for WebSphere Application Server Version 5 EARs. EJB 1.1 projects are still supported, and may be part of either WebSphere Application Server Version 4.0.x J2EE 1.2 EARs or Version 5 J2EE 1.3 EARs. The Web applications (WARs) J2EE level has changed from 1.2 to 1.3 for WebSphere Application Server Version 5 projects. The JSP level has changed from 1.1 to 1.2 and the Servlet level has changed from 2.2 to 2.3. J2EE 1.2 Web projects (WARs) are still supported, and may be part of either WebSphere Application Server Version 4.0.x J2EE 1.2 EARs or Version 5 J2EE 1.3 EARs. In Version 5, you can create static Web projects as well as J2EE Web projects. In a static Web project you will only be able to create content served by a traditional HTTP server (HTML, JavaScript, images, text, and so on). The underlying workbench, which is based on the Eclipse open-source project, has changed from Version 1.0 to Version 2.0. There is a new and much improved Java builder There is a new and much improved VCM interface for SCM vendors Page Designer Classic and Page Designer are both available. For more information, see 4.3.3, Internal changes from Version 4.0.3 on page 143.
142
Version 5 Web WARs are source location incompatible with Version 4.0.3
Because of the WebSphere Studio Application Developer internal changes described in the two Web sections below, a Version 5 J2EE 1.2 Web WAR, when exported with Java source, will import into WebSphere Studio Application Developer Version 4 but will not build (even though it is at the same J2EE 1.2
143
runtime level). The source folders will be in the Version 5 structure, and must be manually moved to the old Version 4 structure location before building. The WAR still executes correctly on WebSphere Application Server Version 4 (since it ignores any embedded source); it is only a development tool difference.
144
145
146
The previous distinction affects encoding of non-English JSP files. In versions prior to this version, HTML encoding rules were used, even for JSP files, to determine the encoding named in a file. That is, the content type attribute of the META tag was used to determine the encoding named in <META http-equiv="Content-Type" content="text/html; charset=UTF-8">. In this version, this was changed to use JSP encoding rules to determine the encoding named in a JSP file. That is, the page directive of the JSP file is used to determine the encoding named in <%@page contentType="text/html;charset=UTF-8"%>. For HTML files, encoding is unchanged from previous versions.
Note: Do not use -data to point to an existing Version 4 workspace since that is a different unsupported approach to migrate. (For more information, refer to 4.3.6, Migrating projects using an existing Version 4.0.x workspace on page 150.)
147
5. Click Windows -> Preferences -> Workbench and uncheck Perform build automatically to avoid build errors as individual dependent projects are loaded. 6. For CVS: Load all of the projects that you want to work with from the SCM repository into WebSphere Studio Application Developer Version 5. 7. For ClearCase: Use a clean Version 5 workspace, then for each project to be loaded, select File -> Import -> Existing WebSphere Studio 4.x ClearCase Project into Workspace. 8. Click Windows -> Preferences -> Workbench and check Perform build automatically to restore your settings. 9. Do a full rebuild (click Project -> Rebuild All), and save the resulting projects back into your repository in your new Version 5 stream. (Do not mix these resources with your ongoing Version 4 stream.) Note: These projects are now Version 5 projects and cannot be used by WebSphere Studio Application Developer Version 4.0.x Post migration considerations: Version 4 CVS files were stored as binary (no CarriageReturn/LineFeed translations). If you work in a mixed (DOS/Windows plus UNIX/Linux) platform environment, you might wish to now mark source files as text (by clicking Team -> CVS -> Change ASCII/Binary Property) and resave them in CVS. Version 4 Web projects from a CVS repository require that you prune empty directories. Click Window -> Preferences -> Team -> CVS -> Prune empty directories setting (the default is that it is enabled). If it is not disabled, and you load a Web project with an empty source folder (such as the MyHomePage Web example), then you will get the following errors at check-in:
The project was not built since it is involved in a cycle or has classpath problems. Missing required source folder: /MyHomePageExample403/source.
For Web projects saved and loaded from a ClearCase repository, you need to have a file checked out before you can open it in the editor. If it is not checked out, you receive an error activating this view. (Null pointer exceptions in logs for Page Designer notify the user of known problems and ways to avoid them.) With web.xml editor, editing a web.xml file you need to have web.xml, ibm-web-bnd.xml, and ibm.web-ext.xmi checked out. (There are indications that you need these files to be checked out on the status line, which states that they are read only, but it is easily missed.)
148
If your projects have circular dependencies, Version 5 reports a build error. Click Window -> Preferences -> Java -> Compiler, select the Other tab, and clear the Stop building when an invalid class path is detected check box. The .vcm_meta (or .cc_meta) files could now be deleted from the Version 5 project because they are not used by Version 5 (it uses a new .project file instead) and because you are using a new repository branch (stream) for these Version 5 projects. Note that these files are still needed in the ongoing Version 4 branch (stream).
149
150
and then select Refresh from the pop-up menu. This will ensure that all files are synchronized with their appropriate metadata. 8. Open any closed projects (see Known problems and limitations on page 151). 9. Verify your class path variables (see Known problems and limitations on page 151). 10.Some builders and validators have been added, removed, or modified in Version 5. To ensure that the correct errors and warnings are shown, you must rebuild all the projects by selecting Project -> Rebuild All, and then select Run Validation for each Java project. 11.Some user preferences might be maintained, but many others will not be. Check your preference settings in Version 5 to be sure that they are as you want them.
151
For previously SCM shared projects, the Team menu contains Share Project
Team support has changed significantly between Eclipse 1.0 and 2.0. The method of sharing projects with the repository has changed as well. If you select Team -> Share Project, a wizard will guide you through the migration process. When you are finished, your project will be shared and the Synchronize view will open. You will see conflicting changes on every file. This is because of changes in the way sync information is stored between Eclipse 1.0 and 2.0. If you do not have any outgoing changes (which you should not have if you committed all your outgoing changes before upgrading as recommended above), then you can simply select the project in the Synchronize view and select Override and Update which will load the current contents from the server. If you do have outgoing changes, you can pull down the triangle menu in the Synchronize view and select Compare File Contents. After some work, the Synchronize view will show you only the files that are actually different. You can then use the Synchronize view to resolve these conflicts.
152
153
4.5 Migrating from WebSphere Studio Classic to WebSphere Studio Application Developer
This section documents how to migrate from WebSphere Studio Version 4.0 (both Advanced and Professional Edition) to the WebSphere Studio Application Developer. Migrating from WebSphere Studio Classic Version 4.0 to WebSphere Studio Application Developer Version 5.0 involves the following steps: 1. Create a new single-server stage for migration. 2. Create a Web configuration descriptor file. 3. Export a migration JAR file. 4. Import the migration JAR file into WebSphere Studio Application Developer. 5. Set up your server and test your migrated application. Note: The following instructions are for migrating from WebSphere Studio Version 4.0. If you want to migrate from an earlier version of WebSphere Studio, you should migrate to WebSphere Studio 4.0 first, then migrate to WebSphere Studio Application Developer. The advanced publishing feature (mapping files to publishing stages) and the Page Detailer feature (analysis of Web pages) of WebSphere Studio Classic is not available in WebSphere Studio Application Developer. Some other features from the Version 4.0.x CD media pack are also no longer available, for example the Page Detailer feature for analysis of Web pages, the HotMedia feature for rich media types, the Voice XML editor (moved to WebSphere Everyplace Toolkit and Portal Toolkit), and the DataBaseWizard for pervasive devices. You should be aware of the following limitations before you migrate any of your WebSphere Studio data: WebSphere Studio Application Developer uses an XML-based SQL editor, so your .sql files cannot be used in it. Project publishing information and stage information cannot be migrated. WebSphere Studio server configuration information cannot be migrated. Version control information cannot be migrated. During the migration process outlined below, WebSphere Studio creates a JAR file that contains all of your project files, publishable and source, for a single server. All the files visible in the Publishing view for the default server will be
154
packaged into the JAR file. You can then import the JAR file into WebSphere Studio Application Developer. When you migrate existing projects, all the project publishing information and the stage information are lost during the migration. If your stage has multiple servers, only files published to the default server are kept. Therefore, for the purpose of migration, you will create a new stage that has only one server.
155
4.5.4 Importing the migration JAR file into WebSphere Studio Application Developer
1. Start WebSphere Studio Application Developer. 2. Create a Web project (File -> New -> Project -> Web Project). 3. In the Project name field, type the name of your Web project. This should be the same name you specified in step 1 in 4.5.3, Exporting a migration JAR file on page 156. 4. Specify the name of a new or existing EAR project that will contain the new Web project for purposes of deployment. 5. In the Context Root field, type the Webapp Web Path name you specified when you created the migration JAR file in WebSphere Studio. Click Finish. 6. In the Navigator view, select the Web project you just created. 7. Import the JAR file. a. Click File -> Import. b. Select the WAR file and click Next. You must import the JAR file using the WAR file option; otherwise it will not work properly. c. Enter the path to localhost.jar in the WAR File field or click Browse to search for it. (You can only browse for a WAR name, not a JAR name.) d. Select the Web project that you created. The Context Root field is automatically populated with the value you specified earlier. e. Select the EAR project you created earlier.
156
f. Click Finish. WebSphere Studio Application Developer unpacks localhost.jar. 8. You may have several unresolved references or missing import files. These will appear in the Tasks view. To fix this, you must change the Java build path for the Web project: a. Right-click the project and click Properties -> Java Build Path. b. Click the Libraries tab. Click Add External JARs. c. Import any JARs that you need from the following directories: i. plugins/com.ibm.etools.websphere.runtime/lib ii. plugins/com.ibm.etools.websphere.tools/runtime 9. In the Navigator view, right-click the project and select Rebuild Project.
4.6 Migrating from VisualAge for Java to WebSphere Studio Application Developer
This section documents how to migrate from VisualAge for Java Professional Edition or VisualAge for Java Enterprise Edition to WebSphere Studio Application Developer. Migrating from VisualAge for Java to WebSphere Studio Application Developer involves the following steps, which are explained in more detail later in this section: 1. Export your Java files and project resource files from VisualAge for Java. 2. Start WebSphere Studio Application Developer and create new projects to contain your code. 3. Import your Java and project resource files into WebSphere Studio Application Developer. 4. Use the web.xml editor to ensure that any Servlets are correctly defined (Web project only).
157
5. Migrate your VisualAge for Java project and workspace build and execution settings. 6. Set up your server and test your migrated application(s). 7. Deploy your applications from WebSphere Studio Application Developer to WebSphere Application Server. 8. Share the WebSphere Studio Application Developer project settings between multiple developers (post-migration). The instructions given in this section are for migrating from VisualAge for Java Version 3.5.3 or 4.0 for Windows. If you want to migrate from an earlier version of VisualAge for Java to WebSphere Studio Application Developer, you should first migrate from your earlier version of VisualAge for Java to Version 4.0 for Windows (if you have enterprise beans) or Version 3.5.3 or 4.0 for Windows (without enterprise beans), before migrating to WebSphere Studio Application Developer. Version 4.0 includes a special tool (the EJB Export Tool) for exporting enterprise beans, which you need in order to migrate EJB applications to WebSphere Studio Application Developer. All other data can be migrated from either Version 3.5.3 or Version 4.0. Note: Instantiations, Inc., an IBM Business Partner, distributes a product called CodePro Studio that provides productivity enhancements to VisualAge for Java and WebSphere Studio Application Developer, including migration and co-existence facilities. To help VisualAge for Java customers begin their migration, Instantiations is offering a free, unlimited use VisualAge for Java to WebSphere Studio Application Developer export facility as part of their time-limited evaluation copy of CodePro Studio. You can download the evaluation copy from http://www.instantiations.com/vaj-migrate. For further information on Instantiation's advanced migration and co-existence support including full bi-directional export/import of files, creation of export/import sets, project synchronization and task automation, refer to the Instantiations, Inc. Web site at http://www.instantiations.com/codepro/ws.
4.6.1 Differences between VisualAge for Java and WebSphere Studio Application Developer
The following is a partial list of changes from VisualAge for Java: The Enterprise Java Beans (EJB) specification level has changed from 1.0 to 1.1 (EJB 2.0 is also supported for applications that will be deployed to WebSphere Application Server Version 5). For Web applications, the JSP level remains at 1.1 (1.2 for WebSphere Application Server Version 5 applications).
158
For Web applications, the Servlet level remains at 2.2 (2.3 for WebSphere Application Server Version 5 applications). The level of the Java 2 platform that is supported has changed from 1.2 to 1.3. (The compiler can target 1.4 code generation, but the WebSphere Application Server runtime environment is still 1.3.) The Visual Composition Editor has been replaced by the Visual Editor for Java. VisualAge for Java version control and the propriety source code repository have been replaced by support for software configuration management (SCM) plug-ins. The VisualAge for Java Tools API has been replaced by the WebSphere Studio Workbench plug-in architecture. The VisualAge for Java XML tools have been replaced by WebSphere Studio Application Developer XML tools. The VisualAge for Java project concept has been replaced by multiple types of WebSphere Studio Application Developer projects. Convertors in VisualAge for Java EJB AccessBeans (not Data AccessBeans) are not available in WebSphere Studio Application Developer EJB AccessBeans. Use EJB convertors/composers in the underlying EJBs instead. For more information about EJB convertors/composers, refer to the online help documentation.
159
4. Import your Java and project resource files into WebSphere Studio Application Developer. 5. Use the web.xml editor to ensure that any Servlets are correctly defined (Web project only). 6. Migrate your project and workspace settings. 7. Set up your server and test your migrated application(s). 8. Deploy your applications from WebSphere Studio Application Developer to WebSphere Application Server. 9. Share the WebSphere Studio Application Developer project settings between multiple developers (post-migration).
Exporting your Java files and project resource files from VisualAge for Java
There is no support for the bulk migration of versioned projects and resources from the VisualAge for Java repository. You can only migrate projects and resources that are in your VisualAge for Java workspace. If you want to migrate a versioned copy of a project or resource into WebSphere Studio Application Developer, you must bring it into your VisualAge for Java workspace and then migrate it. Note: If your project contains more than one kind of data (for example, enterprise beans and Java source code files), you should split up your data into different JARs based on their type. Export your projects to a JAR file by following these steps: 1. If the projects that you want to export are not currently in your VisualAge for Java workspace, add them to the workspace now. 2. In the VisualAge for Java Workbench window, select your project(s), right-click, and click Export. 3. Select the Jar file radio button and click Next. 4. Specify the name of the JAR file. 5. Select the .java check box to export your Java files and the resources check box to export your resource files. 6. Fill in the other fields as required. Refer to the VisualAge for Java online help for more information on how to perform this task.
160
Starting WebSphere Studio Application Developer and creating new projects to contain your code
Start WebSphere Studio Application Developer, then create the appropriate projects. The following is a set of general migration guidelines to help you decide which kind of WebSphere Studio Application Developer project you should import your files into: If your code is part of a Web application, you should import the code into a Web project: Import all Java files into the Web project source directory (the proper hierarchy based on their package statements will automatically be created by WebSphere Studio Application Developer) Import all resource files into the Web project webApplication directory. If your code is straight Java (for example, an application that will run stand-alone), you should import the code into a Java project. If your code is enterprise beans, you should import the code into an EJB project. Note: The preceding is only a general set of guidelines to help you decide which kind of WebSphere Studio Application Developer projects you should use. We recommend that you read the WebSphere Studio Application Developer online help and become familiar with the different kinds of WebSphere Studio Application Developer projects before you create any projects or import any code.
Importing your Java and resource files into WebSphere Studio Application Developer
1. Open WebSphere Studio Application Developer and switch to the Resource perspective. 2. Click File -> Import -> the zip file. Click Next. 3. Browse to the appropriate JAR file. 4. Select the files you want to import and the project or folder you want to contain your files.
161
Note: When you import your files into WebSphere Studio Application Developer, you should ensure that they go in the appropriate directory. We recommend that you read the WebSphere Studio Application Developer online help and become familiar with the different kinds of WebSphere Studio Application Developer projects before importing your code. This will help you determine which folders should contain which kind of code.
Using the web.xml editor to ensure that Servlets are correctly defined (Web project only)
If your application uses Servlets, then you need to define the Servlet-URL mappings in the web.xml file. Follow these steps: 1. In the Web perspective, open the web.xml file, which is located in the webApplication/WEB-INF subdirectory of your Web project. 2. Click the Servlets tab. 3. Click Add, and select the Servlet radio button. 4. Type the Servlet name and click OK. 5. Click Browse to change the Servlet class value to the appropriate package name. 6. (Optional) The display name is a short name used to identify the Servlet. In the Display name field, type a short name for the Servlet. 7. A URL mapping defines a Servlet and a URL pattern. Click the Add button located next to the URL mappings field, then type the name of the URL mapping. 8. Save the changes (File -> Save web.xml) and close the web.xml file.
162
migrated your projects into WebSphere Studio Application Developer, you can set up your project's class path in the project's Properties window. Right-click the project and select Properties -> Java Build Path. Click the Libraries tab. You can also set class path variables in the Preferences window (click Window -> Preferences -> Java -> Classpath Variables.)
Resource associations
If you set up an association between a file type and an executable, you can open a file that sits outside the workbench from within it. In VisualAge for Java, you set up your resource associations in the Options window (click Window -> Options -> Resources -> Resource Associations). After you have migrated your resource files to WebSphere Studio Application Developer, you can set up your resource associations using the Preferences window (click Window -> Preferences -> Workbench -> File Editors).
Code formatter
In VisualAge for Java, you set up your code formatting options in the Formatter page of the Options window (click Window -> Options -> Coding -> Formatter). After you have migrated your code to WebSphere Studio Application Developer, you can set up your code formatting in the Preferences window (click Window -> Preferences -> Java -> Code Formatter).
163
right-click the server you want to work with and click Open. Click the Web tab and select the Enable URL rewrite check box.
Setting up your WebSphere V4 test environment and testing your migrated application(s)
If the application is a Java project, then you just use the normal WebSphere Studio Application Developer Run or Debug support for Java projects to test it. If the application uses WebSphere Application Server (Web projects and EJB projects do), then test it using the built-in WebSphere Application Server. This requires that a default test server be created and started. For an EJB project, right-click the EJB project and select Run on Server to run the EJB Test Client. For a Web project, right-click the main HTML page and select Run on Server to launch the Web browser. For information on testing other types of projects, refer to the online help.
Deploying your applications from WebSphere Studio Application Developer to remote WebSphere Application Server
If you are using the WebSphere Application Server as your runtime environment, deploy your application using the Server Tools feature of WebSphere Studio Application Developer.
164
Sharing WebSphere Studio Application Developer project settings between multiple developers (post-migration)
WebSphere Studio Application Developer projects (and their associated settings) can be shared between developers. To do this, save a project into the WebSphere Studio Application Developer software configuration management (SCM) server, then extract it onto another team member on the WebSphere Studio Application Developer.
4.7 Migrating enterprise beans from VisualAge for Java to WebSphere Studio Application Developer
This section provides instructions on how to migrate your VisualAge for Java enterprise beans to WebSphere Studio Application Developer. Migrating VisualAge for Java enterprise beans to WebSphere Studio Application Developer involves the following steps: 1. Export VisualAge for Java enterprise beans as a 1.1 JAR using the VisualAge for Java EJB Export tool. 2. Import the EJB 1.1 JAR WebSphere Studio Application Developer. 3. Generate deploy code and data source binding information. 4. Create a server configuration and instance. 5. Add data source information to your configuration. 6. Test the enterprise beans with the new EJB test client. This section also contains information about: Items migrated Code changes due to EJB 1.0 specification versus EJB 1.1 specification VisualAge for Java Version 3.5.3 EJB 1.0 JARs versus VisualAge for Java Version 4.0 EJB 1.1 JARs Moving multiple VisualAge for Java EJB groups into WebSphere Studio Application Developer EJB projects
4.7.1 VisualAge for Java EJB Export Tool (migrating map/schema from EJB 1.0 to EJB 1.1)
VisualAge for Java Version 4.0 includes a special tool (the EJB Export Tool) for migrating enterprise beans. Therefore, all enterprise beans must be migrated
165
from that version to WebSphere Studio Application Developer. Note that the tool migrates VisualAge for Java EJB 1.0 map/schema metadata into EJB 1.1 map/schema XML files, but does not change the code in any way (it is still EJB 1.0 code). Note: It is recommended that all of your database tables contain a table qualifier prior to exporting using the VisualAge for Java Version 4.0 EJB Export Tool. Most databases require a table to have a qualifier, and the WebSphere Studio Application Developer workbench does not handle empty qualifiers when one is expected for the database vendor. There is an Export tool for EJB 1.1 fixpack (be sure to get the latest Version 4.1.5 or later), available from the VisualAge Developer's Domain (see http://www7.software.ibm.com/vad.nsf/Data/Document4624) which fixes certain defects with the tool. One defect the fixpack fixes is a problem the EJB tool has if a group has relationships with two or more ForeignKeys mapping to the same two or more tables. Refer to the fixpack's Readme file for more information about the defects the fixpack fixes.
Items migrated
The following items are migrated when you migrate your enterprise beans: Entity beans (CMP, BMP) Session beans (both stateful and stateless) Finder helpers (method and where custom finders) Inheritance (with multi-levels) Associations Mappings and schemas Deployment and control descriptions
4.7.2 VisualAge for Java Version 3.5.3 EJB 1.0 JARs versus VisualAge for Java Version 4.0 EJB 1.1 JARs
In VisualAge for Java Version 3.5.3 you can generate an undeployed EJB 1.0 JAR, or generate a deployed EJB 1.0 JAR (with deployment code, stubs, tie code, and so on). You can import the EJB 1.0 JAR into the WebSphere Application Server Version 4.0 Application Assembly Tool AAT) and use that to generate deployment and control descriptors and to run the EJB Deploy Tool to generate deploy code, stubs, and so on into an EJB 1.1 format JAR (enterprise applications archives). The net result of the previous steps is that you can have a deployed JAR that can be run in WebSphere Application Server Version 4.0, and hence can also be run in WebSphere Studio Application Developer (since its WebSphere Test Environment is a WebSphere Application Server Version 4.0
166
server). However, runtime execution does not imply ongoing development capability. You can include the previously generated Java code into the corresponding EJB JARs and import that into WebSphere Studio Application Developer, and WebSphere Studio Application Developer would parse and understand the EJB session support, security information, finder information, and assembly descriptor (const methods, and so on). However, extensions (class inheritance and ForeignKey associations) and the map and schema information are all lost. They can only be retained if you use the VisualAge for Java Version 4.0 EJB Export Tool, to create an EJB 1.1 JAR containing the map and schema XML information and extension XML information. As well, the names of generated stub classes are different in 1.0 from 1.1 enterprise beans. The net result is that neither an EJB 1.0 JAR nor an EJB Deploy Tool EJB 1.1 JAR retains the basic design metadata to allow them to be used for ongoing development in WebSphere Studio Application Developer. The VisualAge for Java Version 4.0 EJB Export Tool produces an EJB 1.1 JAR that contains all the EJB design metadata, including the map and schema information and the extensions (class inheritance and ForeignKey associations), so that you can immediately continue to develop within WebSphere Studio Application Developer and regenerate deployment code anytime it is required. This is the only supported method of migrating VisualAge for Java enterprise beans into WebSphere Studio Application Developer, and the use of the VisualAge for Java Version 4.0 EJB Export Tool is the only method that will work for ongoing EJB development within WebSphere Studio Application Developer.
4.7.3 Moving multiple VisualAge for Java EJB groups into WebSphere Studio Application Developer EJB projects
In VisualAge for Java, you may have multiple EJB groups, with each group being used for intragroup inheritance or associations. Typically, you would export each VisualAge for Java EJB group (using the VisualAge for Java 4.0 EJB Export tool) into a matching JAR, and then import that JAR into a matching WebSphere Studio Application Developer EJB project. WebSphere Studio Application Developer EJB projects correspond to EJB modules. Where intragroup inheritance or associations are not required, you may wish to keep the EJB groups as separate EJB projects - you can close individual projects and hence keep the overall memory requirements down. WebSphere Studio Application Developer has the concept of enterprise-level grouping, using WAR and EAR files, so several EJB groups can be logically combined that way, and then deployed as if they were a single unit.
167
If you import multiple EJB groups into the same EJB project, then any XML in them may not be correctly merged (the last imported group overwrites).
168
4. Create a WebSphere Studio Application Developer server configuration for your test server, if you do not already have one: a. Switch to the Server perspective. b. Click File -> New -> Server Project. c. In the Project name field, type ServerTest. Click Finish. d. In the Navigator view, select ServerTest. From its pop-up menu, click New -> Server Instance and Configuration. e. Type the name of the server, for example, MyServer, and select ServerTest from the Folder list. f. In the Server instance type field, expand WebSphere Version 4.0 and select Test Environment. In the Template field, click None. g. Click Next. Specify a server port number of 8080. h. Click Finish. A new server configuration and instance will be created. 5. Add data source information to your server configuration: a. In the Server Configuration view, expand Server Configurations and select your server. b. Right-click it and from your pop-up menu, click Open. c. Select the Data source tab. d. In the JDBC Driver List, select the appropriate database driver (for example, Db2JdbcDriver if you are using DB2) and click Edit. e. Verify that the Class path field contains the correct path to db2java.zip. Click OK. f. If you are not using DB2, add a new driver. Ensure that you use the J2EE JDBC driver that the Database vendor provides. g. Select your JDBC driver, and click the Add button that is to the right of the Data source field. h. In the Add a data source window, type a data source name. In the JNDI name field, type the same name you used in step e on page 168. Enter the name of your database and click OK. i. Save your changes. 6. Test the enterprise beans with the new EJB test client: a. In the Server Configuration view, expand Server Configurations and select your server. Right-click it, and click Add Project. Select the EAR project that contains your EJB module.
169
b. In the Servers view, select your server instance. Right-click it and from its pop-up menu, click Start. c. The project will be published and the server will start. After a few moments, click the Console tab to view the console window. You should see a message saying the Default Server is open for e-business. Scroll through the console to verify the EJB JAR has been started. d. In the J2EE Hierarchy view, expand the EJB Modules folder, select the enterprise bean that you want to test, right-click it, and click Run on server.
170
Finder helper description Mapping/schema description Transaction demarcation Isolation levels or find for update or readme methods marking EJB environment variables
171
172
Enterprise bean methods getCallerIdentity() and isCallerInRole(Identity) are deprecated. Use getCallerPrincipal() and isCallerinRole(String roleName) instead. getEnvironment is deprecated. Open ejb_jar.xml with EJB deployment descriptor, Beans tab, and view environment variables (such as TARGET_HOME_NAME)
String homeName=aLink.getEntityContext().getEnvironment().getProperty("TARGET_HOME _NAME"); if (homeName == null) homeName = "TARGET_HOME_NAME";
becomes:
Context env = (Context)(new InitialContext()).lookup("java:comp/env"); String homeName = (String)env.lookup("ejb10-properties/TARGET_HOME_NAME");
CMP enterprise beans ejbCreate(...) methods should return the bean's primary key class (instead of void). New HomeHandle interface, and EJBHome interface requires new getHomeHandle() method:
public javax.ejb.HomeHandle getHomeHandle() { return null; }
You should consider enhancements to match EJB 1.1 changes such as: Entity bean primary keys can now be java.lang.String objects. Entity bean finder methods should define FinderException in their throws clause. Entity bean finder methods return java.util.Collection. Check the format of your JNDI names (and local namespaces are now supported). There are now security roles, and isolation levels are now defined at the method level (they were defined at the EJB level for EJB 1.0). You should review the EJB 1.1 changes in general to see what other application changes are appropriate. For detailed information, refer to the following publications and Web sites:
Enterprise Java Beans Specification, Version 1.1, available at http://java.sun.com/products/ejb/docs.html (see Section 1.3, Application compatibility).
173
The IBM WebSphere InfoCenter, found at http://www.ibm.com/software/webservers/appserv/doc/v40/aes/infocente r/index.html. Refer to the following sections: Transitioning to Version 4.0 (Click Application Server AE ->Migration -> Transitioning to Version 4.0 and read the Role-based security section) Migrating to supported EJB specifications (Click Application Server AE -> Migration -> 3.3 Migrating APIs and specifications -> 3.3.1 Migrating to supported EJB specifications) Migrating from Version 3.x (Click Application Server AE ->Migration -> 3.2 Migrating from previous products versions -> 3.2.2 Migrating from Version 3.x)
WebSphere Version 4 Application Development Handbook, SG24-6134, available at http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246134.pdf (See the section Migrating 1.0 EJBs to 1.1 EJBs on pages 267-268). Programming J2EE APIs with WebSphere Advanced, SG24-6124, available at http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246124.pdf (See the section on EJB 1.1 code changes on pages 113-114). EJB Development with VisualAge for Java for WebSphere Application Server, SG24-6144, available at http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg246144.pdf (See Appendix B).
174
175
4.9 Migrating from VisualAge for Java Visual Composition Editor to Visual Editor for Java
This section provides instructions on how to migrate applications created in the Visual Composition Editor feature of VisualAge for Java to the Visual Editor for Java within WebSphere Studio Application Developer: Saving enhanced design-time metadata from VisualAge for Java Completing the migration (importing into WebSphere Studio)
176
4. For each of your graphical applications within VisualAge for Java, select one or more of the graphical programs (typically XxxxxView), right-click, and then do the following: a. Click VCE Code Generation/Export, and be sure the Export to a directory after code regeneration option is selected. b. Leave Directory as the selected export destination, and click Next. c. Select your target directory, unselecting the .class option and selecting the .java option (since you want the source code), and then click Finish. d. Optionally, reload your VisualAge for Java code with its previous version (right-click and then select Replace with -> Previous edition).
4.10 Converting from VisualAge for Java Persistence Builder to EJB 2.0
This section provides an overview of how to convert your VisualAge for Java Persistence Builder applications to EJB 2.0 in WebSphere Studio Application Developer Version 5.0. Note: Complete details are found in an article posted on WebSphere Developers Domain and with a link from the WebSphere Studio Application Developer Transitions Web page http://www.ibm.com/websphere/developer/zones/studio/transition.html. This article will not be available until the GA product ships. Do the following steps: 1. Migrate and export the Persistence Builder Model as an EJB 1.1 JAR: a. Use the VisualAge for Java 4.0 tool to migrate the Persistence Builder Model into an EJB 1.0 Group (click OnlineHelp -> Tasks -> Adding Persistence -> Migrating Persistence Builder Model to EJB)
177
b. Use VisualAge for Java EJB 1.1 Export Wizard to export an EJB 1.1 JAR 2. Import EJB 1.1 JAR into EJB 1.1 project, convert to EJB 2.0 project: a. Import an EJB 1.1 JAR into WebSphere Studio Application Developer EJB 1.1 project. b. Convert an EJB 1.1 project into an EJB 2.0 project by selecting your EJB project, then right-clicking File -> Migrate -> J2EE Version 1.2 to 1.3. 3. Convert EJB 1.1 code to EJB 2.0 and set application profile declarations: a. Manually convert from 1.x CMPs into 1.1 CMPs into 2.0 CMPs (refer to4.8.3, Migrating code from EJB 1.x to EJB 2.0 on page 175). b. Manually set declarative application profiles for Isolation/ReadAhead/Inheritance and so on. 4. Convert Persistence Builder client application into EJB client application: a. Use session beans to abstract layer(s) of business logic above Entity Beans b. Manually convert Persistence Builder business logic from persistence builder model to use new session beans
4.11 Build setup (library JARs, dependent project JARs, Ant builds)
This section covers the following migration topics: Java library JARs and third-party external JARs Optimizing multi-project builds using dependent project JARs Automated production builds using Ant
178
Recommended way to use a third-party JAR for use with multiple EJB or Web projects
The recommended way to use a third-party JAR file with two or more EJB or Web projects is to import it (keeping it as a JAR file) into your Enterprise Application (EAR) project. This is the only J2EE-defined, portable way to use a JAR file, and will ensure that you do not have to make any changes when deploying to another server. To use an external JAR file with multiple EJB or Web EJB projects, follow the steps below. If you only need to use the JAR file in a single Web project, follow the steps in the previous section. 1. Select File -> Import -> File System (not Zip file) in order to ensure that the JAR file is not expanded when it is imported. Click Next. 2. Click Browse and locate the JAR file directory. 3. Import the JAR file into the Enterprise Application project that contains the EJB or Web projects. 4. Click Finish. The JAR file will automatically be added to the Java build path, and no further changes are required at runtime. 5. Follow the steps in the next section to add the JAR to the module dependencies of the Web or EJB project.
179
Alternative way to use external JAR files (global build and server classpath)
You may also leave the JAR file outside of WebSphere Studio Application Developer and add it to both the Java build path and the server instance's class path. This is not recommended, because your application will not be easily portable. When you move to a different server, you will always have to update the server's class path. As well, you need to ensure that your class files do not conflict with other versions of similar class files already on the server classpath (and needed by the server or its other applications). If you do decide to take this approach, do the following: 1. Add the external JAR file to the Java build class path of the project that requires the JAR file. a. Select the project, right-click it, and select Properties from its pop-up menu. b. Click Java Build Path. c. Click the Libraries tab. d. Click Add External JARs. Select the JAR file, and click Open. e. Click OK. 2. Add the external JAR file to the server instance's class path: a. Open the Server Configuration view, and expand the Server folder. b. Select the server instance that the project is deployed on. Right-click it and click Open. c. Click the Paths tab.
180
d. Within ws.ext.dirs, click Add External JARs. Select the JAR file, and click Open. Note that ws.ext.dirs is used for application JAR files, and the CLASSPATH is used for server JAR files. e. Close the server instance and save your changes.
181
Enterprise JavaBeans Specification, Version 2.0: ftp://128.11.159.146/pub/ejb/947q9tbb/ejb-2_0-fr2-spec.pdf JSR-000053 Java Servlet 2.3 and JavaServer Pages 1.2 Specifications: http://java.sun.com/aboutJava/communityprocess/first/jsr053/index.ht ml The IBM WebSphere Application Server Version 4 InfoCenter: http://www.ibm.com/software/webservers/appserv/doc/v40/aes/infocente r/index.html
182
http://www.ibm.com/websphere/developer/techjournal/0201_minocha/mino cha.html An article on EJB application design using the Session Facade to talk to CMPs http://www.ibm.com/websphere/developer/library/techarticles/ 0106_brown/sessionfacades.html An article on WebSphere Application Server Best Practices: http://www.ibm.com/software/webservers/appserv/ws_bestpractices.pdf An article on WebSphere Best Practices zone: http://www.ibm.com/websphere/developer/zones/bp/ WebSphere Developer Domain main Web page: http://www.ibm.com/websphere/developer WebSphere Developer Domain technical articles: http://www.ibm.com/websphere/developer/techjournal/ Information about the WebSphere Studio family, and the features and directions of WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/zones/studio/transition.html IBM WebSphere Studio family of development tools: http://www.ibm.com/websphere/developer/library/techarticles/0108_stu dio/studio_beta.html External Application Developer newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.application-sit e-developer External workBench (Eclipse) newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.workbench External WebSphere Application Server newsgroup: news://news.software.ibm.com/ibm.software.websphere.application-server An article on deploying a J2EE application from WebSphere Studio Application Developer to WebSphere Application Server: http://www.software.ibm.com/vad.nsf/Data/Document3584 Application Developer software configuration management (source code management) vendors: http://www.ibm.com/software/ad/studioappdev/partners/scm.html Migrating applications to Application Developer from competitors development tools: http://www.ibm.com/websphere/developer/zones/studio/migration.html Migrating VisualCaf WebLogic applications to Application Developer (still deploying to WebLogic): http://www.ibm.com/websphere/developer/library/techarticles/0209_sea rle/searle1.html
183
Eclipse.org: http://www.eclipse.org WebSphere Developer Domain Plugin Central: http://www.ibm.com/websphere/developer/downloads/plugin/ Eclipse workbench plug-ins (not part of Eclipse.org): http://www.eclipse-workbench.com/jsp/plugins.jsp Eclipse plug-ins (not part of Eclipse.org): http://www.eclipse-plugins.2y.net/eclipse/plugins.jsp
184
Chapter 5.
185
Note: In some cases the HTTP server version supported by V3.5 and V4.0 of WebSphere Application Server will not be the same of those versions supported by WebSphere Application Server V5.0. In these cases, you'll need to migrate to a common supported HTTP server version if you wish to run multiple plug-ins in one HTTP server.
5.1.1 OSE
In Version 3.5, WebSphere Application Server uses a proprietary protocol called OSE (Open Servlet Engine) to communicate between the plug-in and the Servlet Engine. When running both the HTTP server and WebSphere on the same machine, OSE is usually run over local pipes. If the HTTP server and WebSphere are running on different machines, we can use OSE Remote over TCP/IP. OSE Remote allows the HTTP server to run on a separate machine and send requests over the network to application server(s) running on remote machines. OSE supports clustering and workload management of application servers. This
186
means that the HTTP server can send requests that require intensive processing to multiple application server machines, freeing up the HTTP server machine to process more requests. This provides both vertical and horizontal scaling of the WebSphere environment. OSE is not supported in Version 5.0.
187
<Server CloneID="u01ctbc0" Name="Default Server"> <Transport Hostname="alcott" Port="9080" Protocol="http"/> </Server> </ServerGroup> <UriGroup Name="alcott_sampleApp/default_app_URIs"> <Uri AffinityCookie="JSESSIONID" Name="/servlet/snoop/*"/> <Uri AffinityCookie="JSESSIONID" Name="/servlet/snoop2/*"/> <Uri AffinityCookie="JSESSIONID" Name="/servlet/hello"/> <Uri AffinityCookie="JSESSIONID" Name="/ErrorReporter"/> <Uri AffinityCookie="JSESSIONID" Name="*.jsp"/> <Uri AffinityCookie="JSESSIONID" Name="*.jsv"/> <Uri AffinityCookie="JSESSIONID" Name="*.jsw"/> <Uri AffinityCookie="JSESSIONID" Name="/j_security_check"/> <Uri AffinityCookie="JSESSIONID" Name="/servlet/*"/> </UriGroup> <UriGroup Name="alcott_sampleApp/examples_URIs"> <Uri Name="/webapp/examples/*"/> </UriGroup> <Route ServerGroup="alcott/Default Server" UriGroup="alcott_sampleApp/default_app_URIs" VirtualHostGroup="default_host"/> <Route ServerGroup="alcott/Default Server" UriGroup="alcott_sampleApp/examples_URIs" VirtualHostGroup="default_host"/> </Config>
188
<Property name="stashfile" value="C:\WAS5_beta3\AppServer\etc\plugin-key.sth"/> </Transport> <Transport Hostname="hostone" Port="9090" Protocol="http"/> <Transport Hostname="hostone" Port="9043" Protocol="https"> <Property name="keyring" value="C:\WAS5_beta3\AppServer\etc\plugin-key.kdb"/> <Property name="stashfile" value="C:\WAS5_beta3\AppServer\etc\plugin-key.sth"/> </Transport> </Server> <Server Name="server1clone" LoadBalanceWeight=""5> <Transport Hostname="hosttwo" Port="9080" Protocol="http"/> <Transport Hostname="hosttwo" Port="9443" Protocol="https"> <Property name="keyring" value="C:\WAS5_beta3\AppServer\etc\plugin-key.kdb"/> <Property name="stashfile" value="C:\WAS5_beta3\AppServer\etc\plugin-key.sth"/> </Transport> <Transport Hostname="hosttwo" Port="9090" Protocol="http"/> <Transport Hostname="hosttwo" Port="9043" Protocol="https"> <Property name="keyring" value="C:\WAS5_beta3\AppServer\etc\plugin-key.kdb"/> <Property name="stashfile" value="C:\WAS5_beta3\AppServer\etc\plugin-key.sth"/> </Transport> </Server> <PrimaryServers> <Server Name="server1"/> </PrimaryServers> <SecondaryServers> <Server Name="server1clone"/> </PrimaryServers> </ServerCluster> <UriGroup Name="default_host_server1_Cluster_URIs"> <Uri Name="/snoop/*"/> <Uri Name="/snoop"/> <Uri Name="/hello"/> <Uri Name="/hitcount"/> <Uri Name="*.jsp"/> <Uri Name="*.jsv"/> <Uri Name="*.jsw"/> </UriGroup> <Route ServerCluster="server1_Cluster" UriGroup="default_host_server1_Cluster_URIs" VirtualHostGroup="default_host"/> <UriGroup Name="admin_host_server1_Cluster_URIs"> <Uri Name="/admin"/> <Uri Name="/admin/*"/>
189
As can be seen by examining the two files, they have much in common, but there are some significant differences: 1. The V4.0 ServerGroup has been replaced in V5.0 by a ServerCluster. 2. In V5.0, primary servers and secondary servers can be defined for a cluster. When defined, the requests will be directed only to primary servers applying WorkLoad Management (WLM). Requests will go to the secondary server only when all the servers in the primary server list are down. If there are multiple servers in secondary list, then all requests will be routed to the first live server in that list and there will be no load balancing in the secondary list. When the plug-in configuration is generated using GenPluginCfg.bat, the generated plugin-cfg.xml contains only the primary list. Secondary list definitions using the admin console didn't make it into V5.0. Therefore, a user will need to manually edit the generated plugin-cfg.xml file to define the secondary servers. 3. In V5.0 a property for LoadBalanceWeight is used to specify weighting for load distribution. The weights are calculated as a ratio of LoadBalanceWeight divided-by the sum of all the LoadBalanceWeights specified for each server in the cluster. In Example 5-2 on page 188, both servers have a LoadBalanceWeight of 5, so each will receive 50% of the requests (5/10). Note: A number of the V5.0 URI mappings were omitted for brevity.
190
Usage: GenPluginCfg [[-option.name optionValue]...] Valid Options: ============== -config.root configroot_dir (defaults to user.install.root/config) -cell.name cell (required) -node.name node (required for node generation or single server plugin generation) -server.name server (required for single server plugin generation) -output.file.name file_name (defaults to configroot_dir/plugin-cfg.xml) -debug yes/no (defaults to no)
Actual generation of the plug-in configuration is depicted in the commands and responses below:
C:\WAS50\AppServer\bin>genplugincfg -cell.name BaseApplicationServerCell -node.name alcott IBM WebSphere Application Server, Release 5.0 WebSphere Plugin Configuration Generator Copyright IBM Corp., 1997-2002 Generating for all servers on cell BaseApplicationServerCell, node alcott. Plugin Configuration file = C:\WAS50\AppServer\config\plugin-cfg.xml
191
machine, add a key called 5.0 to WebSphere Application Server and then add the Plugin Config variable to the key for the Web server plug-in to load. 2. Move the appropriate files from the bin directory of a Version 5.0 application server installation. In Windows, move mod_ibm_app_server_http.dll and plugin_common.dll In UNIX, move mod_ibm_app_server_http.so(sl) 3. To the httpd.conf file, add the lines for configuring the Version 5.0 Web server plug-in. This is specified by the LoadModule and WebSpherePluginCfg directives. LoadModule ibm_app_server_http_module <wasroot>/bin/mod_ibm_app_server_http.dll WebSpherePluginConfig "<wasroot>config/plugin-cfg.xml 4. Regenerate the plug-in configuration file on the application server machine after you have the machine migrated. Be sure the host name attributes of the transports are set to the host name or IP address of the machine on which the application server is running. 5. Move the plug-in configuration file into the Web server installation so that it is in the location specified by the WebSpherePluginConfig directive in the httpd.conf file. 6. Restart the Web server; you should be able to access applications that run on Version 3.x or Version 4.0 application server clusters or V5.0 application server cells. 7. As you migrate machines to Version 5.0, you must regenerate the Web server plug-in configuration after migration and move the plug-in configuration file to the Web server installation. You should also remove the machine from the V3.5 OSE or V4.0 HTTP files by either manually editing them or removing the machine from the Version 3.x or V4.0 instances and then regenerating the OSE property files.
192
2. Move the appropriate files from the bin directory of a Version 5.0 application server installation. 3. In Windows, move ns41_http.dll and plugin_common.dll. 4. In UNIX, move libns41_http.so(sl). 5. To manually configure the HTTP server plug-in: Add the following two directives to the magnus.conf file:
Init fn="load-modules" funcs="as_init,as_handler,as_term" shlib="<wasroot>/ns41_http.dll" Init fn="as_init" bootstrap.properties="<wasroot>/config/plugin-cfg.xml
6. Regenerate the plug-in configuration file on the application server machine after you have the machine migrated. Be sure the host name attributes of the transports are set to the host name or IP address of the machine on which the application server is running. 7. Move the plug-in configuration file into the Web server installation so that it is in the location specified by the bootstrap.properties variable for the Init directive in the obj.conf file for iPlanet 4.x or the Init directive in the magnus.conf file for iPlanet 6.x. 8. Restart the Web server. You should be able to access applications that run on Version 3.x or Version 4.0 application server clusters or V5.0 application server cells. 9. As you migrate machines to Version 5.0, you must regenerate the Web server plug-in configuration after migration and move the plug-in configuration file to the Web server installation. You should also remove the machine from the V3.5 OSE or V4.0 HTTP files by either manually editing the files or removing the machine from the Version 3.x or V4.0 instances and then regenerating the OSE property files.
193
complete instructions for this can be found in the instructions for manually configuring the Web server plug-in. 2. Move the appropriate files from the bin directory of a Version 5.0 application server installation. In Windows, move domino5_http.dll and plugin_common.dll In UNIX, move libdomino5_http.a(so,sl) 3. Follow these steps for manually configuring the Version 5.0 Web server plug-in: a. Start up the Domino server. b. Access the following /webadmin.nsf through your Web browser (for example http://myserver .ibm.com/webadmin.nsf). It should prompt you for a password. You need to give the short name for the Administrator and the Administrator password. The short name is usually the first letter of the first name and the last name (for example, Joe Smith becomes jsmith). c. Click the Configuration link on the left-hand side of the page. d. Click the Servers link at the top left center of the page. e. Double-click the server you want to work with WebSphere. f. Click Edit Server at the top left of the center window. g. Click Internet Protocols in the middle of the page. h. In the DSAPI section in the middle right of the page, add the path to the Domino plug-in. The plug-in gets installed in the WebSphere bin directory. i. Click Save and Close in the upper left hand corner of the center window. j. Add the variable Plugin Config to the registry by navigating to HKEY_LOCAL_MACHINE -> SOFTWARE -> IBM -> WebSphere Application Server -> 5.0. Set the value for this variable to the location of the plugin-cfg.xml file. k. Restart the Domino Server. l. When the server is starting up, you should see something similar to the following:
02/12/2001 03:05:09 PM JVM: Java Virtual Machine initialized. WebSphere DSAPI filter loaded 02/12/2001 03:05:10 PM HTTP Web Server started
4. Regenerate the plug-in configuration file on the application server machine after you have the machine migrated. Be sure the host name attributes of the transports are set to the host name or IP address of the machine on which the application server is running.
194
5. Move the plug-in configuration file into the Web server installation so that it is in the location specified by the Plugin Config variable that you added to the registry. 6. Restart the Web server. You should be able to access applications that run on Version 3.x or Version 4.0 application server clusters or V5.0 application server cells. 7. As you migrate machines to Version 5.0, you must regenerate the Web server plug-in configuration after migration and move the plug-in configuration file to the Web server installation. You should also remove the machine from the V3.5 OSE or V4.0 HTTP files by either manually editing the files or removing the machine from the Version 3.x or V4.0 instances and then regenerating the OSE property files.
195
c. Add the ISAPI filter into the IIS configuration. Right-click the host name in the tree on the left and select Properties. i. On the Internet Information Services tab, select Master Properties -> WWW Service and click the Edit button. ii. The WWW Service Master Properties window pops up. Click the ISAPI Filters tab. iii. Click the Add button. This brings up the Filter Properties window. iv. In the Filter Name field, type iisWASPlugin. v. In the Executable field, click the Browse button, go into WebSphere bin directory, and select iisWASPlugin_http.dll. vi. Click the OK button until all open windows are closed. d. Add the variable Plugin Config to the registry by navigating to HKEY_LOCAL_MACHINE -> SOFTWARE -> IBM -> WebSphere Application Server -> 5.0. Set the value for this variable to the location of the plugin-cfg.xml file. 4. Regenerate the plug-in configuration file on the application server machine after you have the machine migrated. Be sure the host name attributes of the transports are set to the host name or IP address of the machine on which the application server is running. 5. Move the plug-in configuration file into the Web server installation so that it is in the location specified by the Plugin Config variable that you added to the registry. 6. Restart the Web server. You should be able to access applications that run on Version 3.x or Version 4.0 application server clusters or V5.0 application server cells. 7. As you migrate machines to Version 5.0, you must regenerate the Web server plug-in configuration after migration and move the plug-in configuration file to the Web server installation. You should also remove the machine from the V3.5 OSE or V4.0 HTTP files by either manually editing the files or removing the machine from the Version 3.x or V4.0 instances and then regenerating the OSE property files.
196
Chapter 6.
197
This chapter provides a migration path for most of the common configuration and administrative tasks in WebSphere. It starts with a description of the major differences in the GUI from prior versions, followed by common tasks executed using the GUI, XMLConfig, and wscp. The wsadmin tool is considered with the migration focus in mind. The final part of the chapter explains the migration and details that are involved in accomplishing the tasks with the wsadmin tool. Please refer to the WebSphere V5.0 InfoCenter for more detailed information on wsadmin.
198
199
200
As noted previously, one major difference in the V5.0 Administrative Console from prior versions is the fact that the administrative application that runs in the deployment manager has some function not available in WebSphere Application Server, including the ability to view the entire cell topology. As a result, the view in the Administrative Console differs between the WebSphere Application Server Base (Base) and WebSphere Application Server Network Deployment (ND). Some of these differences are apparent by comparing Figure 6-3 (Base) and Figure 6-4 on page 202 (ND).
201
Aside from the identification of the administrative domain of BaseApplicationServerCell for WebSphere Application Server, and <servername>Network in ND, there is also an additional category of Systems Administration that has many of the ND administrative functions. There are additional functions in the existing categories, which are highlighted in Figure 6-5 on page 203.
202
203
4. Specify Initial Heap Size or Maximum Heap Size (or other settings) as desired 5. Click Apply -> Save -> Save
204
The common tasks can be grouped into the following main categories: Server administration Application management Administration of configured objects Cluster administration Other tasks
Server administration
Start an application server Stop an application server Create a new application server Remove an application server Connect to remote servers
Application management
Web application - install, uninstall, list Enterprise application - install, uninstall, start, stop, list Servlet Engine - create, remove, list EJB Container - create, remove, list Data source - create, remove, list Servlet - Add, remove, list EJB - Add, remove, list
Cluster administration
Create a new clone Modify an existing clone Remove a clone Associate/disassociate clone
205
Other tasks
Enable/disable security Set trace Import/export Regenerate plug-in Install JDBC drivers Monitor performance Manipulate JNDI contexts Ping nodes and application servers for current status Test connections to data sources Manage the Java Messaging Service Most of the tasks listed above will be covered in the following sections. We also explain the different ways commands can be invoked and the parameters that go with them.
206
JMX MBeans
In WebSphere V5.0, administration and application management is based on Java Management Extensions (JMX). JMX enables querying of configuration settings and changing them during runtime. JMX can be used to load, initialize, change and monitor an application and its distributed components. The JMX architecture introduces three layers: Instrumentation layer Agent layer Distributed Services layer More details about JMX itself can be obtained from the JMX Specification (JSR003), found at http://jcp.org/en/jsr/detail?id=3.
207
In other words, an MBean can be any Java object that is modified to support the interfaces specified by the JMX specification. MBeans can be standard, dynamic, open or model. Standard MBeans provide a static interface that conforms to existing design models. Dynamic MBeans expose their interface to the JMX Agent at runtime using metadata. Open MBeans are dynamic MBeans that use predefined Java data types for better manageability. Model MBeans are generic and configurable MBeans provided with the installation.
208
And for the attributes available on the Application MBean, use the following command:
wsadmin> set app [$AdminControl queryNames type=Application,*] wsadmin> set defApp [lindex $app 0] wsadmin> $Help attributes $defApp
The commands and their syntax are explained in more detail in 6.3.2, wsadmin command syntax and usage on page 211. For a complete list and more information, please refer to the documentation in the InfoCenter.
Table 6-1 MBeans: attributes and methods available
MBeans AppManagement Attributes Available Methods Available installApplication uninstallApplication moveModule exportapplication listmodules redeployapplication removeapplicationfrom Node changeservertocluster removeAllAppsFromNode checkIfApplicationExists server modules name deploymentDescriptor startApplication stopApplication
Application
ApplicationManager
209
MBeans Cluster
Methods Available getClusterMember getClusterMembers getWeightTable register refresh start stop retrieveCluster retrieveClusterByMember
ClusterMgr DataSource connectionFactoryType dataSourceName loginTimeout statementCacheSize jtaEnabled name deploymentDescriptor javaVersion
DeployedObject
DeploymentManager EJB JDBCProvider JMSDestination JMSServer JMXConnector queuedPort directPort name implementationClassName jdbcDataSources
restartActiveNodes syncActiveNodes
JVM
NameServer NodeAgent
210
MBeans SecurityAdmin
Attributes Available
Methods Available generateKeys exportKeys importKeys getUsers getGroups checkPassword importLTPAKeys exportLTPAKeys
Server
name pid cellName deployedObjects nodeName processType resources state platformName platformVersion name maximumSize minimumSize growable
ThreadPool
Transaction
WAS40DataSource WebContainer
211
-p <properties_file_name>] -profile <profile_script_name>] -lang language] -wsadmin_classpath classpath] -conntype SOAP [-host host_name] [-port port_number] [-user userid] [-password password] | RMI [-host host_name] [-port port_number] [-user userid] password] | NONE ] [ script parameters ]
[ [ [ [ [
[-password
Some of these options have equivalent settings in a properties file. Options specified on the command line will override those set in a properties file. Table 6-2 outlines the function of each of the options.
Table 6-2 Options and functions of the wsadmin command
wsadmin command-line options -h(elp) and -? -c -f What they mean Provide syntax help. A single command to be executed. Identifies the script file to be run. wsadmin will try to determine the language of the file from the extension, but a -lang parameter may be required, either on the command line or in a properties file. Denotes a properties file. This file is loaded after the installation default wsadmin.properties file and the user default property file.
-p
212
What they mean This option is used to set up the environment by running a profile script before running any other script. -c denotes that the profile will be run before the single command. -f is used when running scripts. The profile will run before the script. Profiles can also be specified by the com.ibm.ws.scripting.profiles property. Specifies the language of the script file. This can also be specified by the com.ibm.ws.scripting.defaultLang property. There is no default value. WebSphere V5.0 supports Jacl. This option allows additional classes to be added to the wsadmin classpath. Classes can also be specified using the com.ibm.ws.scripting.classpath property. Specifies the connection type used. The string determines the type, followed by other options for that connector type. A SOAP connector, RMI connector, or no connector can be used. This command-line property will override Scom.ibm.ws.scripting.connectionType option in the properties file. Specifies the host name to which wsadmin should connect. The default is localhost. This parameter overrides the com.ibm.ws.scripting.host option in the properties file. Specifies the port to be used by the SOAP or RMI connectors. This command-line parameter overrides the com.ibm.ws.scripting.port option in the property file. Specifies the user ID if security is on. Specifies the password if security is on.
-profile -c -profile -f
-lang
-wsadmin_classpath
-host
-port
-user -password
213
Note: Supported properties are listed in 6.3.5, Properties used by scripting on page 221. Several -p options can be specified on the command line, and they are included in the order given. Any options other than those specified here are passed to the script as parameters. This is what is indicated by script parameters in Example 6-1 on page 211. In Jacl, these parameters are available in a list called argv, and the number of parameters is given by the variable argc. Example command invocations: wsadmin brings up a command shell using Simple Object Access Protocol (SOAP) as the connection type to the local host if there is a default language defined in a properties file. If there is no default language, this invocation is in error. wsadmin -f test1.jacl -profile setup.jacl -conntype SOAP -host mymachine sets up a SOAP connection to the mymachine host at the port specified by com.ibm.ws.scripting.port in the wsadmin.properties file. Then this example invocation runs the setup.jacl Jacl script, and finally the test1.jacl Jacl script. wsadmin -lang javascript -profile mystuff.jacl -p /usr/bob/Custom.properties sets up a connection to the default host (as specified in the Custom.properties properties file), runs the mystuff.jacl Jacl script file, then brings up command shell in which the user can invoke JavaScript commands.
AdminControl
The AdminControl object is used to invoke all operational commands that deal with live, running objects in the WebSphere servers. Methods on the AdminControl object can be invoked directly using parameters specified by JMX or by using strings for parameters. The AdminControl object also supports some utility methods for tracing, reconnecting with a server, and data type conversion.
214
Commands
Some of the main commands available on the AdminControl object are listed below. For a more complete list, refer to the InfoCenter. To list operations available, invoke help on the AdminControl object as follows:
wsadmin> $Help AdminControl
completeObjectName is a convenient method that creates a string representation of a complete ObjectName based on a fragment. It does not communicate with the server to find a matching ObjectName. If it finds several MBeans that match the fragment, it returns the first one. For example:
wsadmin> set serverON [$AdminControl completeObjectName node=mynode,type=Server,*]
getAttributes returns all the attributes for the object name passed. For example:
wsadmin> set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] wsadmin> $AdminControl getAttributes $objNameString "cellName nodeName"
getCell returns the cell that we are connected to. For example:
wsadmin> $AdminControl getCell
getPropertiesForDataSource gets a list of properties on the data source from the DataSourceCfgHelper Mbean. For example:
wsadmin> set ds [lindex [$AdminConfig list DataSource] 0] wsadmin> $AdminControl getPropertiesForDataSource $ds
invoke invokes the object operation by conforming the parameter list to the signature. For example:
wsadmin> set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] wsadmin> $AdminControl invoke $objNameString stop
invoke invokes the object operation using the parameter list that you supply. The signature generates automatically. The types of parameters are supplied by examining the MBeanInfo that the MBean supplies. For example:
wsadmin> set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] wsadmin> $AdminControl invoke $objNameString appendTraceString com.ibm.*=all=enabled
215
invoke invokes the object operation by conforming the parameter list to the signature. For example:
wsadmin> set objNameString [$AdminControl completeObjectName WebSphere:type=TraceServer,*] wsadmin> $AdminControl invoke $objNameString appendTraceString com.ibm.*=all=enabled java.lang.String
invoke_jmx invokes the object operation by conforming the parameter list to the signature. For example:
wsadmin> set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] wsadmin> set objName [java::new javax.management.ObjectName $objNameString] wsadmin> set parms [java::new {java.lang.Object[]} 1 com.ibm.ejs.sm.*=all=disabled] wsadmin> set signature [java::new {java.lang.String[]} 1 java.lang.String] wsadmin> $AdminControl invoke_jmx $objName appendTraceString $parms $signature
isRegistered returns TRUE or 1, if the object is registered on the server. For example:
wsadmin> set objectNameString [$AdminControl completeObjectName WebSphere:type=Server,*] wsadmin> $AdminControl isRegistered $objectNameString
queryNames returns a string that lists all ObjectNames based on the name template. For example:
wsadmin> $AdminControl queryNames WebSphere:type=Server,*
setAttribute sets the attribute value to the string specified. For example:
wsadmin> set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] wsadmin> $AdminControl setAttribute $objNameString traceSpecification com.ibm.*=all=disabled
startServer starts the specified server on the specified node. For example:
wsadmin> $AdminControl startServer server1 mynode
stopServer stops the specified server on the specified node. For example:
wsadmin> $AdminControl stopServer server1 mynode
216
AdminConfig
The AdminConfig is used to call configuration commands to make configuration changes to WebSphere. Configuration objects are named using a convention that uses a combination of the display name for the object and its configuration ID. An example of such an object name is: Db2JdbcProvider(cells/testcell/nodes/testnode/resources.xml#JDBCProvider_1) The display name comes first, followed by the configuration ID in parentheses. Since the config ID part of the name is completely unambiguous, a user can always use it without the prepended display name in any command that requires a config object name. That is, the following two commands are equivalent and would both accomplish the same thing:
show("Db2JdbcProvider(cells/testcell/nodes/testnode/resources.xml#JDBCProvider_ 1)") show("(cells/testcell/nodes/testnode/resources.xml#JDBCProvider_1)")
The types command returns a list of the possible top-level types that can be manipulated by AdminConfig. Also, to invoke AdminApp functions, the scripting process need not be connected to the server. So if you want to call certain operations in a local mode, you need to specify -conntype NONE when using wsadmin. Examples of commands that can be invoked on the AdminConfig object are as follows. This is not an exhaustive list; refer to the InfoCenter for more information. types returns a list of config object types that can be manipulated. For example:
wsadmin> $AdminConfig types
list [objectType] returns a list of objects of the specified type. For example:
wsadmin> $AdminConfig list Server
listTemplates returns a list of all template object of the specified type. For example:
wsadmin> $AdminConfig listTemplates JDBCProvider
attributes returns a list of the top-level attributes for the specified type, displayed as name and type. For example:
wsadmin> $AdminConfig attributes ApplicationServer
217
parents returns a list of object types that can be the parent of the specified object. For example:
wsadmin> $AdminConfig parents JDBCProvider
defaults returns a table of attributes, their types and their default values, for a specified object type. For example:
wsadmin>$AdminConfig defaults TuningParams
showall returns all the attributes of the specified object. For example:
wsadmin> set ds [$AdminConfig getid /DataSource:PLANTSDB/]] wsadmin> $AdminConfig showall $ds
create [type(string)] [ParentId(string)] [attributes (string)] creates an object of the specified type, with the given parent and with the attributes specified. For example:
wsadmin>set jdbc1 [$AdminConfig getid /JDBCProvider:jdbc1/] wsadmin>$AdminConfig create DataSource $jdbc1 {{name db1}}
createUsingTemplates [type(string)] [parentId(string)] [attributes(string)] [templateId (string)] creates an object of the specified type, with the given parent using the template specified. For example:
wsadmin>set node [$AdminConfig getid /Node:mynode/] wsadmin>set templatel [$AdminConfig listTemplates JDBCProvider "DB2 JDBC Provider (XA)"] wsadmin>$AdminConfig createUsingTemplate JDBCProvider $node {{name newdriver}} $templ
remove removes the specified object from the WebSphere configuration. For example (Jacl):
wsadmin>set qq [$AdminConfig getid /WASQueueConnectionFactory:wasq1/] wsadmin>$AdminConfig remove $qq
save saves the workspace contents to the configuration repository. Unless save is invoked, no changes to the configuration are permanent. For example:
wsadmin>$AdminConfig save
queryChanges returns a list of changed files in the temporary workspace. For example (Jacl):
wsadmin>$AdminConfig queryChanges
218
createClusterMember creates a new Server object on the node specified, given the configuration ID of an existing ServerCluster. For example:
wsadmin>set clid [$AdminConfig getid /ServerCluster:mycluster/] wsadmin>set nodeid [$AdminConfig getid /Node:mynode/] wsadmin>set template [$AdminConfig listTemplates ClusterMember] wsadmin>$AdminConfig createClusterMember $clid $nodeid {{memberName newMem1} {weight 5}} $template
installResourceAdapter creates a J2CResourceAdapter object on the current node, given a RAR file and a list of options. For example (Jacl):
wsadmin>$AdminConfig installResourceAdapter c:/mystuff/mine.rar mynode {-rar.desc "My rar file"}
AdminApp
AdminApp is used to install, modify, and otherwise administer applications. It interacts with the WebSphere application management to make the application inquiries and changes. This includes installing and uninstalling applications, listing/moving modules, exporting, etc. Also, to invoke AdminApp functions, the scripting process need not be connected to the server. So if you want to call certain operations in a local mode, you need to specify -connt. For example: wsadmin.bat -conntype NONE [if using interactive mode] wsadmin.bat -conntype NONE -c "$Help help" (using -c option) wsadmin.bat -conntype NONE -f test.jacl (if running the test.jacl script) The following operations can be invoked on the AdminApp. Again, for a complete list, use the help option on AdminApp or refer to the InfoCenter. install [earfile] <options> installs the application in a non-interactive mode, given the fully qualified file name. If this information is not enough to install the application, the command fails. For example (Jacl):
wsadmin>$AdminApp install c:/WebSphere/AppServer/temp/tutorial/Big3App.ear
installInteractive [earfile] <options> installs the application in an interactive mode with the specified EAR file. In this mode, the scripting process prompts for information for each task. If you have existing information, you can either accept it or override it. For example (Jacl):
wsadmin>$AdminApp installInteractive c:/WebSphere/AppServer/temp/tutorial/Big3App.ear
219
options returns a list of options available for EAR files. For example (Jacl):
wsadmin>$AdminApp options
listModules [applicationName] lists the modules in the specified application. For example (Jacl):
wsadmin>$AdminApp listModules ivtApp
Export [applicationName] [fileName] exports the given application to a file specified. For example (Jacl):
wsadmin>$AdminApp export "My App" /usr/me/myapp.ear
exportDDL [appName][directoryName] extracts the DDL from the application to the directory specified. For example (Jacl):
wsadmin>$AdminApp exportDDL "My App" /usr/me/DDL
There are many install options available with the AdminApp object, including the following: noPreCompileJSPs dataSourceFor10CMPBeans dataSourceFor20CMPBeans mapModulesToServers mapEJBRefToEJB mapResRefToEJB mapRolesToUsers appName cell deployejb deployejb.dbtype node nodeployejb verbose help The Help object is used for general help, as well as to obtain dynamic online information about the MBeans that are running. It is mostly used to aid in writing and running scripts with AdminControl, and has methods such as attributes, operations, AdminConfig, and AdminControl.
220
com.ibm.ws.scripting.host
com.ibm.ws.scripting.port
com.ibm.ws.scripting.defaultLang
221
Property com.ibm.ws.scripting.traceString
Function If set, the scripting process uses this string to turn on tracing for the scripting process. It has no default. An example setting is "com.ibm.ws.scripting.*=all=enabled" to turn on all tracing for the scripting code. If set, the scripting process writes trace and logging information to this file. The validationOutput property determines where validation reports are directed. The default is wsadmin.valout in the logs directory. The root of the WebSphere installation code. It is generally set to something like c:\WebSphere\AppServer on a Windows machine, for example. The scripting code uses this to locate the installation's wsadmin.properties file. The user's home directory. The scripting code uses this to locate the user's Owsadmin.properties file. A list of profiles to be executed before executing the main script or bringing up an interactive shell. This list should consist of fully qualified path names separated by the character appropriate to the platform, for example /usr/u1/prof1:/usr/ut/prof2 or c:/myprof;c:sysprof. Note that this is just a property like any other. If it is assigned one value in the system properties file and another value in the user properties file, the value of this property is not the result of concatenating the two. This property takes the value defined in the last properties file interpreted. The emitWarningForCustomSecurityPolicy property controls whether message WASX7207W is emitted when custom permissions are found. Possible values are true or false. The default is true.
com.ibm.ws.scripting.traceFile com.ibm.ws.scripting.validationOutput
server.root
user.home
com.ibm.ws.scripting.profiles
com.ibm.ws.scripting.emitWarningForCus tomSecurityPolicy
222
Property com.ibm.ws.scripting.tempdir
Function The tempdir property determines what directory to use for temporary files when installing applications. The default is that the JVM decides. This is java.io.tmpdir. The validationLevel property determines what level of validation to use when configuration changes are made from the scripting interface. Possible values are NONE, LOW, MEDIUM, HIGH, or HIGHEST. The default is HIGHEST. The crossDocumentValidationEnabled property determines whether the validation mechanism examines other documents when changes are made to one document. Possible values are true or false. The default is true. The classpath property is appended to the list of paths to search for classes and resources. There is no default value. Set to the value of the WSADMIN_PROPERTIES environment variable. Points to a properties file that is loaded after the system and user _wsadmin.properties files.
com.ibm.ws.scripting.validationLevel
com.ibm.ws.scripting.crossDocumentVali dationEnabled
com.ibm.ws.scripting.classpath
com.ibm.ws.scripting.wsadminprops
6.3.6 Profiles
A profile is a script that is run before the other scripts specified to set up the environment for the scripts to follow. The -profile option on the wsadmin command allows the user to specify one or more profiles to be run when the scripting process starts. A scripting process can be started like this:
wsadmin -f doit.jacl -profile myprof.jacl
In this case, the process runs the doit.jacl script after executing the myprof.jacl profile. In this way, doit.jacl can make use of anything set up by myprof.jacl. Any number of -profile options may be specified, and they execute in the order they appear on the command line. A property in the wsadmin.properties file can specify a list of profiles to be run.
223
Creation of objects can be done using one of the supplied templates or an existing object. In the following example, server1 is the existing object used.
wsadmin> set node [$AdminConfig getid /Node:<nodeName>/] wsadmin> set svrTemp [$AdminConfig getid /Node:<nodeName>/Server:server1/] wsadmin> $AdminConfig createUsingTemplate Server $node {{name server2}} $svrTemp
224
If there is more than one attribute, then they can all be specified at the same level.
wsadmin> $AdminConfig modify $ts {{enable false} {startupTraceSpecification *=all=enabled}}
However, if the attribute that is to be modified is contained within another object, there are two ways to modify. You either get the ID of the object you want to modify and change that object, or you can modify it through its parent object. Continuing with our Trace example, we modify the traceLog attribute of the TraceService by specifying its location. We can alternatively get the TraceLog object and modify that directly.
wsadmin> set svr [$AdminConfig getid /Node:myNode/Server:server1/] wsadmin> set ts [$AdminConfig list TraceService $svr] wsadmin> $AdminConfig modify $ts {{traceLog {{fileName myFile.log}}}}
There is an extra set of braces around the filename attribute and its value since it represents a collection of objects of type TraceLog. Most other nested attributes can be extended from this. If you want to modify a list of strings, such as a classpath attribute, then the members have to be separated by semicolons, as follows:
wsadmin> $AdminConfig modify $obj1 {{classpath c:/wasRuntime/AppServer/one.jar;"c:/Program Files/two.jar"}}
225
And finally, if you are writing a script and expect values to be passed in, then to set them, you will have to use the list command. In the following example, an alternate Trace File is passed in to be set for the trace log. The commands to set it would be:
wsadmin> set maxBackup 5 wsadmin> set file "c:/was/server1/myfile.log" wsadmin> set svr [$AdminConfig getid /Node:<nodeName>/Server:<svrName>/] wsadmin> set ts [$AdminConfig list TraceService $svr] wsadmin> set tracelog [$AdminConfig list TraceLog $ts] wsadmin> $AdminConfig modify $tracelog [list [list filename $file] [list maxNumberOfBackupFiles 5]]
226
Operational commands include: start, stop, show, testConnection All DrAdmin commands regenPluginCfg 3. Identify corresponding configuration objects in WebSphere V5.0, as listed in Table 6-4.
Table 6-4 Corresponding configuration objects in WebSphere V5.0
wscp 4.0 command ApplicationServer Context DataSource Domain EnterpriseApp GenericServer J2CConnectionFactory J2CResourceAdapter JDBCDriver JMSConnectionFactory JMSDestination JMSProvider MailSession Module Node ServerGroup URL URLProvider VirtualHost wsadmin 5.0 configuration type Server Not applicable WAS40DataSource, DataSource Not applicable ApplicationDeployment; also, use AdminApp Server J2CConectionFactory J2CResourceAdapter JDBCProvider JMSConnectionFactory JMSDestination JMSProvider MailSession ModuleDeployment; also, use AdminApp Node ServerCluster URL URLProvider VirtualHost
227
4. Identify wsadmin attribute names Attribute names have changed in wsadmin from the previous versions. These, however, are easy to map using the help functions. Get a list of the attributes that are used in the scripts and map them to the new names. 5. Convert Application Install commands Use AdminApp installInteractive to complete one install. Then you can use the wsadmin.traceout log file to construct an install command for your script. The message WASX7278I will point to all the data. 6. Convert operational commands Use the information in 6.4.3, Migration from V3.5 to V5.0 on page 228 and 6.4.4, Migration from V4.0 to V5.0 on page 230 for specific version mappings. A number of common tasks have been provided as examples. These should help in finding the right operation map.
228
EAR objects. Hence individual components of an application do not have to be installed separately. They can be started or stopped using the corresponding application using AdminApp. For more information on AdminApp and its functions, please refer to 6.4.4, Migration from V4.0 to V5.0 on page 230. EnterpriseBean Servlet ServletEngine ServletRedirector SessionManager WebApplication WebResource UserProfile Also the Model object is now functionally equivalent to an ServerCluster object with the wsadmin scripting tool. And only ApplicationServer objects can be part of clusters.
229
wsadmin 5.0
The wsadmin tool is invoked using the wsadmin.bat or wsadmin.sh program. You can specific the -f option to run a script file, or the -c option to run a command. If you specify neither, an interactive shell appears. Multiple -c commands may be specified on the command line, and there are additional options that may be specified. For more details, please refer to the InfoCenter.
Table 6-5 Mapping of wscp 4.0 to wsadmin 5.0
wscp 4.0 action server start server stop servergroup start servergroup stop application start application stop node stop Object and command AdminControl startServer AdminControl stopServer AdminControl invoke AdminControl invoke AdminControl invoke AdminControl invoke AdminControl invoke Cluster Cluster ApplicationManager ApplicationManager NodeAgent start stop startApplication stopApplication stop wsadmin 5.0 Mbean, if any Operation, if any
230
wscp 4.0 check runtime attributes For state, see if MBean is running; for others, AdminControl getAttribute AdminControl invoke AdminControl testConnection security on command in securityProcs.jacl securityoff command in securityProcs.jacl
PluginCfgGenerator DataSource
generate
disable security
Task-based scenarios
This section provides examples of wscp-to-wsadmin migration. The tasks are grouped into the categories outlined in 6.2, Current usage of XMLConfig and wscp on page 204.
Server administration
Start an application server: wscp 4.0
ApplicationServer start /Node:mynode/ApplicationServer:myserv/
wsadmin 5.0 This command only makes sense in a Network Deployment installation. In a Base installation, if you are connected to a server, you are connected to the only server and you ca not request that another be started. But in a Network Deployment installation, you can use:
$AdminControl startServer myserv mynode
If mynode is the node the client is connected to, the node name may be omitted:
$AdminControl startServer myserv
231
Stop an application server: This is an operational command. wscp 4.0 requires that you know the hierarchical name of the application server in question -- the node name and server name. You need the same information in 5.0, and you also need to understand that what you are stopping is an object called a Server, not an ApplicationServer. Servers represent logical processes on many platforms (for example Windows and AIX) and are the entities that are stopped and started. ApplicationServers are contained within Servers. wscp 4.0
ApplicationServer stop {/Node:mynode/ApplicationServer:Default Server/}
wsadmin 5.0 There is more than one way to stop a server in V5.0 using wsadmin. The simplest method is by using the stopServer command on the AdminControl object:
$AdminControl stopServer server1 mynode
If mynode is the node the client is connected to, the node name may be omitted:
$AdminControl stopServer server1
Create a new application server: This is a configuration command. wscp 4.0 requires that you know the hierarchical name of the application server in question -- the node name and server name. You need the same information in 5.0, and you also need to understand that what you are creating is an object called a Server, not an ApplicationServer. wscp 4.0
ApplicationServer create /Node:mynode/ApplicationServer:myserv/ -attribute {{Stdout myfile.out}}
wsadmin 5.0 This can be done in a single command in wsadmin, but it is clearer to show it as two. Server objects are contained within nodes. The 4.0 ApplicationServer attribute called Stdout is replaced by the fileName attribute embedded within the outputStreamRedirect attribute of the Server.
wsadmin>set node [$AdminConfig getid /Node:mynode/] wsadmin>$AdminConfig create Server $node {{name myserv} {outputStreamRedirect {{fileName myfile.out}}}}]
232
wsadmin>$AdminConfig save
wsadmin 5.0 This can be done in a single command in wsadmin, but it is clearer to show it as two.
wsadmin>set serv [$AdminConfig getid /Node:mynode/Server:myserv/] wsadmin>$AdminConfig remove $serv wsadmin>$AdminConfig save
Connect to remote server: wscp 4.0 Set the wscp.host name in the default.wscprc file:
wscp.hostname = myhost
wsadmin 5.0 Launch the scripting program by passing in the host parameter:
wsadmin -host myhost.austin.ibm.com
Application management
Enterprise Application - install: In 4.0, wscp scripts used the EnterpriseApp and Module commands to install and uninstall applications. WebSphere 5.0 wsadmin scripts will use the AdminApp command to perform similar configuration actions. wscp 4.0 The EnterpriseApp install command has complex syntax, so we build up some pieces of the command beforehand: construct -modvirtualhosts option
wscp> set modhost1 [list mtcomps.war default_host] wscp> set modhosts [list $modhost1]
233
wscp> set resref2 [list deplmtest.jar::MailEJBObject::mail/MailSession9 mail/DefaultMailSession] wscp> set resrefs [list $resref1 $resref2]
invoke install
wscp> EnterpriseApp install /Node:mynode/ c:/WebSphere/AppServer/installableApps/jmsample.ear -appname MailSampleApp -defappserver /Node:$mynode/ApplicationServer:myserv/ -modvirtualhosts $modhosts -resourcereferences $resrefs
wsadmin 5.0 As with 4.0, the application install commands can have very involved syntax. The command sequence given below accomplishes approximately the same thing as the 4.0 commands above, but there are simpler ways to do this. construct -MapWebModToVH option
wsadmin> set modtovh1 [list "JavaMail Sample WebApp" mtcomps.war,WEB-INF/web.xml default_host] wsadmin> set modtovh [list $modtovh1]
$attrs
234
Install default/standard applications The standard EAR files that ship with the product can be installed (in the of federation of the node into a cell, where the apps have to be installed specifically) as follows:
$AdminApp install \"c:/<WAS_HOME>/samples/lib/TechnologySamples/TechnologySamples.ear\" {-appname TechnologySamples -cell node1Network -node node1 -usedefaultbindings"
The Help utility can be used to get more information for the above commands. In this case, there are other commands that offer more information about the options. The AdminApp taskInfo and options commands are particular helpful in listing all the options and information about them. You can also use the AdminApp installInteractive command (with the same options as the install command) to be prompted for each option and step through the install, setting your values. This command with all its options is logged in the wsadmin.traceout file in the logs directory, under message WASX7278I. Enterprise Application - uninstall: wscp 4.0
wscp> EnterpriseApp remove {/EnterpriseApp:Sample Application/}
wsadmin 5.0
wsadmin> $AdminApp uninstall TechnologySamples
wsadmin 5.0
wsadmin> $AdminApp edit DefaultApplication {-BindJndiForEJBNonMessageBinding {{"Increment Enterprise Java Bean" "Increment" "Increment.jar,META-INF/ejb-jar.xml" "Increment1"}}}
While testing, it is easier to use editInteractive and get a list of the options and the variables that can be changed. Then use those with the edit command in your scripts. In the above command, -BindJndiForEJBNonMessageBinding is the option we are using to change the JNDI name of the ejb Increment, with the URI Increment.jar,META-INF/ejb.jar.xml.
235
wsadmin 5.0
wsadmin> set trace [$AdminConfig getid /TraceServer:/ wsadmin> $AdminConfig modify trace {{startupTraceSpecification=com.ibm.ws.*=all=enabled}} wsadmin> $AdminConfig save
The change in the configuration will be seen only when the server is restarted. If you made changes and do not want to save them, then you can call the reset command:
wsadmin> $AdminConfig reset
This can be invoked before a save to check for changes to the configuration.
wsadmin> $AdminConfig setSaveMode rollbackOnConflict -
This is called to set the save mode. Refer to the InfoCenter for more details on these commands. List the configured server groups: This is a configuration command in 5.0. wscp 4.0
ServerGroup list
You could put the result of this command into a Jacl list and invoke other operations such as show or modify on the members of the list.
236
wsadmin 5.0 Again, in 5.0 there are server clusters instead of server groups.
$AdminConfig list ServerCluster
Again, you can put the result of this command into a Jacl list and invoke other config commands such as show or modify on the members of the list. In order to invoke operational commands such as stop, you need to do a little more work: Get config ID of the cluster of interest
set myclust [$AdminConfig getid /ServerCluster:mycluster/]
The name returned can be used to get the ObjectName of the running Cluster MBean:
set runningCluster = [$AdminConfig getObjectName $myclust]
At this point, runningCluster will have the object name for the running instance of the ServerCluster (or it will be empty if it is not running). This object name can be used for control purposes:
$AdminControl invoke $runningCluster stop
or:
wscp> ApplicationServer help
wsadmin 5.0 Displaying general help is done using the $Help object:
wsadmin>$Help help
This will list all the options available. In general attributes and operations when passing in an Mbean are the most useful. To get the Mbean associated, you have to use the following command:
wsadmin>$AdminControl queryNames type=Server,*
List actions available on configured objects: wscp 4.0 Here, with any object, you can get help by specifying:
"<objName> help operations"
237
wsadmin 5.0 Since we are dealing with configured objects here, the wsadmin object to be used is AdminConfig.
$AdminConfig attributes Server
Cluster administration
Create a server group: WebSphere 4.0 server groups are no more; we now have server clusters in their place. The members of a cluster are not clones so much as they are servers with identical application configurations. wscp 4.0 This example assumes that there already exists an application server named as1 that is to be used as the first clone in a server group.
wscp>ServerGroup create /ServerGroup:sg1/ -baseInstance /Node:mynode/ApplicationServer:as1/ -serverGroupAttrs {{EJBServerAttributes {{SelectionPolicy roundrobin}}}}
wsadmin 5.0
wsadmin>set serverid [$AdminConfig getid /Node:mynode/Server:as1/] wsadmin>$AdminConfig convertToCluster $serverid MyCluster
wsadmin 5.0 The following three commands could be combined into a single nested command, but it is more clear to show them as three separate commands. The first gets the cluster ID, the second gets the node ID, and the last command creates a new member of an existing cluster.
wsadmin>set mycluster [$AdminConfig getid /ServerCluster:mycluster/] wsadmin>set mynode [$AdminConfig getid /Node:mynode/] wsadmin>$AdminConfig createClusterMember $mycluster $mynode {{memberName newServer}}
238
wsadmin 5.0 Again, these two commands could be combined into one. We look up the Cluster MBean, then invoke start on it:
wsadmin>set cl1 [$AdminControl completeObjectName type=Cluster,name=cluster1,*] wsadmin>$AdminControl invoke $cl1 start
It is possible that there is no running MBean for cluster1 if the cluster has not been loaded first. If this is the case, use the ClusterMgr MBean to retrieve the cluster by:
wsadmin>set clustermgr [$AdminControl completeObjectName type=ClusterMgr,*] wsadmin>$AdminControl invoke $clustermgr retrieveCluster cluster1
wsadmin 5.0 Again, these two commands could be combined into one. We look up the Cluster MBean, then invoke start on it:
wsadmin>set cl1 [$AdminControl completeObjectName type=Cluster,name=cluster1,*] wsadmin>$AdminControl invoke $cl1 stop
Remove a clone: There is no command for removing a server from a cluster, once it has been added to one. You will have to delete the server.
Other tasks
Setting the Trace specification: wscp 4.0
wscp> DrAdmin remote <portno> -setTrace com.ibm.ejs.*=all=enabled
239
wsadmin 5.0 There are two ways to set tracing with wsadmin in WebSphere V5.0. One takes immediate effect, but is temporary and is set on the runtime, using AdminControl.
wsadmin> set ts [$AdminControl queryNames type=TraceService,node=<nodeName>,process=<serverName>,*] wsadmin> $AdminControl setAttribute $ts traceSpecification com.ibm.*=all=enabled
However if you want your change to persist, then you will have to change the configuration by using AdminConfig.
wsadmin> set svr [$AdminConfig getid /Node:<nodeName>/Server:<serverName>/] wsadmin> set ts [$AdminConfig list TraceService $svr] wsadmin> $AdminConfig modify $ts {{startupTraceSpecification com.ibm.*=all=enabled}}
wsadmin 5.0 V5.0 ships a profile that is referenced in the default wsadmin.properties file so that it runs by default. This is securityProcs.jacl, and it implements various security configuration functions. As of this writing, it only supports two functions: securityon and securityoff.
securityon [user [password]]
This turns on local security. If a user name is supplied, it is set in the security config. If both a user name and password are supplied, the securityon function checks the validity of the user/password combination, and fails the function if they are not valid.
240
wsadmin 5.0 V5.0 ships a profile that referenced in the default wsadmin.properties file so that it runs by default. This is securityProcs.jacl, and it implements various security configuration functions. It only supports two functions: securityon and securityoff.
securityoff
wsadmin 5.0 There is no separate install step in WebSphere 5.0. The JAR file name required in the V4.0 install step is replaced by the classpath attribute on the 5.0 JDBCProvider object. In WebSphere 5.0, resources can exist at the server, node, or cell level of the configuration. The 5.0 equivalent of providing the node in the 4.0 JDBCDriver install command is that we create our 5.0 JDBCProvider at the node level.
wsadmin>set node [$AdminConfig getid /Node:mynode/] wsadmin>$AdminConfig create JDBCProvider $node {{classpath c:/SQLLIB/java/db2java.zip} {implementationClassName COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource} {name mydriver}}
Ping node and AppServers for current status: wscp 4.0 The point of this task is generally to determine if a given server is running:
wscp>set servers [ApplicationServer list] wscp>foreach server $servers { set result ApplicationServer show $server -attribute {CurrentState} puts "state for server $server: $result"
241
wsadmin 5.0 This task is a little more involved in WebSphere 5.0 because configuration and control commands are separated. When we get a list of all the servers in the first statement of the code shown below, we are getting a list of all the servers defined in the configuration. This is just configuration data; we cannot interrogate the configuration data to find out what servers are running, because the config data only contains configuration information. The running state of a server is not configuration information. So for each server defined, we ask for the ObjectName of any running instance of the server. If the server is not running, nothing is returned from the getObjectName command on the AdminConfig object. If the server is running, we ask for its state attribute. This may appear superfluous; if the Mbean is there, the server is running and the state should be STARTED. It is possible, however, for the state to be something other than STARTED -- say STOPPING for example.
set servers [$AdminConfig list Server] foreach server $servers { set objName [$AdminConfig getObjectName $server] if {[llength $objName] == 0} { puts "server $server is not running" } else { set result [$AdminControl getAttribute $objName state] puts "state for server $server: $result" } }
Test connections to data sources: WebSphere 4.0 introduced a means for testing the connection to a DataSource object; this function is available in WebSphere 5.0 as well. wscp 4.0
wscp>set myds /JDBCDriver:mydriver/DataSource:myds/ wscp>DataSource testConnection $myds
wsadmin 5.0 In WebSphere 5.0, the testConnection command is part of the AdminControl object, because it is an operational command. But this particular operational command takes a configuration ID as an argument, so we invoke the getid command on the AdminConfig object to get it:
wsadmin>set myds [$AdminConfig getid /JDBCProvider:mydriver/DataSource:myds/] wsadmin>$AdminControl testConnection $myds
242
In many cases, a user ID and password (or other properties) will be required to complete the test connection. If this is the case, you'll get message WASX7216E describing the missing properties:
WASX7216E: 2 attributes required for testConnection are missing: "[user, password]" To complete this operation, please supply the missing attributes as an option, following this example: {{user user_val} {password password_val}}
wsadmin 5.0
wsadmin>set cfg [$AdminControl queryNames type=PluginCfgGenerator,*] wsadmin>$AdminControl invoke $cfg generate "C:/was50/WebSphere/AppServer C:/was50/WebSphere/AppServer/config node1Network node1 server1 genPlugin.txt"
243
244
Chapter 7.
Migration assistants
This chapter describes stand-alone migration tools. It discusses tools used during the development cycle and tools that can be used to migrate system configuration and applications. This chapter covers a set of migration assistants that can be used during different parts of the migration cycle. The first section describes a set of tools that can be used during the development cycle. These tools can be used to augment functionality of a typical Integrated Development Environment (IDE). The second section describes tools that are shipped with the WebSphere Application Server that can be used for migration of system configuration and applications from a previous version of WebSphere to the current one.
245
246
Furthermore, JSP 1.1 is a pure subset of JSP 1.2 and Servlet 2.2 is a pure subset of Servlet 2.3. Therefore, any application that is written to JSP 1.1 and Servlet 2.2 levels can be part of either a J2EE 1.2 or a J2EE 1.3 application.
Where to find it
The MigrateWC tool can be found on the WebSphere Developer Domain downloadable tools Web site at http://www-3.ibm.com/software/. Enter MigrateWC in the search field and press Enter.
How to run it
JDK 1.2 or 1.3 must already be installed on your system before you run this tool. After downloading the tool from the WebSphere Developer Domain Web site, unzip it into a directory where you would like to run the command. The command can be run two different ways: either by specifying a particular JSP or Servlet source file or a directory name. If a directory is specified, then all JSP and Servlet files will be converted in that directory:
migratewc < JSP|Servlet|Directory > < -skipTags <tag!tag...>]|-onlyTags <tag!tag...>]>
When working with JSPs, you have the option to choose the tags that you would like migrated. The way to specify this is either with the optional [-skipTags <tag!tag...>] or [-onlyTags <tag!tag...>] attributes. When using -skipTags, all tags will be migrated except for the tag list you supplied. When using -onlyTags, only the tags in the tag list you specified will be migrated. Notice ! is used as the tag separator when multiple tags are to be included or ignored. You may only use one of these attributes at a time.
Results
When you migrate a Servlet, another file will be created with the same name with an extension of .new (for example snoopServlet.java becomes snoopServlet.java.new). This .new file contains the converted code. Each line that has been changed is noted with:
"<<:>Made code changes!->"
with an optional comment. If there are no comments then it is likely that changes were made without problems, although as with any code there are unforeseeable circumstances that could cause the conversion to be incorrect. It is recommended that you verify the conversion by comparing the execution results of the original code with the converted code. If errors occurred during the conversion, then a log file will be created with the same name as the original file (for example, snoopServlet.log). If this occurs, use the contents of the log file as a guide to fix the problems that were logged.
247
Table 7-1 is a mapping of JSP .91 tags to their equivalent JSP 1.0/1.1 tags. No migration is needed between JSP 1.0 and JSP 1.1.
Table 7-1 Known JSP tag translations
JSP .91 tags <BEAN> <SERVLET> <PARAM> <REPEAT> <REPEATGROUP> <INSERT> JSP 1.0/1.1 tags <jsp:useBean> <jsp:include> <jsp:setProperty> when following <BEAN> tag <jsp:param> when following <SERVLET> tag <tsx:repeat> <tsx:repeat> <jsp:getProperty> or this <%= beanName.getMethodName(index) %> when it is within a <tsx:repeat> tag see <INSERT> <%! ... %> <%@ page language <%@ page import <%@ page contentType <%@ page extends No Equivalent JSP tag No Equivalent JSP tag <tsx:dbconnect> <tsx:userid> <tsx:passwd> <tsx:dbquery> <tsx:dbmodify> <%@ include %> No equivalent JSP tag No equivalent JSP tag No equivalent JSP tag
$( ) <SCRIPT> <%@ language <%@ import <%@ content_type <%@ extends <%@ method <%@ implements <DBCONNECT> <USERID> <PASSWD> <DBQUERY> <DBMODIFY> <!--#include <!--#config <!--#echo <!--#fsize
248
249
Where to find it
The ejbdeploy tool can be found in the /bin directory of the WebSphere 5.0 installed directory.
How to run it
There are many parameters for ejbdeploy. See the WebSphere Version 5.0 InfoCenter for a complete description of the command. The ones most pertinent to this scenario include:
Syntax: ejbdeploy inputEar workingDirectory outputEar [options] Options: -dbvendor DBTYPE Set the database vendor type, to one of: DB2UDB_V71 DB2UDB_V72 DB2UDBOS390_V6 DB2UDBOS390_V7 DB2UDBISERIES CLOUDSCAPE_V50 SQL92 SQL99 INFORMIX_V73 INFORMIX_V92 INFORMIX_V93 MSSQLSERVER_V7 MSSQLSERVER_2000 ORACLE_V8 ORACLE_V9I SYBASE_V1192 SYBASE_V1200 SYBASE_V1250 -35 Use the WebSphere 3.5 top-down mapping rules
The -dbvendor option is particular to the database type appropriate for the application. The -35 option is required for this scenario to match the same mapping rules as were used in WebSphere 3.5 version.
250
Results
-dbvendor DB2UDB_V71 Starting workbench. Creating the project. Validating [*Warning] /big3deployed(Method: processClaim(int,int,double,java.lang.String,ja va.lang.String,java.lang.String,java.lang.String,boolean), Class: big3.ejb.Proce ssClaimBean): CHKJ2400W: Deprecated use of a java.rmi.RemoteException. (EJB 1.1: 6.10.4). [*Warning] /big3deployed(Method: verifyClaim(int,int,java.lang.String,java.lang. String,java.lang.String,java.lang.String,boolean), Class: big3.ejb.ProcessClaimB ean): CHKJ2400W: Deprecated use of a java.rmi.RemoteException. (EJB 1.1: 6.10.4) . [*Warning] /big3deployed(Field: class$big3$ejb$ProcessClaimBean, Class: big3.ejb .ProcessClaimBean): CHKJ2200W: This static field should be final. (EJB 1.1: 18.1 .2) [*Warning] /big3deployed(Method: ejbCreate(big3.ejb.ClaimKey), Class: big3.ejb.C laimBean): CHKJ2406W: The method should return the primary key type ClaimKey. (E JB 1.1: 9.2.3, 9.4.2, 9.4.7.3). [*Warning] /big3deployed(Method: ejbPostCreate(big3.ejb.ClaimKey), Class: big3.e jb.ClaimBean): CHKJ2400W: Deprecated use of a java.rmi.RemoteException. (EJB 1.1 : 9.2.4). [*Warning] /big3deployed(Field: class$big3$ejb$ClaimBean, Class: big3.ejb.ClaimB ean): CHKJ2200W: This static field should be final. (EJB 1.1: 18.1.2) [*Warning] /big3deployed(Method: ejbCreate(big3.ejb.PolicyKey), Class: big3.ejb. PolicyBean): CHKJ2406W: The method should return the primary key type PolicyKey. (EJB 1.1: 9.2.3, 9.4.2, 9.4.7.3). [*Warning] /big3deployed(Method: ejbPostCreate(big3.ejb.PolicyKey), Class: big3. ejb.PolicyBean): CHKJ2400W: Deprecated use of a java.rmi.RemoteException. (EJB 1
251
Where to find it
The earconvert tool can be found in the /bin directory of the WebSphere 5.0 installed directory.
How to run it
There are two ways a user can convert their J2EE 1.2 EAR file to a J2EE 1.3 EAR file. The first way is through the command-line utility earconvert. This will take two parameters (the old EAR file name followed by the new EAR file name). Both parameters will need to be inside quotation marks to allow for path names with spaces. The second way is through the AAT. Open up the old J2EE 1.2 EAR file. From the File menu, select Convert EAR. This option will only be available if the user has opened up a J2EE 1.2 EAR file.
Results
The user can now add new 1.3 modules. After modification, the user will be prompted to save the new application. Choose either Save, SaveAs, or Exit. The old J2EE 1.2 EAR file will be kept intact.
252
Where to find it
The tool can be found in the /bin directory of the WebSphere 5.0 installed directory.
How to run it
mb2mdb inputMB.jar-ear jmsListenerConfig.xml workingDirectory outputMDB.jar/ear <options>
Where: inputMB.jar-ear is the name of the deployed WebSphere Application Server 4.0 JAR or EAR file jmsListenerConfig.xml is the name of the XML configuration file used to configure the JMS listeners. workingDirectory is the name of a new or existing directory. By default, the tool clears the working directory after it has completed. If you want to preserve the contents of the working directory, you must specify the -keep option. outputMDB.jar/ear is the name of the output JAR or EAR file for the migrated message-driven bean options Optional parameters that you can use to control the mb2mdb utility are: -keep prevents the tool from clearing out the working directory after completion. -verbose causes the tool to display informational messages about the progress of the migration and its parameters. -map listenerHome=bindingHome provides a mechanism to map between the JNDIHomeName specified for a listener in the JMS listener configuration XML file and the default binding home name specified in the inputMB.jar-ear file. If the jmsListenerConfig.xml file contains a deployed EJB home JNDI name that is different from the default binding within the inputMB.jar/ear, use this option to map between the two names. This enables you to install the output JAR or EAR file for the message-driven bean into an application server and bind the bean with a different JNDIHomeName than is specified in the bean's bindings.xmi.
253
Results
The result of this task is a new JAR or EAR file for a message-driven bean that can then be deployed directly into a WebSphere Version 5.0 application server. To successfully install the JAR or EAR file, you need to bind the message-driven bean against a listener port defined to the message listener service of the application server. You need to have used the WebSphere Administrative Console to define the listener port, which defines the JMS connection factory and destination that a message-driven bean bound to it listens on. For more information about installing and configuring a JAR or EAR file for a message-driven bean, see Deploying an enterprise application to use message-driven beans in the WebSphere Version 5.0 InfoCenter.
Where to find it
The CACT tool can be found on the WebSphere Developer Domain downloadable tools Web site at http://www-3.ibm.com/software/. Enter CACT in the search field and press Enter.
How to run it
JDK 1.2 or 1.3 must already be installed on your system before you run this tool. After downloading the tool from the WebSphere Developer Domain Web site, unzip it into a directory where you would like to run the command. You also will have to provide a value for <CACT_HOME>, the directory where you've installed CACT in the cact.bat or cact.sh file. Look for a line similar to this:
SET CACT_HOME=c:\cact
Update the cact.bat or cact.sh file with the installation directory for CACT.
254
The tool requires that the file rt.jar be in your classpath. This JAR file is shipped with JDKs and resides under the <JAVA_HOME>\jre\lib. You should verify that the file exists there. To view the help screen and the optional flags, run the tool with the -h option, for example:
cact.bat -h
This prints out usage of all the optional flags you can specify. You can invoke CACT using the verbose (-v) or debug (-d) flags for detailed output.
Results
The results of running this command is a listing of deprecated APIs and a summary. For example:
cact -jar servlet.jar Total number classes= 4 1. Load/process Class-com.mybank.cact.servlets.HttpSession 2. Load/process Class-com.mybank.cact.servlets.HttpSessionImpl 3. Load/process Class-com.mybank.cact.servlets.Request 4. Load/process Class-com.mybank.cact.servlets.RequestImpl Java API Deprecation: item add count = 9 Java API Deprecation: item count per class 7 com.mybank.cact.servlets.HttpSessionImpl 2 com.mybank.cact.servlets.RequestImpl Java API Deprecation: item count per method 1 com.mybank.cact.servlets.HttpSessionImpl 1 com.mybank.cact.servlets.HttpSessionImpl.getSecurityContext 1 com.mybank.cact.servlets.HttpSessionImpl.getSessionContext 1 com.mybank.cact.servlets.HttpSessionImpl.getValue 1 com.mybank.cact.servlets.HttpSessionImpl.getValueNames 1 com.mybank.cact.servlets.HttpSessionImpl.putValue 1 com.mybank.cact.servlets.HttpSessionImpl.removeValue 1 com.mybank.cact.servlets.RequestImpl.getRealPath 1 com.mybank.cact.servlets.RequestImpl.isRequestedSessionIdFromURL Java API Deprecation: item count per rule name 1 Method-Servlet-HttpServletRequest.isRequestedSessionIdFromURL 1 Method-Servlet-HttpSession.getSessionContext 3 Method-Servlet-HttpSession.getValue 1 Method-Servlet-HttpSession.getValueNames 1 Method-Servlet-HttpSession.putValue 1 Method-Servlet-HttpSession.removeValue 1 Method-Servlet-ServletRequest.getRealPath API Spec Rule: item add count = 0 API Spec Rule: item count per class API Spec Rule: item count per method API Spec Rule: item count per rule name
255
7.2.1 ClientUpgrade
J2EE EAR files may exist on the client or server that have client JARs contained in them that have J2EE resources within those JARs. These resources need to be updated to be WebSphere 5.0 resources. The ClientUpgrade utility can be run on these J2EE EAR files to perform this upgrade. This command is not run automatically as part of the installation process because the location of the J2EE EAR file is not in a predetermined location. The customer must run this tool against their J2EE EAR files themselves. Note that copies of client JARs are not made in the J2EE EAR file. If the J2EE EAR file needs to be used with WebSphere 4.0 as well as with WebSphere 5.0, then it is necessary to make a copy of the J2EE EAR file before using ClientUpgrade.
Where to find it
The tool can be found in the /bin directory of the WebSphere 5.0 installed directory.
How to run it
ClientUpgrade EAR_file [-clientJar client_jar ] [-traceString trace_spec [-traceFile file_name ]]
Where: EAR_file is the fully qualified path to the EAR file that contains client JAR files to process. -clientJar specifies a JAR file for processing. If not specified, the program transforms all client JAR files in the EAR file. -traceString -traceFile gathers trace information for IBM service personnel. Specify a trace_spec of "*=all=enabled" (with quotation marks) to gather all trace information.
Results
The J2EE resources in the J2EE EAR files are upgraded.
IBM WebSphere Application Server, Release 5.0 Product Upgrade client migration tool, Version 1.0
256
Copyright IBM Corp., 1997-2002 MIGR0912I: Running client JAR migration on clientapp.jar. MIGR0287I: Created configuration file C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\WSTMPCC 48727.tmp\clientapp.jar\META-INF\client-resource.xmi successfully. MIGR0223I: Adding JDBCProvider entry jdbc:provider:name to the model. MIGR0260W: JDBC Driver jdbc:provider:name has been added to the configuration but its classpath parameter may need to be updated if the database prerequisite has changed. MIGR0223I: Adding URLProvider entry url:provider:name to the model. MIGR0223I: Adding MailProvider entry Built-in Mail Provider to the model. MIGR0223I: Adding JMSProvider entry jms:provider:name to the model.
7.2.2 WASPreUpgrade
There are two tools that are shipped with the WebSphere application server runtime that are used in conjunction with each other to migrate the administration configuration from a previous version of WebSphere to WebSphere Version 5.0. The overall migration process is to back up the current configuration and necessary files, install the Version 5 product, and import the configuration from the previous version into WebSphere Version 5.0. The installation wizard can call them or you can call them manually. The WASPreUpgrade tool is used to save the configuration from the previous version of WebSphere into a backup directory. This backup directory is later used by the WASPostUpgrade tool to import this configuration into WebSphere Version 5.0. The WASPreUpgrade tool provides the status both to the screen and to log files in the backup directory. ASCII log file names start with the text WASPreUpgrade and include a date timestamp. The following files are saved in the backup directory: For Version 3.5.x bin classes deployableEJBs (Advanced Edition only) deployedEJBs (Advanced Edition only) hosts properties servlets
257
config (Version 4.0.x Advanced Single Server Edition only) installableApps installedApps installedConnectors (Version 4.x Advanced Edition only) properties
The WASPreUpgrade tool saves selected files from the Version 3.5.x and Version 4.x /bin directory. It also exports the existing application server configuration from the repository. If you are migrating Version 3.5.x or Version 4.x Advanced Edition, the administrative server of the existing environment must be running.
Where to find it
The tool can be found in the /bin directory of the WebSphere 5.0 installed directory.
How to run it
WASPreUpgrade backupDirectory currentWASDirectory [-adminNodeName administrationNodeName ] [-nameServiceHost host_name [-nameServicePort port_number ]] [-import xmiDataFile ] [-traceString trace_spec [-traceFile file_name ]]
The first two arguments are required and positional. The third argument is required and positional only when upgrading from WebSphere Application Server Version 3.5.x or Advanced Edition 4.0. Supported parameters include: backupDirectory Required name of the directory in which the WASPreUpgrade tool stores the saved configuration and files, and from which the WASPostUpgrade tool reads the configuration and files. The WASPreUpgrade tool creates this directory if it does not already exist. currentWASDirectory Required name of the installation root directory for the current Version 3.5.x or Version 4.x installation. This can be either WebSphere Application Server Standard Edition Version 3.5.x, WebSphere Application Server Advanced Edition Version 3.5.x, or any form of WebSphere Application Server Version 4.0.x. -adminNodeName The name of the node containing the administrative server for the currently installed product. The value of this argument must match the node name given in the topology tree on the Topology tab of the Administrative Console
258
for the currently installed product. The WASPreUpgrade tool calls the XMLConfig tool using this parameter. This is a required parameter only when upgrading from WebSphere Application Server Version 3.5.x or Advanced Edition 4.0. -nameServiceHost -nameServicePort When specified, the WASPreUpgrade tool passes these optional parameters to the XMLConfig tool. Use them to override the default host name and port number used by the XMLConfig tool. -import The name of the XML Metadata Interchange (XMI) configuration file to process. This is optional when upgrading from WebSphere Application Server Advanced Single Server Edition or Advanced Edition, Version 4.0 because the program uses the Version 4.0 config\server-cfg.xml file by default. When migrating from a WebSphere Application Server Advanced Edition, Version 4.0.x configuration that uses anything other than the default server-cfg.xml file, you must use the -import option along with the path to the configuration file. You also must use the -import and path option when running WASPostUpgrade, to point to the non-default xml configuration file in the directory created by WASPreUpgrade. -traceString -traceFile Optional parameters to gather trace information for IBM service personnel. Specify a trace_spec of "*=all=enabled" (with quotation marks) to gather all trace information.
Results
The backup directory is created if necessary and the required files are saved. The output of the tool is shown on the command line and saved in a uniquely named file in the backup directory.
7.2.3 WASPostUpgrade
There are two tools that are shipped with the WebSphere Application Server runtime that are used in conjunction with each other to migrate the administration configuration from a previous version of WebSphere to WebSphere Version 5.0. The overall migration process is to back up the current configuration and necessary files, install the Version 5 product, and import the configuration from the previous version into WebSphere Version 5.0. The installation wizard can call them or you can call them manually. The WASPostUpgrade tool imports the Version 3.5.x or Version 4.x configuration data. This tool uses information created by the WASPreUpgrade tool to restore the previous Version 3.5.x or Version 4.x configuration to a Version 5 installation.
259
Because the Version 5 product adheres to the J2EE programming model and Version 3.5.x does not, significant changes are required to apply the Version 3.x configuration to a Version 5.0 installation. This tool can be run multiple times with different configuration files to incrementally update the Version 5.0 configuration.
Where to find it
The tool can be found in the /bin directory of the WebSphere 5.0 installed directory.
How to run it
WASPostUpgrade backupDirectory [-import xmi_data_file] [-cellName cell_name] [-nodeName node_name] [-serverName server_name] [-webModuleAdditionalClasspath classpath] [-documentRootLimit number] [[-traceString trace_spec [-traceFile file_name]] [-substitute "key1=value1[;key2=value2;[...]]"]
The first argument is required. Supported parameters include: backupDirectory The required name of the directory in which the WASPreUpgrade tool stores the saved configuration and files, and from which the WASPostUpgrade tool reads the configuration and files. The WASPreUpgrade tool creates this directory if it does not already exist. -import An optional name of the XML Metadata Interchange (XMI) configuration file to process. Specify the WebSphere Application Server Advanced Single Server Edition 4.0 configuration file or an XML configuration data file that the XMLConfig tool created. When migrating from a WebSphere Application Server Advanced Single Server Edition Version 4.0.x configuration that uses anything other than the default server-cfg.xml file, you must use the -import option along with the path to the non-default XML configuration file in the directory created by WASPreUpgrade. If not specified, the program uses the default XML configuration file (websphere_backup.xml for Version 3.5.x, or server-cfg.xml for Version 4.0) in the backup directory. -cellName An optional parameter to specify the cell name for the program to update. If not specified, the program inspects the configuration for cell names. When one cell name exists, the program uses it. Otherwise, it returns an error.
260
-nodeName An optional parameter to specify the node name for the program to update. If not specified, the program inspects the configuration for node names. When one node name exists, the program uses it. Otherwise, it returns an error. -webModuleAdditionalClasspath An optional parameter to specify the path or the path and file names of specific directories or files that you do not want copied into the WAR file. Instead, the program adds the paths and files to the Web Module's extension (ibm-web-ext.xmi) additionalClassPath attribute. -documentRootLimit Use this optional parameter to specify the limit of the number of files that the program copies from the document-root field of web-application. It is only applicable to Version 3.5.x upgrades. If not specified, the default is 300. -traceString -traceFile Optional parameters to gather trace information for IBM service personnel. Specify a trace_spec of "*=all=enabled" (with quotation marks) to gather all trace information. -substitute An optional argument passed to the XMLConfig tool. Specify values for security variables to be substituted (for example, -substitute "NODE_NAME=admin_node;APP_SERVER=default_server"). In the input XML data file, each key should appear as $key$ for substitution. This argument substitutes any occurrence of $NODE_NAME$ with admin_node and $APP_SERVER$ with default_server in the input XML file. If the substitution string contains semicolons, use $semiColon$ to separate it from the ";" delimiter. On UNIX platforms, be sure to add an escape character to each dollar sign ($) within the substitution string (for example, \$semiColon\$). This parameter is applicable for configurations saved from Versions 3.5.x and 4.0.x Advanced Edition.
Results
The existing Version 5.0 configuration is updated with the configuration from the previous version. The existing configuration is modified and added; it is not replaced. Copies of individual Version 5.0 configuration files are made during the processing. These files can be used to restore the previous configuration if required. Analyze the WASPostUpgrade log for detailed information about the migrated configuration. The J2EE programming model specifies an architecture for how
261
applications are created and deployed. Because applications in Version 3.5.x do not have the same architecture, the WASPostUpgrade tool recreates applications. It creates all migrated Web resources and enterprise beans in J2EE EAR files. It maps all enterprise applications from the Version 3.5.x installation into J2EE EAR files with the same name, deployed in the same server.
262
Chapter 8.
263
Save the file and now execute the disk1\migation\bin\WASPreUpgrade command. 2. Uninstall WebSphere Application Server Version 3.5.x or Version 4.0.x.
264
3. Upgrade the operating system to the level required by WebSphere V5.0. 4. Install WebSphere Application Server Version 5.0. 5. Run the WASPostUpgrade command from the installed WAS_HOME/bin directory.
265
Coexistence
Planning is also required to determine whether you have an existing version of WebSphere Application Server installed on the machine where you plan to install your Version 5 product. If you have a previous version, you must plan whether to copy the configuration and applications of the previous version to the new version. Migration does not uninstall the previous version. You can still run the previous version. You must decide whether to let Version 5 coexist with the earlier version. There are four combinations of migration and coexistence that you can select: Migrate only Coexist only Migrate and coexist Neither migrate nor coexist If you neither migrate nor coexist with an earlier version of WebSphere Application Server, you are choosing to ignore the previous installation. In such a case, you can run only one version at a time. Automated migration support is part of the installation program. The installation program detects previously installed versions and presents a coexistence option. A window will be displayed during the Installation process to assist with port conflict resolution for the default server. Coexistence is described more fully in 8.4, Test and integration/production environment on page 276.
Interoperability
Interoperability provides a mechanism to run nodes in a mixed version environment. This enables incremental version upgrade because domains can be upgraded independently and still interoperate with one another, allowing domains to be migrated incrementally. The base support is provided for Version 3.5.3 and later as well as Version 4.0 and later to Version 5.0. See Figure 8-1 on page 267.
266
R3.5
R3.5 Cell A
Domain B R4.0
R4.0
R4.0 R5.0
R5.0
This includes applications that are transactional and secure. The primary applications that use these characteristics are typically either Servlets or pure Java applications driving EJBs. EJB workload balance support from Version 3.x to Version 4.0.x is provided with Version 3.5.6 and later. EJB workload balance support across domains is provided starting with V3.5.4 and later with the appropriate eFixes. Planning for hardware prerequisites (such as memory and CPU capacity) may need to be done to effectively use this support. Interoperability is described more fully in 8.4, Test and integration/production environment on page 276.
267
268
Directories stdin, stdout, and stderr; passivation directory and working directory
Because the typical location for these directories might include Version 3.5.x or Version 4.0 installation directories and the location might be different in the new Version 5.0 installation, these values are ignored.
Bootstrap port
In Versions 3.5 and 4.0, the default server port for the naming service was 900. It is changed in Version 5.0 to 2809. If the prior version was configured for a bootstrap port something other than 900, then that value for the server1 name server will be used. Otherwise it will left at the current setting (default 2809).
269
Cluster members
Cluster members will be created in the WebSphere Application Server migration but they will not be able to be run until that node is federated into a WebSphere Application Server Network Deployment cell. These servers are configured differently than stand-alone servers and must be run as part of a cluster.
Default Server
The name of the default server in Version 5.0 is server1. All objects owned by Default Server in prior versions will be mapped onto server1.
Name bindings
The naming structure has changed in Version 5.0. This makes the EJB references that were valid in previous versions no longer work in Version 5.0. However, a name binding can be added to map the old name into the new name in Version 5.0. The Administrative Console is the easiest way to create these name bindings. Use the name of the Version 3.5.x or 4.0.x EJB references as both the name of the binding and the JNDI name in the Version 5.0 name space.
Node name
A Version 3.5.x and a Version 4.x repository can contain more than one node name and its associated children. The WASPostUpgrade tool processes only those objects and children that match the node that is being migrated. This determination is made by checking the names of nodes in configuration files with node name of the machine that is being migrated.
270
PageList Servlet
The configuration of the PageList Servlet has been changed in Version 5.0. The direct use of the Servlet has been deprecated. The PageList Servlet function is still available but is configured as part of the Servlet extension configuration in the WAR file. All references will be updated to the Servlet configuration supported in Version 5.0.
Samples
Samples from previous versions are not migrated to the Version 5.0 environment. The equivalent samples from Version 5.0 should be used instead.
Security
If a was.policy file exists in the 5.0 properties directory, it will be added to J2EE EAR files as they are being migrated. This is done by the wsadmin command that is called during the migration processing. Global Security using LTPA authentication mechanisms configured in 3.5.x and 4.0.x will be migrated to WebSphere Application Server and WebSphere Application Server Network Deployment. However, if Global Security has been enabled in 3.5.x or 4.0.x, it will be disabled during migration. Before Global Security using an LTPA authentication mechanism can be enabled in V5.0, keys must be generated. To enable security using the migrated LTPA authentication mechanism in V5.0, keys can be generated using the systems Administrative Console. After the keys have been generated, Global Security can be enabled. Global Security using the local operating system authentication mechanisms configured in 3.5.x and 4.0.x will be migrated to WebSphere Application Server Network Deployment. However, if Global Security has been enabled in 3.5.x or 4.0.x, it will be disabled during migration. Since the SWAM authentication mechanism is not supported by WebSphere Application Server Network Deployment and replaces the local operating system authentication mechanism, during migration the LTPA authentication mechanism in V5.0 will be set as the active authentication mechanism. Before security can be enabled, the LTPA authentication mechanism in 5.0 must be configured using the systems Administrative Console.
271
Transport ports
All ports will be migrated. Additional warnings will be logged if the port is already defined in the configuration. The user will need to resolve the port conflicts if servers with port conflicts will need to be run at the same time.
Web modules
A change was made in the Web container behavior that was required by J2EE that involves the setting of content type. If a Servlet writer does not set the content type, it is no longer defaulted by the Web container and it is returned as null. This can cause some browsers to incorrectly display the resulting tags sent by the Web container. Migration sets the autoResponseEncoding IBM extension to TRUE for Web modules, while migrating J2EE EAR files to prevent this problem from occurring.
272
Enterprise beans
Version 3.5 supported only the EJB 1.0 components specification level. Version 5 supports EJB 1.1 components and 2.0 components. However, many EJB 1.0 beans can be successfully deployed as EJB 1.1 beans. The migration tools redeploy enterprise beans automatically as part of the application migration phase. Check the WASPostUpgrade log for details of the deployment of these enterprise beans. Make any necessary changes and redeploy if required. You should specify only one back-end datastore vendor per JAR file. If there are enterprise beans that use different back ends, package them into separate JAR files.
273
J2EE security
The security authorization model in Version 3.5.x is based on the notion of enterprise application and Method Groups. The cross product of the Version 3.5.x enterprise application and the method groups is a WebSphere permission. J2EE specifies an authorization model based on roles. To convert from the WebSphere permission model in Version 3.5.x to the role-based authorization model in Version 5.0, a one-to-one mapping from a WebSphere permission to a new role under that application is created. Therefore, for each V3.5.x enterprise application and each method group in Version 3.5.x, a role is created in Version 5.0 and is contained in the J2EE application's deployment descriptor. The authorized subjects for each role are contained in an authorization table found in the J2EE application's binding. J2EE specifies an authorization model based on roles. WebSphere interprets the role to mean a set of permissions to access a resource. In the case of an EJB method invocation, the permission to access the method on a particular bean is specified by a method permission. This method permission is associated with one or more roles in the deployment descriptor in the bean JAR file. In the case of accessing Web resources, the permission to access a Web URI and invoke a HTTP method on that URI is specified in terms of Web resource collections and security constraints in J2EE. The security constraints and Web resource collections can be found in the deployment descriptor of the Web application's WAR file.
JSP levels
Version 5.0 runs JSP 1.0 and 1.1 objects as JSP 1.2, which is its sole supported JSP level.
Servlet Redirector
Version 5 does not support Servlet Redirector. The migration tools ignore these objects.
Servlet package name changes when migrating from Version 3.5.x to Version 5
If the 3.5.x configuration defines the SimpleFileServlet, the Servlet is not migrated. The migration tools set, the FileServingEnabled attribute to TRUE in the Web module ibm-web-ext.xmi file. If the 3.5.x configuration defines the InvokerServlet, the Servlet is not migrated. The migration tools set the ServeServletsByClassnameEnabled attribute to TRUE in the Web module ibm-web-ext.xml file.
274
If the 3.5.x configuration defines the DefaultErrorReporter Servlet, the Servlet is migrated into the Web module web.xml file. Migration uses the new package to set the class name.
Transports
The default transport type of the Servlet Engine in Version 3.5.x is Open Servlet Engine (OSE). Because Version 5.0 no longer supports OSE transport, the migration tools map these transports to HTTP transports, using the same port assignments. You must manually add VirtualHost alias entries for each port.
Mapping details
The following sections describe the mapping between WebSphere V4.0 and V5.0.
Enterprise beans
No redeployment is required when moving EJB 1.1 JARs from Version 4.0. You should specify only one back-end datastore vendor per JAR file. If there are enterprise beans that use different back ends, package them into separate JAR files.
JSP precompiling
In Version 4.0.x, the classes generated from JSPs are in a package based on the directory structure of the WAR. Any JSP at the top of the context root is in the unnamed package, and JSPs in subdirectories of the root are in packages named after the subdirectories. In Version 5.0, the classes generated from JSPs are all in the package org.apache.jsp. Therefore, the class files are not compatible between versions.
275
When migrating an J2EE EAR file from 4.0.x to 5.0, the JSPs need to be recompiled so that the class files are regenerated into the correct packages. The migration tools provide this support by using the -preCompileJSPs option of wsadmin tool during the installation of the J2EE EAR file. Any Version 4.0.x J2EE EAR file being moved manually to Version 5.0 will need to be installed using the same option.
J2EE security
There are two locations in Version 4.0.x that security can be applied to J2EE EAR files. Any information that was applied in the repository has precedence over information stored in the J2EE EAR file bindings. The information in the repository is migrated to the J2EE EAR file during the migration processing.
Servlet package name changes when migrating from Version 4.0 to Version 5
If the Version 4.0 Web module web.xml file defines the SimpleFileServlet, the migration tools update the class name to reflect the Version 5.0 package. The tools also set the FileServingEnabled attribute to TRUE. If the Version 4.0.x Web module web.xml file defines the InvokerServlet, the migration tools update the class name to reflect the Version 5.0 package. The tools also set the ServeServletsByClassnameEnabled attribute to TRUE. If the Version 4.0.x Web module web.xml file defines the DefaultErrorReporter, the migration tools update the class name to reflect the Version 5.0 package.
276
8.4.1 Coexistence
Coexistence, as it applies to WebSphere Application Server products, is the ability of multiple installations of WebSphere Application Server to run on the same machine at the same time. Multiple installations include multiple versions and multiple instances of one version. Coexistence also implies various combinations of Web server interaction. Version 5.0 WebSphere Application Server products can coexist with supported, previous versions. See Table 8-1. The Installation wizard looks for these existing installations to determine if it should prompt you for coexistence information.
Table 8-1 Supported coexistence configurations for WebSphere Application Servers
Installed product IBM WebSphere Application Server V5 Supported IBM WebSphere Application Server Network Deployment V5 Supported
IBM WebSphere Application Server Standard Edition, Version 3.5.5 and up IBM WebSphere Application Server Advanced Edition, Version 3.5.5 and up IBM WebSphere Application Server Advanced Single Server Edition, Version 4.0.x and up IBM WebSphere Application Server Advanced Edition, Version 4.0.1 and up IBM WebSphere Application Server Enterprise Edition, Version 4.0.1 and up
Supported
Supported
Supported
Supported
Supported
Supported
Supported
Supported
In addition to multi-version coexistence, WebSphere Application Server also allows multiple Version 5 instantiations on one machine. WebSphere Application
277
Server also provides Web server options when there are coexisting application servers on a machine: Single Web server for coexisting, multi-version application servers on one machine Single Web server for multiple instances of IBM WebSphere Application Server, Version 5 Separate Web servers for each application server instance, when running multiple instances of IBM WebSphere Application Server, Version 5.0
8.4.2 Interoperability
WebSphere Application Server, Version 5 is generally interoperable with WebSphere Application Server Versions 3.5.x and 4.0.x. However, there are specific requirements you should address for each version. Make the following changes to allow interoperability between versions. The most important factor to understand for EJB interoperability is the EJB interoperability that is supported for the same EJB object implemented at different EJB specification levels across different WebSphere versions: The EJB 1.1 bean will interoperate with the EJB 1.0 bean The EJB 1.1 bean will interoperate with the EJB 1.1 bean The EJB 1.1 bean will not interoperate with the EJB 2.0 bean in all cases The EJB 1.1 specification guarantees interoperability with EJB 1.0. However, the EJB 2.0 specification does not have a similar guarantee with EJB 1.1. There are a few changes in the EJB 2.0 specification that are worth understanding for the interoperability scenarios: Attributes are no longer public on CMP beans and they are encapsulated by getter and setter methods Additional Home methods can be specified Finder methods return Collections instead of just Enumerations Local interfaces are supported Given these changes, there are two ways to provide interoperability between EJB 1.1 and EJB 2.0 beans: Interoperability between different EJB 1.1 and EJB 2.0 versions of the same EJB bean can be achieved if the EJB 2.0 version of the bean is remotable and the interface is a pure superset of the EJB 1.1 version of the bean. This can be done by applying the EJB 2.0 requirement of hiding of attributes via getters and setters to the EJB 1.1 version of the bean. The EJB 2.0 version of the bean can provide more interfaces, such as new Home interfaces, but as
278
long as it supports all the interfaces of the EJB 1.1 version of the bean it should work. The other factors noted above are all pure superset behavior and are not a factor. Alternatively you can use different EJB 1.1 and EJB 2.0 beans to interoperate: Develop a new EJB 2.0 bean with remotable interfaces and export the client-side bindings Then take those bindings to a Version 4.0 machine Use those bindings in an EJB 1.1 client using a different bean altogether This means that in order for EJB interoperability to work on Version 5.0 with earlier WebSphere versions, the J2EE EAR files that are installed can be either J2EE 1.2 EAR files or J2EE 1.3 EAR files.
eFixes
Table 8-2 eFixes to apply to Version 3.5.x
eFix PQ51387 PQ60074 PQ60335 PQ63548 Apply Apply Version 3.5.3 Apply Apply Version 3.5.4 Apply Apply Apply Apply Apply Apply Apply Version 3.5.5 Version 3.5.6
All eFixes are available on the IBM WebSphere Application Server Support page. PQ51387: A naming client eFix that allows a Version 3.5.x naming client to access the Version 5 name server. PQ60074: An Object Request Broker (ORB) eFix that allows a Version 5 naming client to access the Version 3.5.x or 4.0.x name server.
279
PQ60335: An ORB eFix to reconcile java.math.BigDecimal and other class differences in IBM Software Development Kits 122 and 131. Note: This does not apply to IBM Software Development Kits on the Solaris operating system. PQ60336: An ORB eFix to reconcile java.math.BigDecimal and other class differences in IBM Software Development Kits 130 and 131. Note: This does not apply to IBM Software Development Kits on the Solaris operating system. PQ63548: An eFix to correct problems that might occur when passing embedded valueTypes between WebSphere releases. The best solution is to upgrade all your installations to the latest release and PTF levels, such as Versions 3.5.7 or 4.04, which do not require this fix. If this is not possible, apply the eFix to your version. Symptoms include org.omg.CORBA.MARSHAL exceptions when passing embedded valueTypes across the versions. Sometimes, other symptoms might mask org.omg.CORBA.MARSHAL exceptions, which makes them difficult to identify. If symptoms reoccur in spite of the eFix, re-export existing IORs.
Guidelines
Also follow these guidelines:
Guideline 1 2 3 4 5 6 Version 3.5.x Apply Apply Apply Apply Apply Apply Apply Apply Apply Version 4.0.x
Guideline 1: When interoperating at the naming level, always use the context of the lowest common denominator. For example, always use the 3.5.x context com.ibm.ejs.ns.jndi.CNInitialContextFactory when a client or server is at 3.5.x. For later versions, use the current com.ibm.websphere.naming.WsnInitialContextFactory context. Guideline 2: Update the namebindings.xml file if you have not used the Version 5.0 migration tools, but have installed Version 3.5.x or 4.0.x applications on Version 5. To allow Version 3.5.x or 4.0.x clients to access the applications, add additional information to the bind information in the Version
280
5.0 name space. Add the information to the namebindings.xml configuration file at the cell level. For Version 4.0x clients you can use java:/comp to find 5.0 EJBs but Version 3.5.x clients cannot. Guideline 3: Ensure that programs that perform a JNDI lookup of the UserTransaction interface use an InitialContext that resolves to a local implementation of the interface. Also ensure that such programs use a JNDI location appropriate for the EJB version. Prior to the EJB 1.1 specification, the JNDI location of the UserTransaction interface was not specified. Earlier versions up to and including Version 3.5.x do not use the EJB 1.1 specification. They bind the UserTransaction interface to a JNDI location of jta/usertransaction. Version 4.0.x and later releases bind the UserTransaction interface at the location defined by EJB 1.1, which is java:comp/UserTransaction. Version 5.0.x no longer provides the earlier jta/usertransaction binding within Web and EJB containers to applications at a J2EE level of 1.3 or later, to enforce use of the newer UserTransaction interface. For example, EJB 2.0 applications can use only the java:comp/UserTransaction location. Guideline 4: Be aware of limitations when calling WorkLoad Management (WLM)-enabled Enterprise beans. Some clients cannot call WLM-enabled EJBs on remote clusters, when there is a local WLM-enabled EJB of the same name. If there is a cluster local to the client with the same EJB as the remote cluster that the client is trying to call, the client ends up talking to the local cluster. The following table lists supported combinations of clients calling WLM-enabled EJBs on remote application servers.
All clients 3.5.6 4.02, 4.03 5 5 Server 5 5 3.5.x 4.02, 4.03 Supported Yes Yes No Yes
Guideline 5: Be aware of Administrative Console limitations. You cannot use the administrative interfaces for Version 5.0 to administer a Version 3.5.x or 4.0.x administrative server. Likewise, you cannot use a Version 3.5.x or Version 4.0.x Administrative Console to administer a Version 5.0 environment. If you use the Administrative Console on a remote machine to administer Version 3.5.x or 4.0.x WebSphere domains, migrating any of the nodes or domains to Version 5.0 renders the remote administration console ineffective for administering any Version 5.0 environment.
281
Guideline 6: For security connections, you must use SSLv3 when interoperating with 3.5.x. CSIv2 cannot be used, because 3.5.x/4.0.x does not support that option. This information is dynamic and might be augmented by information in technical articles that are available on the WebSphere Developer Domain. Be sure to check the site for the latest information. There is also more information in the InfoCenter regarding details of EJB container interoperability that should be reviewed for some scenarios.
282
Migrating WebSphere Application Server Advanced Edition to IBM WebSphere Application Server Network Deployment, Version 5 requires migrating all nodes in the collection to IBM WebSphere Application Server, Version 5. Your current configuration from a previously installed version contains one or more node configurations, one for each node in the repository. You have a choice. You can either install Network Deployment in one of two ways: On one of the nodes where you are installing and migrating applications to IBM WebSphere Application Server, Version 5. This maps the single domain with multiple nodes to a single Version 5 cell with the same number of nodes. Network Deployment is on one of the nodes. This provides a configuration that is equivalent to the previously installed version. On an additional machine that does not have IBM WebSphere Application Server, Version 5. This maps the single domain with multiple nodes to a single Version 5 cell with the same number of nodes, but with Network Deployment on an additional node. You can vary the order in which you migrate these nodes. This task describes the most direct method. 1. Perform a typical or custom IBM WebSphere Application Server, Version 5 installation on all nodes in the repository. 2. Migrate each node to IBM WebSphere Application Server, Version 5. You must migrate each IBM WebSphere Application Server, Version 5 node you intend to add to the Network Deployment configuration. 3. Install Network Deployment. a. If you install Network Deployment on an IBM WebSphere Application Server, Version 5 node that you migrated: i. If the previous version is still installed and running, select the migration option during the installation. ii. If the previous version is no longer installed, perform a manual migration against the WASPreUpgrade backup directory on this or another node migrated from the previous domain. Issue this command from the bin directory of the ND_install_root. b. If you install Network Deployment on a machine that did not have an earlier version of WebSphere Application Server, perform a manual migration against the WASPreUpgrade backup directory on another node that you migrated from the previous domain. Issue this command from the bin directory of the ND_install_root 4. Start the Deployment Manager on the Network Deployment node.
283
5. On the system that has Network Deployment installed, use the Administrative Console to add each IBM WebSphere Application Server, Version 5 node to the Network Deployment configuration. Use the Network Deployment Administrative Console to add each node to the Network Deployment cell. Install any clustered applications on the appropriate cluster, using either the Administrative Console or the wsadmin command. The deployment manager automatically propagates J2EE EAR files to application server nodes in the cluster. After federating an IBM WebSphere Application Server, Version 5 node into the Network Deployment cell, the configuration repository for the cell contains the master copy of the node configuration. From that point on, the deployment manager maintains the permanent configuration for each node in the cell. Changes you make with the Network Deployment Administrative Console update the configuration files stored in the master repository for the Network Deployment cell. You should not make configuration changes on an IBM WebSphere Application Server, Version 5 node directly, because such changes will be overwritten the next time the node configuration is synchronized with the master configuration for the cell.
284
285
286
Chapter 9.
287
9.1 Migrating from WebSphere 3.5 Development Environment to WebSphere Studio 5.0
The IBM development toolset for WebSphere 3.5 is composed of VisualAge for Java and WebSphere Studio Classic. It is possible to develop java applications exclusively in VisualAge for Java, Web applications exclusively in WebSphere Studio Classic, and more complex applications using both tools. The WebSphere Test Environment for WebSphere 3.5 is hosted in VisualAge for Java Enterprise Edition. The development tool for WebSphere 5.0, WebSphere Studio Application Developer 5.0, is not a direct upgrade to either VisualAge for Java or WebSphere Studio Classic. It can be installed on the same machine as the existing development tools without removing the older tools.
Migration steps
Follow these steps to migrate the sample from VisualAge for Java to WebSphere Studio Application Developer: 1. Export your files from VisualAge for Java: a. Open VisualAge for Java. b. Select the IBM JSP Examples project. c. Right-click the project and select Export. Select the Directory radio button and click Next. d. Type the name of the directory you want to export the files to. e. Clear the .class check box. You do not need to export these files, because you will rebuild the project in WebSphere Studio Application Developer and re-create these files. f. Select the .java check box and click Details. Select only the LeapYear files and click OK. g. Select the Resource check box and click Details. h. Select LeapYearInput.html and LeapYearResults.jsp, which are located in the directory IBM WebSphere Test Environment\hosts\default_host\default_app\web\JSP\sample3.
288
i. Click OK. j. Clear the Create Manifest file check box (you do not need to create a manifest file). k. Click Finish. l. Close VisualAge for Java. 2. Create a new WebSphere Studio Application Developer Web project: a. Start WebSphere Studio Application Developer. b. Create a new Web project called LeapYear (click File -> New -> Project -> Web -> WebProject). c. Ensure that J2EE Web project is selected, and then click Next. d. Select New. e. Change the Enterprise Application project name to LeapYearEAR and select J2EE level 1.2. You could put the Web project into any existing Enterprise Application (EAR) project, but for this example, you will put it in LeapYearEAR. f. Leave LeapYearEAR in the Context root field. g. Click Finish. 3. Import the Java and project resource files into the WebSphere Studio Application Developer project: Import the Java source files into the LeapYear project source directory by following these steps: a. In the Web perspective, expand LeapYear and select the Java source directory. b. Click File -> Import -> File system and click Next. Browse to the directory you exported your files to and click OK. c. You only want to import the Java source files into the Java source directory, so, in the Import window, expand your export directory and select only the com subdirectory (it contains the three Java source files). d. Windows: Click Finish. This creates LeapYear\Java source\com\ibm\ivj\wte\samples\leapyear\LeapYearXXXX.java files. Java files are automatically compiled into LeapYear\webContent\WEB-INF\classes. e. Linux: Click Finish. This creates LeapYear/source/com/ibm/ivj/wte/samples/leapyear/LeapYearXXXX.java files. Java files are automatically compiled into LeapYear/webContent/WEB-INF/classes.
289
4. Import the resource files into the LeapYear project under the webContent directory by following these steps: a. In the current Web perspective, expand the LeapYear project and select the webContent directory. b. Select File -> Import -> File system and click Next. Browse to the directory you exported your files to, expand your export directory to the sample3 subdirectory, then click OK. c. You only want to import the resource files into the webContent directory, so, in the Import window, select the sample3 subdirectory, which contains the .jsp and .html files. d. Click Finish. The files are imported into the webContent directory. 5. Define any Servlets and make any restructured application changes: a. You now need to create a Servlet. Select the LeapYear project and expand it (click Leap Year -> webContent -> WEB-INF) to the web.xml file. Open the web.xml file. b. Click the Servlets tab at the bottom of the page. c. Click Add. d. Ensure that the Servlet radio button is selected. e. Select the class LeapYear, then click OK. f. Select URL Mapping -> Add, then type LeapYear. g. Save the changes (click File -> Save web.xml) and close the web.xml file. 6. You now need to make any application changes due to the slightly changed source/application structure: a. There will be two errors listed in the Tasks view. One is in LeapYearInput.html and one is in LeapYearResults.jsp. b. Open the LeapYearResults.jsp file. Replace /JSP/index.html with LeapYearInput.html. c. Open the LeapYearInput.html file. Replace /servlet/com.ibm.ivj.wte.samples.leapyear.LeapYear with LeapYear. d. Save your changes and close the LeapYearResults.jsp and LeapYearInput.html files. e. To avoid a runtime error, open the LeapYear.java file, which is located in the following subdirectory: Windows: source\com\ibm\ivj\wte\samples\leapyear Linux: source/com/ibm/ivj/wte/samples/leapyear
290
f. Go to line 119 and change getRequestDispatcher from /JSP/Sample3/LeapYearResults.jsp to LeapYearResults.jsp g. Save your changes and close LeapYear.java. At this point the sample has been migrated into WebSphere Studio Application Developer. All that remains is to create a WebSphere Studio Application Developer server project and test the sample in the WebSphere Test Environment. 7. Create a WebSphere Studio Application Developer server project: a. Click File -> New -> Project -> Server -> Server Project. Click Next. In the Project name field, type newServer and click Finish. You will automatically be switched to the Server perspective. b. Right-click newServer and click New -> Server Instance and Configuration. c. In the Server name field, type WSTestEnv. In the Server instance type field, select WebSphere V4.0 Test Environment. Click Finish. Now, you need to specify your EAR project to the server configuration: a. In the Server Configuration view, click Server Configurations -> WSTestEnv. b. Right-click it and click Add project -> LeapYearEAR. 8. Test the migrated LeapYear application: a. Select the LeapYearInput.html file. b. Right-click the HTML file, and from its pop-up menu, click Run on Server and select WSTestEnv. c. Wait while the server starts. Click the Console tab in the Servers view and watch the Console until the message Server Default Server open for e-business appears. d. When a browser opens, type 2001 in the Start Year field, then click Submit. e. The Console view shows the message LeapYear:init. Wait until you see the list of leap years, then select WSTestEnv in the Servers view. Right-click it and click Stop.
291
9.1.2 Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean)
You will work with two EJB Development samples: Hello World and Increment. To access these samples open the online help, and select Samples -> EJB Development. You must work with VisualAge for Java Version 4.0 for this example. You do not have to migrate these samples together. If you are not currently working with DB2, you may not wish to migrate Increment. In this case, you can ignore any steps that apply to the Increment sample only. Before you begin: Be sure the application runs in VisualAge for Java (that is, the DB2 setup for the Increment sample is complete). Be sure to stop the VisualAge for Java WebSphere Test Environment EJB server and Persistent Name Server (so they will not conflict with WebSphere Studio Application Developer).
Migration steps
Follow these steps to migrate the samples from VisualAge for Java to WebSphere Studio Application Developer: 1. Export the client Java source from VisualAge for Java: a. Start VisualAge for Java Version 4.0. b. Select the IBM EJB Samples project c. Right-click the project and click Export. d. Select the Directory radio button and click Next. e. Type the name of the directory you want to export your files to. f. Clear the .class check box. (You will rebuild the .class files in WebSphere Studio Application Developer to ensure that you have successfully migrated the samples.) g. Select the .java check box. Click Details and clear the IBM EJB Samples check box. h. Select the HelloClient and IncrementClient check boxes and click OK. i. Clear the .resource check box (unless you want the DB2 .clp setup scripts). j. Click Finish.
292
2. Export the EJB group from VisualAge for Java into an EJB 1.1 JAR: a. Open the map browser to load the map for IBM EJB samples. b. Click the EJB tab. In the Enterprise Beans pane, right-click IBMEJBSamples and click Export -> EJB 1.1 JAR. c. Select a directory to export your JAR file to. d. In the JAR file field, type the name of the JAR file you want to create. e. In the Select a target database list, select DB2 for NT, V7.1. f. Select the .class check box. (You will rebuild the files in WebSphere Studio Application Developer as a verification of the migration, but this must be selected in order to proceed.) g. Select the .java check box. (You need the four HelloWorld and the five Increment EJB files.) h. Click Finish. i. If you were running the samples, then stop the VisualAge for Java Persistent Name Server, EJB server, and WebSphere Test Environment. j. (Optional) Exit VisualAge for Java. 3. Create a new WebSphere Studio Application Developer EJB project: Note: This section is optional. If you do not have an EJB and EAR project, they will automatically be created when you import the EJB 1.1 JAR file. a. Start WebSphere Studio Application Developer. b. Create a new EJB project (click File -> New -> Project -> EJB -> EJB Project -> Create 1.1 -> Next). c. In the Project name field, type EJBSamples. d. Select EAR new. e. In the EAR project name field, type EJBSamplesEAR. Click Finish. You could put this EJB project into any existing Enterprise Application (EAR) project you currently have, but for this example, create a new EAR project called EJBSamplesEAR. f. The new projects are created and appear in the J2EE perspective. 4. Import the EJB 1.1 JAR file into WebSphere Studio Application Developer EJB project: a. Click File -> Import -> EJB JAR file. Click Next. b. In the EJB JAR file field, browse for the location of the EJB 1.1 JAR you created. c. In the EJB Project field, select EJBSamples.
293
d. In the Enterprise Application project name field, select EJBSamplesEAR. Click Finish. e. You will receive four or five EJB 1.1 warnings. You can ignore them. 5. Generate and deploy RMIC stub and tie code: a. In the J2EE perspective, expand the EJB Modules folder, and select IBMEJBSamples. b. Right-click it and click Generate -> RMIC and Deploy Code. c. Select the Hello World and Increment beans. Click Finish. 6. Specify the data source binding information: a. In the J2EE Perspective, expand EJB Modules and select IBMEJBSamples. b. Right-click the module and select Open With -> EJB Deployment Descriptor. c. In the EJB deployment descriptor, click the Overview tab. d. Select IBMEJBSamples, and type jdbc/sampledb in the DataSource JNDI name field. e. If necessary, type a default user ID and password. f. Close the EJB deployment descriptor (you will prompted to save your changes). 7. Create a new WebSphere Studio Application Developer project: a. Create a new Java project (click File -> New -> Project -> Java -> Java Project). b. In the Project name field, type EJBClients. Click Next. c. Click the Projects tab. Select the EJBSamples check box. d. Click Finish. 8. Import the Java code into a Java project: a. In the Java perspective, open the Navigator view (click Window -> Show view -> Navigator). b. In the Navigator view, click the EJBClients project. c. Select File -> Import -> File system and click Next. Browse to the directory that you exported your client code to. d. Expand your export directory and find your files (they will be in a subdirectory under com). Select the folders that contain your HelloClient and Increment Client files. e. Click Finish.
294
f. There will be two errors in the Tasks view (if you did not add the EJBSamples project to the class path, you will have several errors). One occurs because references to javax.ejb.CreateException, which can be found in j2ee.jar, exist. The other occurs because of a reference to com.ibm.ivj.ejb.runtime.AbstractSessionAccessBean, which can be found in ivjejb35.jar. g. Select EJBClients and right-click it. Click Properties -> Java Build Path. h. If you did not link to the EJBSamples project, select the Projects tab and select the EJBSamples check box. There should now only be two errors left. i. Click the Libraries tab and click Add External JARs. j. Windows: Browse to the WS_Installdir\aes_v4\lib directory, where WS_Installdir is your product installation directory. Linux: Browse to the /opt/wsappdev/plugins/com.ibm.etools.websphere.runtime/lib directory. k. Select the j2ee.jar file. Click Open, and then click Add External JARs. l. Windows: Browse to the WS_Installdir\aes_v4\lib directory. Linux: Browse to the /opt/wsappdev/plugins/com.ibm.etools.websphere.runtime/lib directory. m. Select the ivjejb35.jar file. Click Open, then click OK. n. There should now be no errors in the Tasks view, except the EJB 1.1 warnings. At this point, the samples have now been migrated into WebSphere Studio Application Developer. All that remains is to test them in the WebSphere Test Environment. 9. Create a WebSphere Studio Application Developer server project: a. Click File -> New -> Project -> Server -> Server Project and click Next. In the Project name field, type EJBServer and click Finish. b. The Server perspective will automatically open. In the Navigator view, select EJBServer and right-click it. c. Click New -> Server Instance and Configuration. d. In the Server name field, type MyEJBServer. In the Server instance type field, click WebSphere V4.0 Test Environment, and then click Finish. 10.Specify your data source, your EAR project, and then start the server: a. In the Server Configuration view, expand Server Configurations and select MyEJBServer. b. Right-click it, and from your pop-up menu, click Open.
295
c. Click the Data source tab. d. In the JDBC Driver List, select the Db2JdbcDriver and click Edit. e. Verify that the Class path field contains the correct path to db2java.zip. Click OK. f. Select your JDBC driver, and click the Add button to the right of the Data source field. g. In the Add a data source window, type EJB Sampledb in the Name field. In the JNDI name field, type jdbc/sampledb. h. In the Database name field, type sampledb. Click OK. i. Save your changes and close the server configuration editor. 11.Now, you need to specify your EAR project to the server configuration and start the server: a. In the Server Configuration view, click Server Configurations -> MyEJBServer. b. Right-click it and click Add project -> EJBSamplesEAR. c. In the Server view, right-click MyEJBServer, then click Start. 12.Start DB2 and connecting to sampleDB: Note: DB2 must be running with the sampleDB created and available (as per the VisualAge for Java sample). This is applicable only if you are migrating the Increment sample. Optional: You can perform the following steps to verify your DB2 setup: a. Switch to the Data perspective. b. In the DB Servers view, right-click and select New Connection. c. In the Connection Name field, type sampleDB connection d. In the Database field, type SAMPLEDB. e. In the JDBC Driver field, select IBM DB2 App Driver. f. In the Class Location field, specify the location of the db2java.zip file. g. Click Finish. h. If necessary, type a default user ID and password. i. In the DB Servers view, expand sampleDB conn to ensure that the Tables subdirectory contains MYHOST.INCREMENTS. 13.Test the migrated HelloWorld client: a. In the Java perspective, select the EJBClients project. b. Click the Run button and select Run -> Java application.
296
c. Click New to create new configuration file. d. In the main class, select HelloClient. e. On the JRE tab, select WebSphere Application Server V4 JRE and then select Run. f. In the client window Input field, type XX YY and click Send. g. The value of the Output field becomes XX YY. Close the window to terminate the client. You have successfully migrated and tested the HelloWorld sample. 14.Test the migrated Increment client: a. In the Java perspective, select the EJBClients project. b. Click the Run button and select Run -> Java application. c. In the main class, select IncrementClient. d. On the JRE tab, select WebSphere Application Server V4 JRE and then select Run. e. The Console view contains the following content:
Obtaining initial context., Looking up Increment enterprise bean., Obtaining IncrementHome object., Looking for increment object named: TEST, Object named: TEST has count: 0, Now, object named: TEST has count: 1, Now, object named: TEST has count: 2, Now, object named: TEST has count: 3 Now, object named: TEST has count: 4, Now, object named: TEST has count: 5
15.Test the migrated Increment and HelloWorld EJBs using the EJB Test Client: a. In the J2EE Hierarchy view of the J2EE perspective, expand the EJB Modules folder, right-click IBMEJBSamples, select Run on server, and then select MyEJBServer. The EJB Test Client will start running. b. In the JNDI Explorer page, click HelloWorld to test the HelloWorld EJB. c. Windows: In JNDI Explorer, expand com\ibm\ivj\ejb\samples\increment and then click Increment to test the Increment EJB. Linux: Expand com/ibm/ivj/ejb/samples/increment and click Increment to test the Increment EJB. You have successfully migrated and tested the Increment and HelloWorld samples. d. In the Servers view of the Server perspective, select MyEJBServer, right-click it and click Stop.
297
9.1.3 Example: WebSphere Studio Classic Version 4.0 Web application (YourCo)
You must work with WebSphere Studio Classic Version 4.0.x for this example. The sample you are going to work with is the YourCo sample. To access this sample open the online help (click Help -> WebSphere Studio 4.0 -> How to -> Work with the samples -> Overview). To load this sample, follow the instructions in the online help under Opening the Studio Samples (for WebSphere Studio Classic V4.0) and load YourCo.war. Note: The migrated application will execute in WebSphere Studio Application Developer, but WebSphere Studio Application Developer does not currently provide all the Web page design and development features of WebSphere Studio, Professional or Advanced Editions. Before you begin: Ensure that the YourCo sample application is loaded in WebSphere Studio Classic. Stop any instances of the WebSphere Application Server (so it will not conflict with WebSphere Studio Application Developer).
Migration steps
To migrate this sample from WebSphere Studio Classic to WebSphere Studio Application Developer, follow these steps. 1. Start WebSphere Studio Classic Version 4.0 and create a new Migration stage: This step is optional. Normally, you would create a new stage for a migration, but for the purposes of this example, you use the Test stage included with WebSphere Studio Classic. Using the Test stage will save you from having to manually edit many Servlet mappings in step h on page 300. For information on how to create a new stage for migration, refer to 3.5, Migrating from WebSphere Studio Classic to WebSphere Studio Application Developer on page 96. 2. Create a Web configuration descriptor file: a. In the project file view, click Project -> Create Web Configuration Descriptor File, and accept the default value WEB-INF\localhost_web.xml. b. Select all required Servlets (any files that are not named xxxxBean). There are no Tag Library Descriptor (TLD) files for this sample.
298
c. Click Create. 3. Create a migration file: a. While in the project file view, select server localhost and click Properties -> Publishing -> WebApp Web Path and type a Web path (context root) newStudioSample. (Setting a Web path will remain the recommended approach in the final WebSphere Studio Application Developer product). b. While in the project file view, select Project -> Create Migration file. c. Verify that localhost is the selected server. d. Verify that localhost_web.xml is the selected Web configuration descriptor file. e. Click OK. f. The default JAR file name is X:\Studio40\projects\YourCo\localhost.jar, where X is your WebSphere Studio "Classic" installation directory. g. Click Save. h. Close WebSphere Studio "Classic". i. Rename the localhost.jar file to localhost.war. 4. Start WebSphere Studio Application Developer and import the WAR file: a. Start WebSphere Studio Application Developer. b. Click File -> Import -> WAR file -> Next. Note: You must import the JAR file using the WAR file option; otherwise it will not work properly. c. Type the path to localhost.war in the WAR File field or click Browse to search for it. d. In the Web Project field, select New, and then type newStudioSample. e. In the EAR project name field, select New, and then type newStudioSampleEAR. f. Click Finish. WebSphere Studio Application Developer will unpack localhost.war. g. You will have many unresolved references or missing import files. They will appear in the Task view: com.ibm.db requires databeans.jar com.ibm.webtools.runtime requires webtlsrn.jar com.ibm.ejs.ns.jndi requires ns.jar com.ibm.webshpere.advanced.cm.factory requires cm.jar com.ibm.ejs.models.base.extensions.webappext.ServletExtensions requires ws-base-extensions.jar
299
To fix this, you must modify the Java build path for the Web project: i. Right-click the project and click Properties -> Java Build Path. ii. Click the Libraries tab. Click Add External JARs. iii. Import the following JAR files: databeans.jar, webtlsrn.jar, ns.jar, cm.jar, and ws-base-extensions.jar from the MyInstall\runtimes\aes_v4\lib directory. iv. Twenty-four warnings will remain. You do not need to deal with them. h. Right-click the newStudioSample project and click Rebuild Project. 5. Create a WebSphere Studio Application Developer server project: At this point the sample has been migrated into WebSphere Studio Application Developer. All that remains is to create a WebSphere Studio Application Developer Server project and test the sample in the WebSphere Test Environment. a. Switch to the Server perspective. b. Click File -> New -> Project -> Server -> Server Project. Click Next. In the Project name field, type newServer and click Finish. c. In the Navigator view, right-click newServer and click New -> Server and Server Configuration. d. In the Server name field, type WSTestEnv. In the Server instance type field, select WebSphere V4.0 Test Environment. Click Finish. e. (Optional) Right-click newStudioSample project, select Properties -> Server Preference -> Always run on the following server, select WSTestEnv, then click Apply -> OK. (This step is only necessary if you have other servers.) 6. Now, you need to specify your EAR project to the server configuration: a. In the Server Configuration view, click Server Configurations -> WSTestEnv. b. Right-click it and click Add -> newStudioSampleEAR. 7. Test the migrated YourCo application: a. Select the YourCoIntro.html file, which is located in the webContent\StudioSamples\YourCo directory in your newStudioSample project. b. Right-click YourCoIntro.html, and from its pop-up menu, click Run on Server, and then select WSTestEnv. c. Wait while the server starts. Click the Console tab in the Servers view and watch the Console until the message Server Default Server open for e-business appears.
300
d. If you have not already run this sample in WebSphere Studio Classic, then you need to configure the database by clicking Database Configuration. e. When a browser opens, scroll down and click Run This Sample. f. Wait until the Welcome window appears, then click Employee Center. Note: The first time you run this application, you will receive the following errors in the Console page: DataSource not found. Try to construct a new datasource name: jdbc/yourco DataSource not found. Try to construct a new datasource name: jdbc/studio. These errors are self-correcting. You can ignore them. g. When you are done, close the browser window and the Web Browser view, then in the Server Control Panel right-click WSTestEnv and click Stop. h. (Optional) Close WebSphere Studio Application Developer.
9.1.4 Example: Migrating VisualAge for Java JSP/Servlet samples example to EJB 2.0
This example migrates the VisualAge for Java JSP/Servlet samples example (see 9.1.1, Example: VisualAge for Java JSP/Servlet sample (LeapYear) on page 288) from EJB 1.x to EJB 2.0. Note that this example requires that you have completed the migration steps in 9.1.2, Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean) on page 292 and that you have DB2 set up and running for that sample.
Migration steps
1. Create a new EJB 2.0 project and Enterprise Application 1.3 project: a. Select File -> New -> EJB Project -> Create EJB 2.0 project, and then click Next. b. In the EJB Project Name field, type ejbSamplesV2. c. Select the new EAR project. d. In the EAR Project Name field, type ejbSamplesV2EAR, and then click Finish. 2. Import the VisualAge for Java EJB 1.1 JAR into EJB 2.0 project: Import the VisualAge for Java EJB 1.1 JAR file in 9.1.2, Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean) on page 292 to an EJB 2.0 project. a. Click File -> Import -> EJB JAR file and then click Next.
301
b. In the EJB JAR file field, browse for the location of the EJB 1.1 JAR that you created from VisualAge for Java. c. Select the existing EJB project. d. In the existing EJB Project name, select EJBSamplesV2. e. Click Finish. f. You will be asked if you wish to overwrite META-INF/MANIFEST.MF. Click Yes. g. You will receive four EJB 1.1 warnings. They will be fixed in the next section. 3. To change the EJB module display name to make it different from your previous EJB 1.1 module name, follow these steps: a. In the Navigator view, expand EJBSamplesV2 -> ejbModule -> META-INF and double-click to open ejb-jar.xml with the EJB Deployment Descriptor Editor. b. In the Overview tab, change the display name to IBMEJBSamples-V2. c. Save and close the EJB Deployment Descriptor Editor window. 4. Migrate code from EJB 1.0 to EJB 1.1: a. Edit IncrementBean.java ejbCreate() line 57 to throw javax.ejb.EJBException instead of java.rmi.RemoteException. b. Edit IncrementBean.java ejbCreate() line 57 to return IncrementKey instead of void. c. Edit IncrementBean.java ejbCreate() to add return null; as new last line 61. d. Edit IncrementBean.java to add new lines 63 to 65 implementing a new ejbPostCreate() method:
public void ejbPostCreate(IncrementKey argPrimaryKey) throws javax.ejb.CreateException, javax.ejb.EJBException { }
e. Save and close IncrementBean.java (all of the previous IncrementBean warnings should go away). f. Edit HelloWorldBean.java ejbCreate() line 23 to throw javax.ejb.EJBException instead of java.rmi.RemoteException. g. Save and close HelloWorldBean.java (the previous HelloWorldBean warnings should go away). 5. Migrate code from EJB 1.1 to EJB 2.0: Note: The bean migration to EJB 2.0 is not required, since EJB 1.1 beans work correctly in an EJB 2.0 project. However, there is a tool to assist in
302
migrating EJB 1.x beans into EJB 2.0. To use the J2EE Migration wizard, right-click the EJB project and then select Migrate -> J2EE Migration Wizard. For more information about the different wizard options, press F1 while in the J2EE Migration wizard. The steps below outline the general approach should you choose to undertake this yourself: a. Use the J2EE Migration wizard to do this initial bean migration from 1.1 to 2.0. b. Open IncrementBean.java with the Java Editor: i. In the ejbCreate method, comment out the primaryKey operation and add a set invocation (line 60, new line 61)
// primaryKey = argPrimaryKey.primaryKey; setPrimaryKey(argPrimaryKey.primaryKey);
iii. Save and close the Java Editor window for IncrementBean.java. 6. Generate and deploy RMIC stub and tie code: a. In the J2EE perspective, J2EE Hierarchy view, expand the EJB Modules folder, and select IBMEJBSamples-V2 (or in the J2EE perspective, Navigator view, select the ejbSamplesV2 project). b. Right-click it and then click Generate -> RMIC and Deploy Code. c. Select the Hello World and Increment beans. d. Click Finish. 7. Specify the data source binding information: a. In the J2EE Perspective, J2EE Hierarchy view, expand EJB Modules and select IBMEJBSamples-V2 (or in the J2EE perspective, Navigator view, select the ejbSamplesV2 project META-INF/ejb-jar.xml). b. Right-click the module and select Open With -> EJB Deployment Descriptor. c. In the EJB deployment descriptor, click the Overview tab.
303
d. In the JNDI Default Data Source Binding section, type jdbc/sampledb in the DataSource JNDI name field. (If necessary, type a default user ID and password.) e. In the EJB deployment descriptor editor, click the Beans tab. f. Select the Increment bean. g. In WebSphere Binding section, type com/ibm/ivj/ejb/samples/increment/Increment in the JNDI name field. In the Datasource Binding section, type jdbc/sampledb in the DataSource JNDI name field. (If necessary, type a default user ID and password.) h. Select the HelloWorld bean. i. In WebSphere Binding section, type HelloWorld in the JNDI name field. j. In the Datasource Binding section, type jdbc/sampledb in the DataSource JNDI name field. (If necessary, type a default user ID and password.) k. Save and close the EJB Deployment Descriptor Editor. 8. Create a new WebSphere Studio Application Developer Java client project: a. Create a new Java project (click File -> New -> Project -> Java -> Java Project). b. In the Project name field, type EJBSamplesClientsV2. Click Next. c. Click the Projects tab. Select the EJBSamples-V2 check box. d. Click Finish. 9. Import the Java code into the Java project: a. In the Java perspective, open the Navigator view (click Perspective -> Show view -> Navigator). b. In the Navigator view, click the EJBSamplesClientsV2 project. c. Select File -> Import -> File system and click Next. Browse to the directory that you exported your VisualAge for Java client code to. d. Expand your export directory and find your files (they will be in a subdirectory under com). Select the folders that contain your HelloClient and Increment Client files by selecting com. e. In the Destination folder field, type EJBSamplesClientsV2/src (or browse to that folder). f. Click Finish. g. There will be two errors in the Tasks view (if you did not add the EJBSamplesV2 project to the classpath, you will have several errors). One occurs because references to javax.ejb.CreateException, which can be found in j2ee.jar, exist.
304
h. Select EJBSamplesClientsV2 and right-click it. Click Properties -> Java Build Path. i. If you did not link to the EJBSamplesV2 project, select the Projects tab and select the EJBSamplesV2 check box. There should now only be two errors left. j. Click the Libraries tab, click Add Variable, then select WAS_50_PLUGINDIR. k. Click Extend the expand lib then select the j2ee.jar file. Click OK, then click OK again. There are still two errors in the Tasks view (a new one due to com.ibm.ivj.ejb.runtime.AbstractSessionAccessBean, which can be found in ivjejb35.jar). l. Click Properties -> Java Build Path -> Libraries to add the ivjejb35.jar file. m. There should now be no errors in the Tasks view. At this point the samples have now been migrated into WebSphere Studio Application Developer. All that remains is to test them in the WebSphere Test Environment. 10.Create a server project with an WebSphere Application Server Version 5: a. If you have not previously created a server project, click File -> New -> Project -> Server -> Server Project and then click Next. b. In the Project name field, type MyEJBServerV5 and then click Finish. c. The Server perspective will automatically open. In the Navigator view, select MyEJBServerV5 and right-click it. d. Click New -> Server and Server Configuration. e. In the Server name field, type MyEJBServerV5. f. In the Server instance type field, expand WebSphere V5.0, select Test Environment, and then click Finish. 11.Specify your data source, your EAR project, and then start the server: a. In the Server Configuration view, expand Server Configurations, and select MyEJBServerV5. b. Right-click it, and from your pop-up menu, click Open. c. Click the Data source tab. d. Beside the JDBC provider list, click Add. i. In the Name field, type Db2JdbcDriver ii. In the Description field, retain DB2 JDBC Provider.
305
iii. In the Implementation class field, retain COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource (note the uppercase COM). iv. In the Class path field, retain {DB2_JDBC_DRIVER_PATH}\db2java.zip. v. Leave Native Path blank. vi. Click Finish. e. Select this new Db2JdbcDriver in the JDBC Provider List. f. Beside the Data source defined In JDBC driver selected above list, click Add. i. Select Version 5.0 data source ii. In the Name field, type ejb samples iii. In the JNDI name field, type jdbc/sampledb iv. In the DataSource Helper Class Name field, retain com.ibm.websphere.rsadapter.DB2DataStoreHelper v. Select Use This DataSource In Container Manager Persistence (CMP) vi. Click Finish g. Select this new EJB samples in the Data source defined list. h. Beside the Resource properties defined in the data source selected above list, click Add. i. In the Name field, retain databaseName (note the upper case N). ii. In the Type field, retain java.lang.String iii. In the Value field, change to SAMPLEDB. Edit and then type SAMPLEDB. Do not select the Required check box. Click OK. i. Save your changes and close the server configuration editor. 12.Specify your EAR project to the server configuration and start the server: a. In the Server Configuration view, click Server Configurations -> MyEJBServerV5. b. Right-click it and then click Add project -> EJBSamplesV2EAR. c. (Optional) In the Navigator view, right-click ejbSamplesV2 project, select Properties -> Server Preference -> Always run on the following server -> WSTestEnv -> Apply -> OK. (This step is only necessary if you have other servers.) d. In the Server view, right-click MyEJBServerV5, and then click Start.
306
13.Test the migrated HelloWorld client: a. In the Java perspective, select the EJBSamplesClientsV2 project. b. Click the Run triangle (pull-down) and select Run -> Java Application -> New. c. In the Name field, type HelloWorldV2onV5. d. In the Main tab, leave Project as ejbSamplesClientsV2. e. Beside Main class, click Search, select HelloWorldClient, and then click Apply. f. In the JRE tab, click Add, leave JRE Type as Standard VM. For JRE Name type V5 JRE. For JRE Home, browse to X:\MyInstall\runtimes\java\jre, click OK -> Apply ->Run. g. Surprise - you get a server error, class not found com.ibm.ejs.ns.jndi.CNInitialContextFactory (found in namingclient.jar). You need to go back to the EJBSamplesClientsV2 project and click Properties -> Java Build Path -> Libraries again to add the namingclient.jar file. h. Click the Run triangle (pull-down), and select Run -> Java Application -> HelloWorldV2onV5 -> Run. i. In the client window Input field, type XX YY and then click Send. The value of the Output field becomes XX YY. j. Close the window to terminate the client. You have successfully migrated and tested the HelloWorld sample. 14.Test the migrated Increment client: a. In the Java perspective, select the EJBSamplesClientsV2 project. b. Click the Run triangle (pull-down), and select Run -> Java Application -> New. c. In the Name field, type Increment2onV5 d. In the Main tab, leave Project as ejbSamplesClientsV2 e. Beside Main class, click Search, select IncrementClient, click Apply. f. In the JRE tab, click the Run triangle (pull-down), select V5 JRE, click Apply, and then click Run. g. Select IncrementClient and select Finish. The Console view contains the following content:
Obtaining initial context., Looking up Increment enterprise bean., Obtaining IncrementHome object., Looking for increment object named: TEST, Object named: TEST has count: 0, Now, object named: TEST has count: 1, Now, object named: TEST has count: 2, Now, object named: TEST has count: 3
307
Now, object named: TEST has count: 4, Now, object named: TEST has count: 5
15.Test the migrated Increment and HelloWorld EJBs using the EJB Test Client: a. In the J2EE Hierarchy view of the J2EE perspective, expand the EJB Modules folder, right-click IBMEJBSamplesV2, and select Run on server. The EJB Test Client will start running. b. In the JNDI Explorer page, click HelloWorld to test the HelloWorld EJB. c. In the JNDI Explorer page, expand com\ibm\ivj\ejb\samples\increment and click Increment to test the Increment EJB. You have successfully migrated and tested the Increment and HelloWorld samples. d. In the Servers view of the Server perspective, select MyEJBServerV5, right-click it, and then click Stop. In the Processes view, select all the terminated processes, right-click them, and then select Remove all Terminated.
308
installation directory), you must uninstall WebSphere Studio 4.0 before installing WebSphere Studio 5.0
Migration steps
1. To export the application from WebSphere Studio 4.0, start WebSphere Studio Application Developer Version 4.0 and perform the following steps: a. Select File -> Export b. Select the EAR file and click Next. c. Select YourBankEAR as the resource to export. d. Type C:\YourBankMigration.ear as the export destination. e. Select Export source files in the Options section. f. Click Finish. g. Close WebSphere Studio Application Developer Version 4.0. 2. Import the Application to WebSphere Studio 5.0 a. Move C:\YourBankMigration.ear to the system where WebSphere Studio Application Developer Version 5.0 is installed. and start WebSphere Studio Application Developer Version 5.0. b. Select File -> Import c. Select EAR file and click Next. d. Type C:\YourBankMigration.ear as the name of the EAR file to import. e. Type YourBankEAR as the Project name. f. Click Finish to import the EAR. 3. When the import completes, you will notice that YourBankWebServicesModule has multiple errors. This is because the Java Build Path information from WebSphere Studio Application Developer 4.0 was not migrated.
309
a. If you are not already in the J2EE Perspective, switch to the J2EE perspective by selecting Window -> Open Perspective -> Other and then selecting J2EE and clicking OK. b. In the J2EE Navigator view, right-click YourBankWebServicesModule and select Properties. c. Select the Java Build Path and click the Libraries tab. d. Click the Add Variable button, select SOAPJAR and click OK. e. Click the Add Variable button, select XERCESJAR and click OK. f. Click OK to close the Properties window. There should no longer be any errors in the Task List. 4. Configure the WebSphere Version 4 Test Environment The migrated application will be tested in the WebSphere 4.0 Test Environment. The Test Environment must be created and configured manually. a. Switch to the Server perspective. b. Select File -> New -> Server Project. c. Type Servers in as the Project name and click Finish. d. Select File -> New -> Server and Server Configuration. e. Type WebSphere 4.0 Test as the Server name. f. Select Servers as the folder. g. In the Server type, select WebSphere Version 4.0 -> Test Environment. h. Click Finish. 5. The data source for the EJB must be defined in the Server Configuration. The following instructions assume that the application uses a DB2 Database named BankData on the same node where WebSphere Studio Application Developer is running: a. In the Server Configuration view, expand the Servers folder and double-click WebSphere 4.0 Test. b. In the WebSphere 4.0 Test editor, click the Data source tab. c. In the JDBC driver list, select Db2JdbcDriver. d. Click the Add button next to the Data source defined in the JDBC driver box. e. Type YourBank for the name. f. Type jdbc/YourBank for the JNDI name. g. Type BankData for the Database name.
310
h. Type in the appropriate values for the default user ID and default user password. i. Click OK. j. Close the WebSphere 4.0 Test editor and save your changes. 6. Test the applications: The application must be configured to run on the newly configured server and then the application can be tested. a. In the Server Configuration view, right-click WebSphere 4.0 Test, select Add -> YourBankEAR. b. In the Servers view, right-click WebSphere 4.0 Test and select Publish. When the publishing completes, click OK. c. In the Servers view, right-click WebSphere 4.0 Test and select Start. d. Watch the console for the message: Server Default Server open for e-business. e. To test the Web Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebModule/. f. To test the Web Service Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp g. In the Servers view, right-click WebSphere 4.0 Test and select Stop.
Migration steps
1. Add the application into CVS: a. Start WebSphere Studio Application Developer Version 4.0. b. Switch to the J2EE perspective. c. In the Navigator view, expand YourBankWebModule.
311
d. Right-click the source folder and select New -> Other. e. Select Simple -> File and click Next. f. Name the file keep and click Finish. g. Close the keep editor. Notice that the keep file also is found by expanding YourBankWebModule -> webApplication -> WEB-INF -> classes. This will ensure that the classes directory will not get pruned, because it only contains empty directories. The classes directory will be needed when the project is checked out in WebSphere Studio 5.0. h. Select YourBankWebServicesModule -> source and create a keep file there. i. Create a file named .cvsignore in YourBankEJBModule. The file should contain a single line with the word bin. This will keep the bin directory from being checked into CVS. j. Switch to the Team perspective. k. Right-click the Repositories view and select New -> CVS Repository Location. l. Leave the Connection type as pserver. Type in the appropriate user name, host name, and repository path for your CVS server and click Finish. m. When prompted for a password, type in the CVS pserver password for the user name specified. n. In the Navigator view, select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. o. Right-click the selected projects, and select Team -> Synchronize with Stream p. For each project, select the repository that you just defined and the stream HEAD. Click OK. q. In the Synchronize view, right-click each project and select Release. r. Type in a release comment for each and click OK. s. Close WebSphere Studio Application Developer 4.0. 2. Update file attributes in CVS (optional) WebSphere Studio 4.0 saves all files in CVS as binary (CVS option -kb). WebSphere Studio 5.0 has the ability to save files in CVS in both binary and text formats. The formats of individual files can be changed from within WebSphere Studio 5.0, but the bulk conversion of all text files in a project is probably better suited to a script using CVS admin to make the change.
312
If the file attributes are changed at this time, all occurrences of the following files should have their attribute changed to text: .vcm_meta .modulemaps *.xml *.xmi MANIFEST.MF .serverPreference .classpath *.java *.mapxmi *.ddl *.tblxmi *.schxmi *.dbxmi .websettings *.html *.css *.jsp *.isd *.wsdl *.wsi If the file attributes are converted at a later time, all developers will have to delete the local copies of the projects with changed files and repeat the checkout from CVS at that time. This example does not include changing the file attributes in CVS. The local CVS administrator should be able to determine the correct procedure to make the change. 3. Create a branch Creating a branch in the CVS stream will allow the old version to the project to be maintained with WebSphere Studio 4.0, while new development is done with WebSphere Studio 5.0. a. Open WebSphere Studio Application Developer 5.0. b. Select Window -> Open Perspective -> Other. c. Select CVS Repository Exploring and click OK. d. Right-click the CVS Repositories view and select New -> Repository Location. e. Fill in the information for your CVS repository. f. Click Finish. g. In the CVS Repositories view, expand the repository that you just created.
313
h. Right-click Branches and select Define Branch Tag. i. Enter the name WSAD4 and click OK. j. Expand the HEAD stream and select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. k. Right-click the selected projects and select Tag with Existing. l. Expand the Branches, select WSAD4 and click OK. This technique keeps the new development (in WebSphere Studio 5.0) in the HEAD stream, while maintenance of old code can still be performed in WebSphere Studio 4.0 on the WSAD4 branch. All development workstations that will be used to perform maintenance on the old application in WebSphere Studio 4.0 should delete the projects from their workspace and check them back out from the WSAD4 stream. 4. Check out the projects: a. Select Window -> Preferences -> Workbench and clear the Perform build automatically check box. b. Click OK. c. In the CVS Repositories view, expand the HEAD stream. d. Select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. Make sure that these projects are not selected under the WSAD4 branch. e. Right-click the selected projects and select Check out as project. 5. Make changes to the checked-out projects: a. Switch to the J2EE perspective. b. In the J2EE Hierarchy, expand Enterprise Applications and double-click YourBankEAR. c. When prompted, click Yes to allow the paths in the file to be auto corrected. d. Close and save the Application Deployment Descriptor. 6. Building the projects as they are would result in two PARSER_ERRORS because two Web Service WSDL files use absolute paths for import tags. The absolute paths used are only valid when the application is installed and running in the test environment. This can be addressed by changing the imports to use relative paths: a. In the J2EE Navigator view, expand YourBankWebServicesModule -> webApplication -> wsdl.
314
b. Double-click Transfer-service.wsdl. c. In the Transfer-service.wsdl editor, select Definitions -> Import. d. Change the value of the location to Transfer-binding.wsdl. e. Press Enter before you close the editor so the change will be recognized. f. Close the Transfer-service.wsdl editor and save the changes. g. Double-click webservicesHelper-service.wsdl. h. In the webservicesHelper-service.wsdl editor, select Definitions -> Import. i. Change the value of the location to webServicesHelper-binding.wsdl. j. Press Enter before you close the editor so the change will be recognized. k. Close the webservicesHelper-service.wsdl editor and save the changes. 7. Build the projects: a. Select Project -> Rebuild all. This should resolve all errors in the Task List. There will still be a number of warning and informational messages. b. Select Window -> Preferences -> Workbench and check the Perform build automatically check box. c. Click OK. This will result in several errors in the Task List. These errors will be addressed in the next section. 8. Configure the WebSphere Version 4 Test Environment: The migrated application will be tested in the WebSphere 4.0 Test Environment that was migrated from WebSphere Studio 4.0. a. Switch to the Server perspective. b. In the Server Configuration view, expand the Servers folder and double-click WebSphere 4.0 Test. c. When prompted, click Yes to allow the editor to fix project entries automatically. d. When prompted, click Yes to allow the editor to fix paths automatically. e. Close and save the WebSphere 4.0 Test editor. f. In the Server Configuration view, expand the Servers folder and WebSphere 4.0 Test. g. Right-click YourBankEAR and select Remove. h. Right-click WebSphere 4.0 Test under the Servers folder and select Add -> YourBankEAR. 9. Test the application:
315
a. In the Servers view, right-click WebSphere 4.0 Test and select Publish. b. When publishing completes, click OK. c. In the Servers view, right-click WebSphere 4.0 Test and select Start. d. Watch the console for the message: Server Default Server open for e-business. e. To test the Web Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebModule/. f. To test the Web Service Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp. g. In the Servers view, right-click WebSphere 4.0 Test and select Stop. 10.Check the updated projects into CVS: a. Switch to the Resource perspective and expand all the project folders in the Navigator view. b. In each project, right-click .vcm_meta, select Delete and click Yes to confirm. c. In the Navigator view, select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. d. Right-click the selected projects and select Team -> Synchronize with Repository. e. In the Synchronize view, right-click each project and select Commit. f. When you are prompted to add resources to version control, click Yes. g. When prompted for a commit comment, type one in and click OK. The migration to WebSphere Studio 5.0 is complete.
Migration steps
1. Create a WebSphere 5.0 server: a. Switch to the Server perspective.
316
b. Select File -> New -> Server and Server configuration. c. Type in the server name WebSphere 5.0 Test. d. Make sure the folder Servers is selected. e. Select server type. Click WebSphere Version 5.0 -> Test Environment. f. Click Finish. 2. Configure the server: a. In the Server Configuration view, double-click WebSphere 5.0 Test under Servers. b. Open the Data source tab of the WebSphere 5.0 Test editor. c. Click the Add button next to JDBC Providers. d. Select IBM DB2 for the Database type and DB2 JDBC Provider for the JDBC Provider Type. e. Click Next. f. Type the name DB2 Non-XA. g. Click Finish. h. Click Add next to the data sources defined in the JDBC Provider. i. Select DB2 JDBC Provider for the type of provider. j. Select Version 4.0 data source for the data source type and click Next. k. Type YourBank for the name. l. Type jdbc/YourBank for the JNDI name. m. Type BankData for the database name. n. Type in the appropriate values for the default user ID and default user password. o. Click Finish. p. Close the WebSphere 5.0 Test editor and save your changes. q. Right-click the WebSphere 5.0 Test Server in the Server Configuration view and select Add -> YourBank. 3. Update the Web Service application: The Web Service Project uses some Java Helper classes in which the server's URL is hard coded. These need to be updated to run on the new server, which listens on port 9080 instead of 8080. a. Switch to the J2EE perspective b. In the J2EE Navigator view, select YourBankWebServiceModule -> source -> proxy.soap -> webServicesHelperProxy.java.
317
c. Change stringURL from http://localhost:8080/... to http://localhost:9080/... d. Close and save webServicesHelperProxy.java. e. Update the stringURL in proxy.soap.com.ibm.yourbank.ws.webServicesHelperProxy.java and proxy.soap.com.ibm.yourbank.ejb.TransferProxy.java. f. Open YourBankWebServiceModule -> webApplication -> dds.xml. g. Expand root -> isd:service -> isd:provider and the second isd:option. h. Change the ContextProviderURL from iiop://localhost:900 to iiop://localhost. i. Close the dds.xml editor and save the changes. j. Expand the wsdl directory. k. Edit Transfer-service.wsdl and webServicesHelper-service.wsdl. Change all instances of http://localhost:8080 to http://localhost:9080. 4. Test the application. a. Switch to the Server perspective. b. Right-click WAS 5.0 Test in the Servers view and select Publish. c. When Publishing completes click OK. d. Right-click WAS 5.0 Test in the Servers view and select Start. e. Watch the console for the message Server server1 open for e-business. f. To test the Web Module (and the underlying EJBs) go to http://localhost:9080/YourBankWebModule/. g. To test the Web Service Module (and the underlying EJBs) go to http://localhost:9080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp. h. In the Servers view, right-click WAS 5.0 Test, and select Stop.
318
method or the CVS method and have configured it to run on the WebSphere 5.0 Test Environment.
Migration steps
1. Migrate YourBankEAR to J2EE 1.3: a. Switch to the J2EE perspective. b. In the J2EE Navigator, right-click YourBankEAR and select Migrate -> J2EE Migration Wizard. c. On the Migration wizard welcome page, click Next. d. On the Enterprise Application page, leave both boxes checked and click Next. e. On the EJB Module Migration page, check the Migrate CMP 1.x Beans to CMP 2.x Beans box (the Add local client views box will be checked automatically). f. Click Finish. g. When prompted to repair server configurations, click OK. h. When the migration is complete, click OK. 2. Finish migrating the Account bean to EJB 2.0: The automatic migration of the Account EJB from EJB 1.x to EJB 2.x removed the fields that were used in EJB 1.x for CMP attributes and created the methods used in EJB 2.x to access and modify CMP attributes. However, it did not update any user code that directly referenced the old fields. These changes must be made by hand. a. In the J2EE Hierarchy view, select EJB Modules -> YourBankEJBModule. b. Double-click AccountBean to launch the Java editor. c. Replace all direct references to the persistent fields with references to the getters and setters. For example, change:
public float add(float amount) { balance += amount; return balance; }
to
public float add(float amount) { setBalance(getBalance() + amount); return getBalance(); }
319
e. In the J2EE Heirarchy view, right-click EJB Modules -> YourBankEJBModule and select Generate -> Deploy and RMIC Code. f. Select both Account and Transfer and click OK. 3. Configure the test server: a. Switch to the Server perspective. b. In the Server Configuration view, select Servers and double-click WebSphere 5.0 Test. c. Open the Data source tab. d. In the JDBC Provider list, click DB2 Non-XA. e. Highlight the YourBank data source and click Remove. f. Click Add next to the data sources defined in the JDBC Provider. g. Select Version 5.0 Data Source and click Next. h. Type YourBank for the name. i. Type jdbc/YourBank for the JNDI name. j. Check the Use this data source in container managed persistence box. k. Click Next. l. Click databaseName in Resource Properties and type in the value BankData. m. Click Finish. n. Click Add next to Resource properties defined for the data source. o. Add a property name: user and a type: java.lang.String, and set the value to the appropriate database user. p. Click OK. q. Add a String property named password and set the value appropriately. r. Close the WebSphere 5.0 Test editor and save your changes. s. In the Server Configuration view, expand Servers -> WebSphere 5.0 Test. t. Right-click the WebSphere 5.0 Test Server Configuration in the Server Configuration view and select Add -> YourBankEAR. 4. Test the Web application. a. Switch to the Server perspective. b. Right-click WebSphere 5.0 Test in the Servers view and select Publish. c. When publishing completes, click OK.
320
d. Right-click WebSphere 5.0 Test in the Servers view and select Start. e. Watch the console for the message Server server1 open for e-business. f. To test the Web Module (and the underlying EJBs), go to http://localhost:9080/YourBankWebModule/. g. To test the Web Service Module (and the underlying EJBs), go to http://localhost:9080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp. h. In the Servers view, right-click WAS 5.0 Test and select Stop.
321
322
10
Chapter 10.
323
10.1 Migrating from WebSphere 3.5 Development Environment to WebSphere Studio 5.0
The IBM development toolset for WebSphere 3.5 is composed of VisualAge for Java and WebSphere Studio Classic. It is possible to develop java applications exclusively in VisualAge for Java, Web applications exclusively in WebSphere Studio Classic, and more complex applications using both tools. The WebSphere Test Environment for WebSphere 3.5 is hosted in VisualAge for Java Enterprise Edition. The development tool for WebSphere 5.0, WebSphere Studio Application Developer 5.0, is not a direct upgrade to either VisualAge for Java or WebSphere Studio Classic. It can be installed on the same machine as the existing development tools without removing the older tools.
Migration steps
Follow these steps to migrate the sample from VisualAge for Java to WebSphere Studio Application Developer: 1. Export your files from VisualAge for Java: a. Open VisualAge for Java. b. Select the IBM JSP Examples project. c. Right-click the project and select Export. Select the Directory radio button and click Next. d. Type the name of the directory you want to export the files to. e. Clear the .class check box. You do not need to export these files, because you will rebuild the project in WebSphere Studio Application Developer and re-create these files. f. Select the .java check box and click Details. Select only the LeapYear files and click OK. g. Select the Resource check box and click Details. h. Select LeapYearInput.html and LeapYearResults.jsp, which are located in the directory IBM WebSphere Test Environment\hosts\default_host\default_app\web\JSP\sample3.
324
i. Click OK. j. Clear the Create Manifest file check box (you do not need to create a manifest file). k. Click Finish. l. Close VisualAge for Java. 2. Create a new WebSphere Studio Application Developer Web project: a. Start WebSphere Studio Application Developer. b. Create a new Web project called LeapYear (click File -> New -> Project -> Web -> WebProject). c. Ensure that J2EE Web project is selected, and then click Next. d. Select New. e. Change the Enterprise Application project name to LeapYearEAR and select J2EE level 1.2. You could put the Web project into any existing Enterprise Application (EAR) project, but for this example, you will put it in LeapYearEAR. f. Leave LeapYearEAR in the Context root field. g. Click Finish. 3. Import the Java and project resource files into the WebSphere Studio Application Developer project: Import the Java source files into the LeapYear project source directory by following these steps: a. In the Web perspective, expand LeapYear and select the Java source directory. b. Click File -> Import -> File system and click Next. Browse to the directory you exported your files to and click OK. c. You only want to import the Java source files into the Java source directory, so, in the Import window, expand your export directory and select only the com subdirectory (it contains the three Java source files). d. Click Finish. This creates LeapYear\Java source\com\ibm\ivj\wte\samples\leapyear\LeapYearXXXX.java files. Java files are automatically compiled into LeapYear\webContent\WEB-INF\classes. 4. Import the resource files into the LeapYear project under the webContent directory by following these steps: a. In the current Web perspective, expand the LeapYear project and select the webContent directory.
325
b. Select File -> Import -> File system and click Next. Browse to the directory you exported your files to, expand your export directory to the sample3 subdirectory, then click OK. c. You only want to import the resource files into the webContent directory, so, in the Import window, select the sample3 subdirectory, which contains the .jsp and .html files. d. Click Finish. The files are imported into the webContent directory. 5. Define any Servlets and make any restructured application changes: a. You now need to create a Servlet. Select the LeapYear project and expand it (click Leap Year -> webContent -> WEB-INF) to the web.xml file. Open the web.xml file. b. Click the Servlets tab at the bottom of the page. c. Click Add. d. Ensure that the Servlet radio button is selected. e. Select the class LeapYear, then click OK. f. Select URL Mapping -> Add, then type LeapYear. g. Save the changes (click File -> Save web.xml) and close the web.xml file. 6. You now need to make any application changes due to the slightly changed source/application structure: a. There will be two errors listed in the Tasks view. One is in LeapYearInput.html and one is in LeapYearResults.jsp. b. Open the LeapYearResults.jsp file. Replace /JSP/index.html with LeapYearInput.html. c. Open the LeapYearInput.html file. Replace /servlet/com.ibm.ivj.wte.samples.leapyear.LeapYear with LeapYear. d. Save your changes and close the LeapYearResults.jsp and LeapYearInput.html files. e. To avoid a runtime error, open the LeapYear.java file, which is located in the source\com\ibm\ivj\wte\samples\leapyear subdirectory. f. Go to line 119 and change getRequestDispatcher from /JSP/Sample3/LeapYearResults.jsp to LeapYearResults.jsp g. Save your changes and close LeapYear.java. At this point the sample has been migrated into WebSphere Studio Application Developer. All that remains is to create a WebSphere Studio Application Developer server project and test the sample in the WebSphere Test Environment.
326
7. Create a WebSphere Studio Application Developer server project: a. Click File -> New -> Project -> Server -> Server Project. Click Next. In the Project name field, type newServer and click Finish. You will automatically be switched to the Server perspective. b. Right-click newServer and click New -> Server Instance and Configuration. c. In the Server name field, type WSTestEnv. In the Server instance type field, select WebSphere V4.0 Test Environment. Click Finish. Now, you need to specify your EAR project to the server configuration: a. In the Server Configuration view, click Server Configurations -> WSTestEnv. b. Right-click it and click Add project -> LeapYearEAR. 8. Test the migrated LeapYear application: a. Select the LeapYearInput.html file. b. Right-click the HTML file, and from its pop-up menu, click Run on Server and select WSTestEnv. c. Wait while the server starts. Click the Console tab in the Servers view and watch the Console until the message Server Default Server open for e-business appears. d. When a browser opens, type 2001 in the Start Year field, then click Submit. e. The Console view shows the message LeapYear:init. Wait until you see the list of leap years, then select WSTestEnv in the Servers view. Right-click it and click Stop.
10.1.2 Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean)
You will work with two EJB Development samples: Hello World and Increment. To access these samples open the online help, and select Samples -> EJB Development. You must work with VisualAge for Java Version 4.0 for this example. You do not have to migrate these samples together. If you are not currently working with DB2, you may not wish to migrate Increment. In this case, you can ignore any steps that apply to the Increment sample only.
327
Before you begin: Be sure the application runs in VisualAge for Java (that is, the DB2 setup for the Increment sample is complete). Be sure to stop the VisualAge for Java WebSphere Test Environment EJB server and Persistent Name Server (so they will not conflict with WebSphere Studio Application Developer).
Migration steps
Follow these steps to migrate the samples from VisualAge for Java to WebSphere Studio Application Developer: 1. Export the client Java source from VisualAge for Java: a. Start VisualAge for Java Version 4.0. b. Select the IBM EJB Samples project c. Right-click the project and click Export. d. Select the Directory radio button and click Next. e. Type the name of the directory you want to export your files to. f. Clear the .class check box. (You will rebuild the .class files in WebSphere Studio Application Developer to ensure that you have successfully migrated the samples.) g. Select the .java check box. Click Details and clear the IBM EJB Samples check box. h. Select the HelloClient and IncrementClient check boxes and click OK. i. Clear the .resource check box (unless you want the DB2 .clp setup scripts). j. Click Finish. 2. Export the EJB group from VisualAge for Java into an EJB 1.1 JAR: a. Open the map browser to load the map for IBM EJB samples. b. Click the EJB tab. In the Enterprise Beans pane, right-click IBMEJBSamples and click Export -> EJB 1.1 JAR. c. Select a directory to export your JAR file to. d. In the JAR file field, type the name of the JAR file you want to create. e. In the Select a target database list, select DB2 for NT, V7.1. f. Select the .class check box. (You will rebuild the files in WebSphere Studio Application Developer as a verification of the migration, but this must be selected in order to proceed.)
328
g. Select the .java check box. (You need the four HelloWorld and the five Increment EJB files.) h. Click Finish. i. If you were running the samples, then stop the VisualAge for Java Persistent Name Server, EJB server, and WebSphere Test Environment. j. (Optional) Exit VisualAge for Java. 3. Create a new WebSphere Studio Application Developer EJB project: Note: This section is optional. If you do not have an EJB and EAR project, they will automatically be created when you import the EJB 1.1 JAR file. a. Start WebSphere Studio Application Developer. b. Create a new EJB project (click File -> New -> Project -> EJB -> EJB Project -> Create 1.1 -> Next). c. In the Project name field, type EJBSamples. d. Select EAR new. e. In the EAR project name field, type EJBSamplesEAR. Click Finish. You could put this EJB project into any existing Enterprise Application (EAR) project you currently have, but for this example, create a new EAR project called EJBSamplesEAR. f. The new projects are created and appear in the J2EE perspective. 4. Import the EJB 1.1 JAR file into WebSphere Studio Application Developer EJB project: a. Click File -> Import -> EJB JAR file. Click Next. b. In the EJB JAR file field, browse for the location of the EJB 1.1 JAR you created. c. In the EJB Project field, select EJBSamples. d. In the Enterprise Application project name field, select EJBSamplesEAR. Click Finish. e. You will receive four or five EJB 1.1 warnings. You can ignore them. 5. Generate and deploy RMIC stub and tie code: a. In the J2EE perspective, expand the EJB Modules folder, and select IBMEJBSamples. b. Right-click it and click Generate -> RMIC and Deploy Code. c. Select the Hello World and Increment beans. Click Finish. 6. Specify the data source binding information:
329
a. In the J2EE Perspective, expand EJB Modules and select IBMEJBSamples. b. Right-click the module and select Open With -> EJB Deployment Descriptor. c. In the EJB deployment descriptor, click the Overview tab. d. Select IBMEJBSamples, and type jdbc/sampledb in the DataSource JNDI name field. e. If necessary, type a default user ID and password. f. Close the EJB deployment descriptor (you will prompted to save your changes). 7. Create a new WebSphere Studio Application Developer project: a. Create a new Java project (click File -> New -> Project -> Java -> Java Project). b. In the Project name field, type EJBClients. Click Next. c. Click the Projects tab. Select the EJBSamples check box. d. Click Finish. 8. Import the Java code into a Java project: a. In the Java perspective, open the Navigator view (click Window -> Show view -> Navigator). b. In the Navigator view, click the EJBClients project. c. Select File -> Import -> File system and click Next. Browse to the directory that you exported your client code to. d. Expand your export directory and find your files (they will be in a subdirectory under com). Select the folders that contain your HelloClient and Increment Client files. e. Click Finish. f. There will be two errors in the Tasks view (if you did not add the EJBSamples project to the class path, you will have several errors). One occurs because references to javax.ejb.CreateException, which can be found in j2ee.jar, exist. The other occurs because of a reference to com.ibm.ivj.ejb.runtime.AbstractSessionAccessBean, which can be found in ivjejb35.jar. g. Select EJBClients and right-click it. Click Properties -> Java Build Path. h. If you did not link to the EJBSamples project, select the Projects tab and select the EJBSamples check box. There should now only be two errors left.
330
i. Click the Libraries tab and click Add External JARs. j. Browse to the WS_Installdir\aes_v4\lib directory, where WS_Installdir is your product installation directory. k. Select the j2ee.jar file. Click Open, and then click Add External JARs. l. Browse to the WS_Installdir\aes_v4\lib directory. m. Select the ivjejb35.jar file. Click Open, then click OK. n. There should now be no errors in the Tasks view, except the EJB 1.1 warnings. At this point, the samples have now been migrated into WebSphere Studio Application Developer. All that remains is to test them in the WebSphere Test Environment. 9. Create a WebSphere Studio Application Developer server project: a. Click File -> New -> Project -> Server -> Server Project and click Next. In the Project name field, type EJBServer and click Finish. b. The Server perspective will automatically open. In the Navigator view, select EJBServer and right-click it. c. Click New -> Server Instance and Configuration. d. In the Server name field, type MyEJBServer. In the Server instance type field, click WebSphere V4.0 Test Environment, and then click Finish. 10.Specify your data source, your EAR project, and then start the server: a. In the Server Configuration view, expand Server Configurations and select MyEJBServer. b. Right-click it, and from your pop-up menu, click Open. c. Click the Data source tab. d. In the JDBC Driver List, select the Db2JdbcDriver and click Edit. e. Verify that the Class path field contains the correct path to db2java.zip. Click OK. f. Select your JDBC driver, and click the Add button to the right of the Data source field. g. In the Add a data source window, type EJB Sampledb in the Name field. In the JNDI name field, type jdbc/sampledb. h. In the Database name field, type sampledb. Click OK. i. Save your changes and close the server configuration editor. 11.Now, you need to specify your EAR project to the server configuration and start the server:
331
a. In the Server Configuration view, click Server Configurations -> MyEJBServer. b. Right-click it and click Add project -> EJBSamplesEAR. c. In the Server view, right-click MyEJBServer, then click Start. 12.Start DB2 and connecting to sampleDB: Note: DB2 must be running with the sampleDB created and available (as per the VisualAge for Java sample). This is applicable only if you are migrating the Increment sample. Optional: You can perform the following steps to verify your DB2 setup: a. Switch to the Data perspective. b. In the DB Servers view, right-click and select New Connection. c. In the Connection Name field, type sampleDB connection d. In the Database field, type SAMPLEDB. e. In the JDBC Driver field, select IBM DB2 App Driver. f. In the Class Location field, specify the location of the db2java.zip file. g. Click Finish. h. If necessary, type a default user ID and password. i. In the DB Servers view, expand sampleDB conn to ensure that the Tables subdirectory contains MYHOST.INCREMENTS. 13.Test the migrated HelloWorld client: a. In the Java perspective, select the EJBClients project. b. Click the Run button and select Run -> Java application. c. Click New to create new configuration file. d. In the main class, select HelloClient. e. On the JRE tab, select WebSphere Application Server V4 JRE and then select Run. f. In the client window Input field, type XX YY and click Send. g. The value of the Output field becomes XX YY. Close the window to terminate the client. You have successfully migrated and tested the HelloWorld sample. 14.Test the migrated Increment client: a. In the Java perspective, select the EJBClients project. b. Click the Run button and select Run -> Java application.
332
c. In the main class, select IncrementClient. d. On the JRE tab, select WebSphere Application Server V4 JRE and then select Run. e. The Console view contains the following content:
Obtaining initial context., Looking up Increment enterprise bean., Obtaining IncrementHome object., Looking for increment object named: TEST, Object named: TEST has count: 0, Now, object named: TEST has count: 1, Now, object named: TEST has count: 2, Now, object named: TEST has count: 3 Now, object named: TEST has count: 4, Now, object named: TEST has count: 5
15.Test the migrated Increment and HelloWorld EJBs using the EJB Test Client: a. In the J2EE Hierarchy view of the J2EE perspective, expand the EJB Modules folder, right-click IBMEJBSamples, select Run on server, and then select MyEJBServer. The EJB Test Client will start running. b. In the JNDI Explorer page, click HelloWorld to test the HelloWorld EJB. c. In JNDI Explorer, expand com\ibm\ivj\ejb\samples\increment and then click Increment to test the Increment EJB. You have successfully migrated and tested the Increment and HelloWorld samples. d. In the Servers view of the Server perspective, select MyEJBServer, right-click it and click Stop.
10.1.3 Example: WebSphere Studio Classic Version 4.0 Web application (YourCo)
You must work with WebSphere Studio Classic Version 4.0.x for this example. The sample you are going to work with is the YourCo sample. To access this sample open the online help (click Help -> WebSphere Studio 4.0 -> How to -> Work with the samples -> Overview). To load this sample, follow the instructions in the online help under Opening the Studio Samples (for WebSphere Studio Classic V4.0) and load YourCo.war. Note: The migrated application will execute in WebSphere Studio Application Developer, but WebSphere Studio Application Developer does not currently provide all the Web page design and development features of WebSphere Studio, Professional or Advanced Editions.
333
Before you begin: Ensure that the YourCo sample application is loaded in WebSphere Studio Classic. Stop any instances of the WebSphere Application Server (so it will not conflict with WebSphere Studio Application Developer).
Migration steps
To migrate this sample from WebSphere Studio Classic to WebSphere Studio Application Developer, follow these steps. 1. Start WebSphere Studio Classic Version 4.0 and create a new Migration stage: This step is optional. Normally, you would create a new stage for a migration, but for the purposes of this example, you use the Test stage included with WebSphere Studio Classic. Using the Test stage will save you from having to manually edit many Servlet mappings in step h on page 335. For information on how to create a new stage for migration, refer to 3.5, Migrating from WebSphere Studio Classic to WebSphere Studio Application Developer on page 96. 2. Create a Web configuration descriptor file: a. In the project file view, click Project -> Create Web Configuration Descriptor File, and accept the default value WEB-INF\localhost_web.xml. b. Select all required Servlets (any files that are not named xxxxBean). There are no Tag Library Descriptor (TLD) files for this sample. c. Click Create. 3. Create a migration file: a. While in the project file view, select server localhost and click Properties -> Publishing -> WebApp Web Path and type a Web path (context root) newStudioSample. (Setting a Web path will remain the recommended approach in the final WebSphere Studio Application Developer product). b. While in the project file view, select Project -> Create Migration file. c. Verify that localhost is the selected server. d. Verify that localhost_web.xml is the selected Web configuration descriptor file. e. Click OK. f. The default JAR file name is X:\Studio40\projects\YourCo\localhost.jar, where X is your WebSphere Studio "Classic" installation directory.
334
g. Click Save. h. Close WebSphere Studio "Classic". i. Rename the localhost.jar file to localhost.war. 4. Start WebSphere Studio Application Developer and import the WAR file: a. Start WebSphere Studio Application Developer. b. Click File -> Import -> WAR file -> Next. Note: You must import the JAR file using the WAR file option; otherwise it will not work properly. c. Type the path to localhost.war in the WAR File field or click Browse to search for it. d. In the Web Project field, select New, and then type newStudioSample. e. In the EAR project name field, select New, and then type newStudioSampleEAR. f. Click Finish. WebSphere Studio Application Developer will unpack localhost.war. g. You will have many unresolved references or missing import files. They will appear in the Task view: com.ibm.db requires databeans.jar com.ibm.webtools.runtime requires webtlsrn.jar com.ibm.ejs.ns.jndi requires ns.jar com.ibm.webshpere.advanced.cm.factory requires cm.jar com.ibm.ejs.models.base.extensions.webappext.ServletExtensions requires ws-base-extensions.jar
To fix this, you must modify the Java build path for the Web project: i. Right-click the project and click Properties -> Java Build Path. ii. Click the Libraries tab. Click Add External JARs. iii. Import the following JAR files: databeans.jar, webtlsrn.jar, ns.jar, cm.jar, and ws-base-extensions.jar from the MyInstall\runtimes\aes_v4\lib directory. iv. Twenty-four warnings will remain. You do not need to deal with them. h. Right-click the newStudioSample project and click Rebuild Project. 5. Create a WebSphere Studio Application Developer server project: At this point the sample has been migrated into WebSphere Studio Application Developer. All that remains is to create a WebSphere Studio
335
Application Developer Server project and test the sample in the WebSphere Test Environment. a. Switch to the Server perspective. b. Click File -> New -> Project -> Server -> Server Project. Click Next. In the Project name field, type newServer and click Finish. c. In the Navigator view, right-click newServer and click New -> Server and Server Configuration. d. In the Server name field, type WSTestEnv. In the Server instance type field, select WebSphere V4.0 Test Environment. Click Finish. e. (Optional) Right-click newStudioSample project, select Properties -> Server Preference -> Always run on the following server, select WSTestEnv, then click Apply -> OK. (This step is only necessary if you have other servers.) 6. Now, you need to specify your EAR project to the server configuration: a. In the Server Configuration view, click Server Configurations -> WSTestEnv. b. Right-click it and click Add -> newStudioSampleEAR. 7. Test the migrated YourCo application: a. Select the YourCoIntro.html file, which is located in the webContent\StudioSamples\YourCo directory in your newStudioSample project. b. Right-click YourCoIntro.html, and from its pop-up menu, click Run on Server, and then select WSTestEnv. c. Wait while the server starts. Click the Console tab in the Servers view and watch the Console until the message Server Default Server open for e-business appears. d. If you have not already run this sample in WebSphere Studio Classic, then you need to configure the database by clicking Database Configuration. e. When a browser opens, scroll down and click Run This Sample. f. Wait until the Welcome window appears, then click Employee Center. Note: The first time you run this application, you will receive the following errors in the Console page: DataSource not found. Try to construct a new datasource name: jdbc/yourco DataSource not found. Try to construct a new datasource name: jdbc/studio. These errors are self-correcting. You can ignore them.
336
g. When you are done, close the browser window and the Web Browser view, then in the Server Control Panel right-click WSTestEnv and click Stop. h. (Optional) Close WebSphere Studio Application Developer.
10.1.4 Example: Migrating VisualAge for Java JSP/Servlet samples example to EJB 2.0
This example migrates the VisualAge for Java JSP/Servlet samples example (see 10.1.1, Example: VisualAge for Java JSP/Servlet sample (LeapYear) on page 324) from EJB 1.x to EJB 2.0. Note that this example requires that you have completed the migration steps in 10.1.2, Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean) on page 327 and that you have DB2 set up and running for that sample.
Migration steps
1. Create a new EJB 2.0 project and Enterprise Application 1.3 project: a. Select File -> New -> EJB Project -> Create EJB 2.0 project, and then click Next. b. In the EJB Project Name field, type ejbSamplesV2. c. Select the new EAR project. d. In the EAR Project Name field, type ejbSamplesV2EAR, and then click Finish. 2. Import the VisualAge for Java EJB 1.1 JAR into EJB 2.0 project: Import the VisualAge for Java EJB 1.1 JAR file in 10.1.2, Example: Enterprise beans, VCE, and database samples (HelloWorld session bean and Increment enterprise bean) on page 327 to an EJB 2.0 project. a. Click File -> Import -> EJB JAR file and then click Next. b. In the EJB JAR file field, browse for the location of the EJB 1.1 JAR that you created from VisualAge for Java. c. Select the existing EJB project. d. In the existing EJB Project name, select EJBSamplesV2. e. Click Finish. f. You will be asked if you wish to overwrite META-INF/MANIFEST.MF. Click Yes. g. You will receive four EJB 1.1 warnings. They will be fixed in the next section.
337
3. To change the EJB module display name to make it different from your previous EJB 1.1 module name, follow these steps: a. In the Navigator view, expand EJBSamplesV2 -> ejbModule -> META-INF and double-click to open ejb-jar.xml with the EJB Deployment Descriptor Editor. b. In the Overview tab, change the display name to IBMEJBSamples-V2. c. Save and close the EJB Deployment Descriptor Editor window. 4. Migrate code from EJB 1.0 to EJB 1.1: a. Edit IncrementBean.java ejbCreate() line 57 to throw javax.ejb.EJBException instead of java.rmi.RemoteException. b. Edit IncrementBean.java ejbCreate() line 57 to return IncrementKey instead of void. c. Edit IncrementBean.java ejbCreate() to add return null; as new last line 61. d. Edit IncrementBean.java to add new lines 63 to 65 implementing a new ejbPostCreate() method:
public void ejbPostCreate(IncrementKey argPrimaryKey) throws javax.ejb.CreateException, javax.ejb.EJBException { }
e. Save and close IncrementBean.java (all of the previous IncrementBean warnings should go away). f. Edit HelloWorldBean.java ejbCreate() line 23 to throw javax.ejb.EJBException instead of java.rmi.RemoteException. g. Save and close HelloWorldBean.java (the previous HelloWorldBean warnings should go away). 5. Migrate code from EJB 1.1 to EJB 2.0: Note: The current EA version does not provide a tool for EJB 1.x to 2.0 code migration. Remember that bean migration to EJB 2.0 is not required, since EJB 1.1 beans work correctly in an EJB 2.0 project. It is possible, sometime after the EA version ships, that there might be a downloadable techPreview, which provides a tool to assist in migrating EJB 1.x beans into EJB 2.0. Go to the eFix Web page at http://www14.software.ibm.com/webapp/download/product.jsp?type=s&id= SPAT-524G3S. Although there currently is no tool for migrating EJB code, the following steps outline the general approach should you choose to undertake this yourself: a. Open the ejb-jar.xml source with the XML Editor:
338
ii. Follow this with a new <abstract-schema-name definition (not used, but required for EJBQL):
<abstract-schema-nameincrementAbstractSchemaName</abstract-schema-nam e
iii. Save and close the XMP Editor window. b. Open IncrementBean.java with the Java Editor: i. Add abstract to the class definition (line 10):
public abstract class IncrementBean implements EntityBean {
ii. Comment out field definitions count and primaryKey (lines 11 and 13):
// public int count; private javax.ejb.EntityContext entityContext = null; // public java.lang.String primaryKey;
iii. Add abstract Getter and Setter methods for count and primaryKey:
public abstract java.lang.String getPrimaryKey(); public abstract void setPrimaryKey(java.lang.String newPrimaryKey); public abstract int getCount(); public abstract void setCount(int i); // public void setCount(int newValue) { // this.count = newValue //}
iv. In the ejbCreate method, comment out the primaryKey operation and add a set invocation (line 60, new line 61:
// primaryKey = argPrimaryKey.primaryKey; setPrimaryKey(argPrimaryKey.primaryKey);
vi. Save and close the Java Editor window for IncrementBean.java. 6. Generate and deploy RMIC stub and tie code:
339
a. In the J2EE perspective, J2EE Hierarchy view, expand the EJB Modules folder, and select IBMEJBSamples-V2 (or in the J2EE perspective, Navigator view, select the ejbSamplesV2 project). b. Right-click it and then click Generate -> RMIC and Deploy Code. c. Select the Hello World and Increment beans. d. Click Finish. 7. Specify the data source binding information: a. In the J2EE Perspective, J2EE Hierarchy view, expand EJB Modules and select IBMEJBSamples-V2 (or in the J2EE perspective, Navigator view, select the ejbSamplesV2 project META-INF/ejb-jar.xml). b. Right-click the module and select Open With -> EJB Deployment Descriptor. c. In the EJB deployment descriptor, click the Overview tab. d. In the JNDI Default Data Source Binding section, type jdbc/sampledb in the DataSource JNDI name field. (If necessary, type a default user ID and password.) e. In the EJB deployment descriptor editor, click the Beans tab. f. Select the Increment bean. g. In WebSphere Binding section, type com/ibm/ivj/ejb/samples/increment/Increment in the JNDI name field. In the Datasource Binding section, type jdbc/sampledb in the DataSource JNDI name field. (If necessary, type a default user ID and password.) h. Select the HelloWorld bean. i. In WebSphere Binding section, type HelloWorld in the JNDI name field. j. In the Datasource Binding section, type jdbc/sampledb in the DataSource JNDI name field. (If necessary, type a default user ID and password.) k. Save and close the EJB Deployment Descriptor Editor. 8. Create a new WebSphere Studio Application Developer Java client project: a. Create a new Java project (click File -> New -> Project -> Java -> Java Project). b. In the Project name field, type EJBSamplesClientsV2. Click Next. c. Click the Projects tab. Select the EJBSamples-V2 check box. d. Click Finish. 9. Import the Java code into the Java project: a. In the Java perspective, open the Navigator view (click Perspective -> Show view -> Navigator).
340
b. In the Navigator view, click the EJBSamplesClientsV2 project. c. Select File -> Import -> File system and click Next. Browse to the directory that you exported your VisualAge for Java client code to. d. Expand your export directory and find your files (they will be in a subdirectory under com). Select the folders that contain your HelloClient and Increment Client files by selecting com. e. In the Destination folder field, type EJBSamplesClientsV2/src (or browse to that folder). f. Click Finish. g. There will be two errors in the Tasks view (if you did not add the EJBSamplesV2 project to the classpath, you will have several errors). One occurs because references to javax.ejb.CreateException, which can be found in j2ee.jar, exist. h. Select EJBSamplesClientsV2 and right-click it. Click Properties -> Java Build Path. i. If you did not link to the EJBSamplesV2 project, select the Projects tab and select the EJBSamplesV2 check box. There should now only be two errors left. j. Click the Libraries tab, click Add Variable, then select WAS_50_PLUGINDIR. k. Click Extend the expand lib then select the j2ee.jar file. Click OK, then click OK again. There are still two errors in the Tasks view (a new one due to com.ibm.ivj.ejb.runtime.AbstractSessionAccessBean, which can be found in ivjejb35.jar). l. Click Properties -> Java Build Path -> Libraries to add the ivjejb35.jar file. m. There should now be no errors in the Tasks view. At this point the samples have now been migrated into WebSphere Studio Application Developer. All that remains is to test them in the WebSphere Test Environment. 10.Create a server project with an WebSphere Application Server Version 5: a. If you have not previously created a server project, click File -> New -> Project -> Server -> Server Project and then click Next. b. In the Project name field, type MyEJBServerV5 and then click Finish. c. The Server perspective will automatically open. In the Navigator view, select MyEJBServerV5 and right-click it. d. Click New -> Server and Server Configuration.
341
e. In the Server name field, type MyEJBServerV5. f. In the Server instance type field, expand WebSphere V5.0, select Test Environment, and then click Finish. 11.Specify your data source, your EAR project, and then start the server: a. In the Server Configuration view, expand Server Configurations, and select MyEJBServerV5. b. Right-click it, and from your pop-up menu, click Open. c. Click the Data source tab. d. Beside the JDBC provider list, click Add. i. In the Name field, type Db2JdbcDriver ii. In the Description field, retain DB2 JDBC Provider. iii. In the Implementation class field, retain COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource (note the uppercase COM). iv. In the Class path field, retain {DB2_JDBC_DRIVER_PATH}\db2java.zip. v. Leave Native Path blank. vi. Click Finish. e. Select this new Db2JdbcDriver in the JDBC Provider List. f. Beside the Data source defined In JDBC driver selected above list, click Add. i. Select Version 5.0 data source. ii. In the Name field, type ejb samples iii. In the JNDI name field, type jdbc/sampledb iv. In the DataSource Helper Class Name field, retain com.ibm.websphere.rsadapter.DB2DataStoreHelper v. Select Use This DataSource In Container Manager Persistence (CMP) vi. Click Finish. g. Select this new EJB samples in the Data source defined list. h. Beside the Resource properties defined in the data source selected above list, click Add. i. In the Name field, retain databaseName (note the upper case N). ii. In the Type field, retain java.lang.String
342
iii. In the Value field, change to SAMPLEDB. Edit and then type SAMPLEDB. Do not select the Required check box. Click OK. i. Save your changes and close the server configuration editor. 12.Specify your EAR project to the server configuration and start the server: a. In the Server Configuration view, click Server Configurations -> MyEJBServerV5. b. Right-click it and then click Add project -> EJBSamplesV2EAR. c. (Optional) In the Navigator view, right-click ejbSamplesV2 project, select Properties -> Server Preference -> Always run on the following server -> WSTestEnv -> Apply -> OK. (This step is only necessary if you have other servers.) d. In the Server view, right-click MyEJBServerV5, and then click Start. 13.Test the migrated HelloWorld client: a. In the Java perspective, select the EJBSamplesClientsV2 project. b. Click the Run triangle (pull-down) and select Run -> Java Application -> New. c. In the Name field, type HelloWorldV2onV5. d. In the Main tab, leave Project as ejbSamplesClientsV2. e. Beside Main class, click Search, select HelloWorldClient, and then click Apply. f. In the JRE tab, click Add, leave JRE Type as Standard VM. For JRE Name type V5 JRE. For JRE Home, browse to X:\MyInstall\runtimes\java\jre, click OK -> Apply ->Run. g. Surprise - you get a server error, class not found com.ibm.ejs.ns.jndi.CNInitialContextFactory (found in namingclient.jar). You need to go back to the EJBSamplesClientsV2 project and click Properties -> Java Build Path -> Libraries again to add the namingclient.jar file. h. Click the Run triangle (pull-down), and select Run -> Java Application -> HelloWorldV2onV5 -> Run. i. In the client window Input field, type XX YY and then click Send. The value of the Output field becomes XX YY. j. Close the window to terminate the client. You have successfully migrated and tested the HelloWorld sample. 14.Test the migrated Increment client: a. In the Java perspective, select the EJBSamplesClientsV2 project.
343
b. Click the Run triangle (pull-down), and select Run -> Java Application -> New. c. In the Name field, type Increment2onV5 d. In the Main tab, leave Project as ejbSamplesClientsV2 e. Beside Main class, click Search, select IncrementClient, click Apply. f. In the JRE tab, click the Run triangle (pull-down), select V5 JRE, click Apply, and then click Run. g. Select IncrementClient and select Finish. The Console view contains the following content:
Obtaining initial context., Looking up Increment enterprise bean., Obtaining IncrementHome object., Looking for increment object named: TEST, Object named: TEST has count: 0, Now, object named: TEST has count: 1, Now, object named: TEST has count: 2, Now, object named: TEST has count: 3 Now, object named: TEST has count: 4, Now, object named: TEST has count: 5
15.Test the migrated Increment and HelloWorld EJBs using the EJB Test Client: a. In the J2EE Hierarchy view of the J2EE perspective, expand the EJB Modules folder, right-click IBMEJBSamplesV2, and select Run on server. The EJB Test Client will start running. b. In the JNDI Explorer page, click HelloWorld to test the HelloWorld EJB. c. In the JNDI Explorer page, expand com\ibm\ivj\ejb\samples\increment and click Increment to test the Increment EJB. You have successfully migrated and tested the Increment and HelloWorld samples. d. In the Servers view of the Server perspective, select MyEJBServerV5, right-click it, and then click Stop. In the Processes view, select all the terminated processes, right-click them, and then select Remove all Terminated.
344
have been created in a DB2 database called BankData. See the documentation that comes with the YourBank training for instructions on creating the database. The example in 10.2.2, Example: Migrating YourBank using the CVS method on page 348 assumes that a Servers project has been created in WebSphere Studio 4.0, and a Server and Server Configuration named WebSphere 4.0 Test has been appropriately configured for the application. For all the examples in this section, WebSphere Studio 5.0 can be installed on the same system as WebSphere Studio 4.0, or on a different system. If WebSphere Studio 5.0 is co-installed with WebSphere Studio 4.0, it should be installed in a different directory. The WebSphere Studio 5.0 install does not remove WebSphere Studio 4.0, so to replace WebSphere Studio 4.0 with WebSphere Studio 5.0 (using the same installation directory), you must uninstall WebSphere Studio 4.0 before installing WebSphere Studio 5.0
Migration steps
1. To export the application from WebSphere Studio 4.0, start WebSphere Studio Application Developer Version 4.0 and perform the following steps: a. Select File -> Export b. Select the EAR file and click Next. c. Select YourBankEAR as the resource to export. d. Type C:\YourBankMigration.ear as the export destination. e. Select Export source files in the Options section. f. Click Finish. g. Close WebSphere Studio Application Developer Version 4.0. 2. Import the Application to WebSphere Studio 5.0
345
a. Move C:\YourBankMigration.ear to the system where WebSphere Studio Application Developer Version 5.0 is installed. and start WebSphere Studio Application Developer Version 5.0. b. Select File -> Import c. Select EAR file and click Next. d. Type C:\YourBankMigration.ear as the name of the EAR file to import. e. Type YourBankEAR as the Project name. f. Click Finish to import the EAR. 3. When the import completes, you will notice that YourBankWebServicesModule has multiple errors. This is because the Java Build Path information from WebSphere Studio Application Developer 4.0 was not migrated. a. If you are not already in the J2EE Perspective, switch to the J2EE perspective by selecting Window -> Open Perspective -> Other and then selecting J2EE and clicking OK. b. In the J2EE Navigator view, right-click YourBankWebServicesModule and select Properties. c. Select the Java Build Path and click the Libraries tab. d. Click the Add Variable button, select SOAPJAR and click OK. e. Click the Add Variable button, select XERCESJAR and click OK. f. Click OK to close the Properties window. There should no longer be any errors in the Task List. 4. Configure the WebSphere Version 4 Test Environment The migrated application will be tested in the WebSphere 4.0 Test Environment. The Test Environment must be created and configured manually. a. Switch to the Server perspective. b. Select File -> New -> Server Project. c. Type Servers in as the Project name and click Finish. d. Select File -> New -> Server and Server Configuration. e. Type WebSphere 4.0 Test as the Server name. f. Select Servers as the folder. g. In the Server type, select WebSphere Version 4.0 -> Test Environment. h. Click Finish.
346
5. The data source for the EJB must be defined in the Server Configuration. The following instructions assume that the application uses a DB2 Database named BankData on the same node where WebSphere Studio Application Developer is running: a. In the Server Configuration view, expand Server Configurations and double-click WebSphere 4.0 Test. b. In the WebSphere 4.0 Test editor, click the Data source tab. c. In the JDBC driver list, select Db2JdbcDriver. d. Click the Add button next to the Data source defined in the JDBC driver box. e. Type YourBank for the name. f. Type jdbc/YourBank for the JNDI name. g. Type BankData for the Database name. h. Type in the appropriate values for the default user ID and default user password. i. Click OK. j. Close the WebSphere 4.0 Test editor and save your changes. 6. Test the applications: The application must be configured to run on the newly configured server and then the application can be tested. a. In the Server Configuration view, right-click WebSphere 4.0 Test, select Add -> YourBankEAR. b. In the Servers view, right-click WebSphere 4.0 Test and select Publish. When the publishing completes, click OK. c. In the Servers view, right-click WebSphere 4.0 Test and select Start. d. Watch the console for the message: Server Default Server open for e-business. e. To test the Web Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebModule/. f. To test the Web Service Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp g. In the Servers view, right-click WebSphere 4.0 Test and select Stop.
347
Migration steps
1. Add the application into CVS: a. Start WebSphere Studio Application Developer Version 4.0. b. Switch to the J2EE perspective. c. In the Navigator view, expand YourBankWebModule. d. Right-click the source folder and select New -> Other. e. Select Simple -> File and click Next. f. Name the file keep and click Finish. g. Close the keep editor. Notice that the keep file also is found by expanding YourBankWebModule -> webApplication -> WEB-INF -> classes. This will ensure that the classes directory will not get pruned because it only contains empty directories. The classes directory will be needed when the project is checked out in WebSphere Studio 5.0. h. Select YourBankWebServicesModule -> source and create a keep file there.. i. Create a file named .cvsignore in YourBankEJBModule. The file should contain a single line with the word bin. This will keep the bin directory from being checked into CVS. j. Switch to the Team perspective. k. Right-click the Repositories view and select New -> CVS Repository Location. l. Leave the Connection type as pserver. Type in the appropriate user name, host name and repository path for your CVS server and click Finish. m. When prompted for a password, type in the CVS pserver password for the user name specified.
348
n. In the Navigator view, select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. o. Right-click the selected projects, and select Team -> Synchronize with Stream p. For each project, select the repository that you just defined and the stream HEAD. Click OK. q. In the Synchronize view, right-click each project and select Release. r. Type in a release comment for each and click OK. s. Close WebSphere Studio Application Developer 4.0. 2. Update file attributes in CVS (optional) WebSphere Studio 4.0 saves all files in CVS as binary (CVS option -kb). WebSphere Studio 5.0 has the ability to save files in CVS in both binary and text formats. The formats of individual files can be changed from within WebSphere Studio 5.0, but the bulk conversion of all text files in a project is probably better suited to a script using CVS admin to make the change. If the file attributes are changed at this time, all occurrences of the following files should have their attribute changed to text: .vcm_meta .modulemaps *.xml *.xmi MANIFEST.MF .serverPreference .classpath *.java *.mapxmi *.ddl *.tblxmi *.schxmi *.dbxmi .websettings *.html *.css *.jsp *.isd *.wsdl *.wsi If the file attributes are converted at a later time, all developers will have to delete the local copies of the projects with changed files and repeat the checkout from CVS at that time.
349
This example does not include changing the file attributes in CVS. The local CVS administrator should be able to determine the correct procedure to make the change. 3. Create a branch Creating a branch in the CVS stream will allow the old version to the project to be maintained with WebSphere Studio 4.0, while new development is done with WebSphere Studio 5.0. a. Open WebSphere Studio Application Developer 5.0. b. Select Window -> Open Perspective -> Other. c. Select CVS Repository Exploring and click OK. d. Right-click the CVS Repositories view and select New -> Repository Location. e. Fill in the information for your CVS repository. f. Click Finish. g. In the CVS Repositories view, expand the repository that you just created h. Right-click Branches and select Define Branch Tag. i. Enter the name WSAD4 and click OK. j. Expand the HEAD stream and select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. k. Right-click the selected projects and select Tag with Existing. l. Expand the Branches, select WSAD4 and click OK. This technique keeps the new development (in WebSphere Studio 5.0) in the HEAD stream, while maintenance of old code can still be performed in WebSphere Studio 4.0 on the WSAD4 branch. All development workstations that will be used to perform maintenance on the old application in WebSphere Studio 4.0 should delete the projects from their workspace and check them back out from the WSAD4 stream. 4. Check out the projects: a. Select Window -> Preferences -> Workbench and clear the Perform build automatically check box. b. Click OK. c. In the CVS Repositories view, expand the HEAD stream. d. Select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects. Make sure that these projects are not selected under the WSAD4 branch.
350
e. Right-click the selected projects and select Check out as project. 5. Make changes to the checked-out projects: a. Switch to the J2EE perspective. b. In the J2EE Hierarchy, expand Enterprise Applications and double-click YourBankEAR. c. When prompted, click Yes to allow the paths in the file to be auto corrected. d. Close and save the Application Deployment Descriptor. 6. Building the projects as they are would result in two PARSER_ERRORS because two Web Service WSDL files use absolute paths for import tags. The absolute paths used are only valid when the application is installed and running in the test environment. This can be addressed by changing the imports to use relative paths: a. In the J2EE Navigator view, expand YourBankWebServicesModule -> webApplication -> wsdl. b. Double-click Transfer-service.wsdl. c. In the Transfer-service.wsdl editor, select Definitions -> Import. d. Change the value of the location to Transfer-binding.wsdl. e. Press Enter before you close the editor so the change will be recognized. f. Close the Transfer-service.wsdl editor and save the changes. g. Double-click webservicesHelper-service.wsdl. h. In the webservicesHelper-service.wsdl editor, select Definitions -> Import. i. Change the value of the location to webServicesHelper-binding.wsdl. j. Press Enter before you close the editor so the change will be recognized. k. Close the webservicesHelper-service.wsdl editor and save the changes. 7. Build the projects: a. Select Project -> Rebuild all. This should resolve all errors in the Task List. There will still be a number of warning and informational messages. b. Select Window -> Preferences -> Workbench and check the Perform build automatically check box. c. Click OK. This will result in several errors in the Task List. These errors will be addressed in the next section.
351
8. Configure the WebSphere Version 4 Test Environment: The migrated application will be tested in the WebSphere 4.0 Test Environment that was migrated from WebSphere Studio 4.0. a. Switch to the Server perspective. b. In the Server Configuration view, expand Server Configurations and double-click WebSphere 4.0 Test. c. When prompted, click Yes to allow the editor to fix project entries automatically. d. When prompted, click Yes to allow the editor to fix paths automatically. e. Close and save the WebSphere 4.0 Test editor. f. In the Server Configuration view, expand Server Configurations and WebSphere 4.0 Test. g. Right-click YourBankEAR and select Remove. h. Right-click WebSphere 4.0 Test under Server Configurations and select Add -> YourBankEAR. 9. Test the application: a. In the Servers view, right-click WebSphere 4.0 Test and select Publish. b. When publishing completes, click OK. c. In the Servers view, right-click WebSphere 4.0 Test and select Start. d. Watch the console for the message: Server Default Server open for e-business. e. To test the Web Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebModule/. f. To test the Web Service Module (and the underlying EJBs) go to http://localhost:8080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp. g. In the Servers view, right-click WebSphere 4.0 Test and select Stop. 10.Check the updated projects into CVS: a. Switch to the Resource perspective and expand all the project folders in the Navigator view. b. In each project, right-click .vcm_meta, select Delete and click Yes to confirm. c. In the Navigator view, select the Servers, YourBankEAR, YourBankEJBModule, YourBankWebModule, and YourBankWebServicesModule projects.
352
d. Right-click the selected projects and select Team -> Synchronize with Repository. e. In the Synchronize view, right-click each project and select Commit. f. When you are prompted to add resources to version control, click Yes. g. When prompted for a commit comment, type one in and click OK. The migration to WebSphere Studio 5.0 is complete.
Migration steps
1. Create a WebSphere 5.0 server: a. Switch to the Server perspective. b. Select File -> New -> Server and Server configuration. c. Type in the server name WebSphere 5.0 Test. d. Make sure the folder Servers is selected. e. Select server type. Click WebSphere Version 5.0 -> Test Environment. f. Click Finish. 2. Configure the server: a. In the Server Configuration view, double-click WebSphere 5.0 Test under Server Configurations. b. Click the Data source tab of the WebSphere 5.0 Test editor. c. Click the Add button next to JDBC Providers. d. Select IBM DB2 for the Database type and DB2 JDBC Provider for the JDBC Provider Type. e. Click Next. f. Type the name DB2 Non-XA. g. Click Finish. h. Click Add next to the data sources defined in the JDBC Provider. i. Select Version 4.0 data source and click Next.
353
j. Type YourBank for the name. k. Type jdbc/YourBank for the JNDI name. l. Type BankData for the database name. m. Type in the appropriate values for the default user ID and default user password. n. Click Finish. o. Close the WebSphere 5.0 Test editor and save your changes. p. Right-click the WebSphere 5.0 Test Server Configuration in the Server Configuration view and select Add -> YourBankEAR. 3. Update the Web Service application: The Web Service Project uses some Java Helper classes in which the server's URL is hard coded. These need to be updated to run on the new server, which listens on port 9080 instead of 8080. a. Switch to the J2EE perspective b. In the J2EE Navigator view, open YourBankWebServiceModule -> source -> proxy.soap -> webServicesHelperProxy.java. c. Change stringURL from http://localhost:8080/... to http://localhost:9080/... d. Close and save webServicesHelperProxy.java. e. Update the stringURL in proxy.soap.com.ibm.yourbank.ws.webServicesHelperProxy.java and proxy.soap.com.ibm.yourbank.ejb.TransferProxy.java. f. Open YourBankWebServiceModule -> webApplication -> dds.xml. g. Expand root -> isd:service -> isd:provider and the second isd:option. h. Change the ContextProviderURL from iiop://localhost:900 to iiop://localhost. i. Close the dds.xml editor and save the changes. j. Expand the wsdl directory. k. Edit Transfer-service.wsdl and webServicesHelper-service.wsdl. Change all instances of http://localhost:8080 to http://localhost:9080. 4. Test the application. a. Switch to the Server perspective. b. Right-click WAS 5.0 Test in the Servers view and select Publish. c. When Publishing completes click OK. d. Right-click WAS 5.0 Test in the Servers view and select Start.
354
e. Watch the console for the message Server server1 open for e-business. f. To test the Web Module (and the underlying EJBs) go to http://localhost:9080/YourBankWebModule/. g. To test the Web Service Module (and the underlying EJBs) go to http://localhost:9080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp. h. In the Servers view, right-click WAS 5.0 Test, and select Stop.
Migration steps
1. Migrate YourBankEAR to J2EE 1.3: a. Switch to the J2EE perspective. b. In the J2EE Navigator, right-click YourBankEAR and select Migrate -> J2EE Version 1.2 to 1.3. c. When prompted to confirm the migration, click OK. d. When prompted to repair the server configuration, click OK. e. When the migration completes, click OK. 2. Migrate YourBankEJBModule to J2EE 1.3: a. Switch to the J2EE perspective. b. In the J2EE Navigator, expand EJBModules -> YourBankEJBModule and double-click Account. c. Highlight Account under Beans and click Remove. d. Clear all check boxes except Delete Deployed Code and click OK. e. Close the EJB Deployment Descriptor editor and save your changes.
355
f. In the J2EE Navigator, right-click YourBankEJBModule and select Migrate -> J2EE Version 1.2 to 1.3. g. When prompted to confirm the migration, click OK h. When the migration completes, click OK 3. Migrate the Account bean definition to EJB 2.0: There are no code changes to migrate session beans to EJB 2.0, so the Transfer bean was automatically migrated to EJB 2.0 when the project was migrated to J2EE 1.3. The Account bean, however, was left as an EJB 1.1 bean. It must be migrated to EJB 2.0. a. In the J2EE Hierarchy, expand EJBModules -> YourBankEJBModule and double-click Account. b. In the EJB Deployment Descriptor editor, highlight Account under Beans and click Remove. c. Clear all check boxes except Delete Bean Only and click OK. d. Click Add under Beans. e. Select Entity bean with container managed persistence (CMP) fields and CMP 2.0 Bean. f. Type the bean name: Account. g. Select the Default package: com.ibm.yourbank.ejb and click Next. h. Un-check Local client view and check Remote client view. i. Change the EJB binding name to ejb/Account. j. Click Finish. k. In the Beans tab of the EJB Deployment Descriptor editor, in the WebSphere Bindings section, type in the CMP Container Factory JNDI Name: jdbc/YourBank. l. Close and save the EJB Deployment Descriptor editor. 4. Migrate the Account bean code to EJB 2.0: a. In the J2EE Hierarchy view, expand EJB Modules -> YourBankEJBModule. b. Right-click Account and select New -> CMP Field. c. Enter the Name: type and the Type: int. d. Un-check all boxes and click OK. e. Add the following CMP fields: i. balance (float) ii. accountOwner (String)
356
f. Double-click AccountBean to launch the Java editor to make the rest of the changes. g. Delete the field definitions for accountNumber, type, balance and accountOwner. h. Add the following declarations:
public abstract long getAccountNumber(); public abstract void setAccountNumber(long acctNum);
i. Replace all direct references to the persistent fields with references to the getters and setters. For example, in ejbCreate, change:
this.accountNumber = accountNumber;
to
setAccountNumber(accountNumber);
j. Close and save the AccountBean.java editor. 5. Update the mapping and generate code: a. In the J2EE Hierarchy expand YourBankEJBModule -> Maps -> DB2 UDB V7.1 and double-click BankData. b. In the Map.mapxmi editor, select Account in the Enterprise Beans pane and ACCOUNT in the Tables pane. c. Right-click either Account, and select Match by Name. d. Close the Map.mapxmi editor and save your changes. e. In the J2EE Hierarchy view, right-click YourBankEJBModule and select Generate -> RMIC and Deploy Code. f. Select both beans and click Finish. 6. Migrate YourBankWebModule and YourBankWebServicesModule to J2EE 1.3: a. In the J2EE Navigator, right-click YourBankWebModule and select Migrate -> J2EE Version 1.2 to 1.3. b. When prompted to confirm the migration, click OK. c. When prompted to update links to moved or renamed files, click No. d. When the migration completes, click OK. e. In the J2EE Navigator, right-click YourBankWebServicesModule and select Migrate -> J2EE Version 1.2 to 1.3. f. When prompted to confirm the migration, click OK. g. When prompted to update links to moved or renamed files, click No. h. When the migration completes, click OK.
357
7. Configure the test server: a. Switch to the Server perspective. b. In the Server Configuration view, double-click WebSphere 5.0 Test under Server Configurations. c. Click the Data source tab. d. Highlight the YourBank data source and click Remove. e. Click Add next to the data sources defined in the JDBC Provider. f. Select Version 5.0 Data Source and click Next. g. Type YourBank for the name. h. Type jdbc/YourBank for the JNDI name. i. Check the Use this data source in container managed persistence box. j. Click Next. k. Click databaseName in Resource Properties and type in the Value: BankData. l. Click Finish. m. Click Add next to Resource properties defined for the data source. n. Add a property name: user and a type: String, and set the value to the appropriate database user. o. Click OK. p. Add a String property named password and set the value appropriately. q. Close the WebSphere 5.0 Test editor and save your changes. r. In the Server Configuration view, expand Server Configurations -> WebSphere 5.0 Test. s. Right-click the WebSphere 5.0 Test Server Configuration in the Server Configuration view and select Add -> YourBank1.3EAR. 8. Test the Web application. a. Switch to the Server perspective. b. Right-click WebSphere 5.0 Test in the Servers view and select Publish. c. When publishing completes, click OK. d. Right-click WebSphere 5.0 Test in the Servers view and select Start. e. Watch the console for the message Server server1 open for e-business.
358
f. To test the Web Module (and the underlying EJBs) go to http://localhost:9080/YourBankWebModule/. g. To test the Web Service Module (and the underlying EJBs) go to http://localhost:9080/YourBankWebServicesModule/sample/Transfer/T estClient.jsp. h. In the Servers view, right-click WAS 5.0 Test and select Stop.
359
360
11
Chapter 11.
361
Front-Tier Presentation
Back-Tier RDB
The sample Big3 application is a model of an insurance claim processing application. It consists of three Enterprise Java Beans (EJBs) and two clients for the beans: a Web client consisting of two Servlets and several HTML files, and a stand-alone Java client. Two of the beans, Claim and Policy, are entity beans that use Container Managed Persistence. The third, ProcessClaimBean, is a stateless session bean. The Web client to the Big3 EJBs is made up of a set of HTML pages that gather information about the claim to be processed, and a Servlet that parses the user data and invokes the EJBs to process a claim. The Java client, big3client, uses the JNDI and RMI/IIOP protocols to locate and communicate directly with the EJBs residing on the WebSphere server. If you're not familiar with the Big3 application, refer to Appendix C, Installing the Big3 application on page 413, which contains an introduction to the Big3
362
application and instructions for installing the application in WebSphere 3.5/4.0. All source and compiled code for this application can be downloaded from the additional materials found at ftp://www.redbooks.ibm.com/redbooks/SG246910. After downloading the ZIP file, unzip it in a directory of your choice. We refer to this directory as <Big3_Dir>.
2. Create a new Web module. a. Web applications in V3.5 map to Web modules in V5.0. In this step we will create a Web module that is equivalent to a V3.5 WebApplication. b. Create a new Web module by right-clicking the Web Modules folder in the left- hand navigation pane, shown in Figure 11-3 on page 364.
363
c. Give the Web module a name of your choice, for example Big3.war as shown in Figure 11-4 on page 365.
364
d. When creating a new Web module, specify the Context Root and Default Virtual Host name on the General and Bindings tabs respectively. Maintain the same values that you had in your V3.5 installation as shown in Figure 11-4. By keeping the context root the same, you will not be required to make changes to your existing V3.5-based HTML files. Accept defaults for the remaining tabs. Click OK. 3. Add the HTML files to the Web module Big3.war:
365
a. In V3.5, HTML files are made available using the File Serving Enabler Servlet as shown in Figure 11-5. In V5.0, these files are included as resource files when creating the EAR file using AAT.
Figure 11-5 V3.5 File Serving Enabler is mapped to V5.0 Resource Files
b. Right-click Resource Files and add all seven files from <Big3_Dir>\V35\html\. 4. Add a Servlet to the Web module a. In V3.5, Servlets are specified under a Web application. In V5.0, Servlets are specified under Web Components under Web Modules as shown in Figure 11-6. Add the ProcessClaimServlet by right-clicking Web Components and selecting New.
Figure 11-6 V5.0 Servlets are specified under Web Components under Web Modules
366
b. Specify the component name as ProcessClaimServlet and enable the Component Type Servlet radio button.
Figure 11-7 Specifying the component name of the new Web component
c. In order to specify the class for ProcessClaimServlet, click Browse, as shown in Figure 11-8.
d. On the Select file for Class name window, click Browse to specify the Root Directory or Archive and select the directory <Big3_Dir>\V35. Note: In the Root Directory or Archive field, do not specify the Servlet class file. Specify the directory containing the Big3 folder. Then navigate to the Servlet in the left-hand pane as shown in Figure 11-8. Click OK. 5. Provide Servlet mapping
367
a. After installing the Servlet, you must provide the URL mapping for it. In V3.5, editing the Servlet's Web Path List as seen in Figure 11-9 does just this.
Figure 11-9 V3.5 URL mapping by editing the Servlet's Web path list
b. In V5.0, the URL mapping is specified by creating a new Servlet Mapping as shown in Figure 11-10.
c. Specify the URL pattern, which is the same as the one specified in V3.5. That way you will not have to make any changes to your existing V3.5-based HTML, files. Select ProcessClaimServlet from the drop-down menu (as shown in Figure 11-11 on page 369). Click OK.
368
6. Create an EJB module a. Right-click EJB Modules and create a new EJB module. Give it a name of your choice, such as Big3.jar (see Figure 11-12).
b. Click CMP Resource Bindings tab and specify the JNDI name as Big3DS (see Figure 11-13).
c. Click OK. 7. In this EJB module, we create three EJBs: one session bean and two entity beans. Create the session bean as follows: a. In AAT's navigation pane, expand the EJB Module Big3.jar. Right-click Session Beans and create a new session bean.
369
b. Provide values as shown in Figure 11-14. To specify the EJB class, click Browse and browse to Root Directory <Big3_Dir>\V35. In the navigation pane, expand the Big3 folder and click EJB. Select ProcessClaimBean.class in the right-hand pane. Click OK. See Figure 11-15.
c. Specify the home and remote interfaces in a similar fashion. d. On the Session Bean Properties window, click the Bindings tab and provide the JNDI name for the ProcessClaim bean. Keep the same JNDI name that you had for the V3.5 version so that the ProcessClaimServlet does not have to be edited/recompiled with a different JNDI name.
370
e. Accept the defaults for the remaining fields. Click OK. f. Now create the two entity beans, Claim and Policy. g. In AAT's navigation pane, right-click Entity Beans and create a new Entity Bean named Claim, as shown in Figure 11-17.
h. Provide the Bean class, home and remote interfaces from the directory <Big3_Dir>\V35. i. On the Advanced tab, select the 1.x version.
371
j. On the Bindings tab, specify the JNDI name of the EJB. Maintain the same name that you had in V3.5 so that other components are not affected by any hard-coded JNDI names.
k. Specify the CMP Resource Bindings by providing the JNDI name of the data source as Big3DS.
Figure 11-20 Specifying the CMP resource bindings by providing JNDI name
l. For each Entity Bean, we need to specify a CMP field. Right-click CMP Fields and click New to create a new CMP field, as shown in Figure 11-21 on page 373.
372
n. Similarly create the Policy entity bean. The JNDI name of the policy entity bean is big3/ejb/Policy. The CMP field associated with the policy entity bean is policyNo. o. You have now completed the creation of the EJB module and the EAR file. Save this file as <Big3_Dir>\V35\V35Big3.ear. 8. After creating the EAR file, verify it by clicking File -> Verify from the taskbar. Messages will appear that you're using deprecated code. For the purpose of this exercise you may ignore those messages. If performing migration of a production-level application, you must look into these errors in greater detail and perform the necessary code changes.
373
9. Now, generate deployment code for the application by clicking File -> Generate code for Deployment utility from the taskbar. Click the Generate Now button. As shown in Figure 11-23, you will see a successful completion message. The deployed EAR file will be saved as Deployed_Big3V35.ear.
b. Open the Web-based Admin GUI at http://localhost:9090/admin. c. Log in by providing an identifier of your choice. This identifier need not be a user ID on the local system.
374
d. From the navigation pane on the left, click Resources -> JDBC Providers. e. Create a new JDBC Provider by clicking the New button and provide the location of the database driver in the Classpath field. The database used in this sample is DB2 and hence we provide the location of the file db2java.zip in the Classpath field. Click Apply. f. In the same window, scroll down to see the data source links under Additional Properties. We shall create a new data source by clicking the Data Sources link. Note: Do not select the Data Sources (Version 4) link. If you try to use a Version 4 data source with an EAR file that has an EJB 2.0 module it will not work. Even though your EJB classes are at EJB 1.x level, your EJB module is at EJB 2.0 level. g. To create a new data source, click New and provide values as shown in Figure 11-25 on page 376.
375
h. Click Apply. i. On the same window, click Custom Properties and change the Database name to Big3. Click OK. Note: You must have the Big3 database already created on the system. j. Navigate back to the Data Sources window and click Big3. Scroll down and click J2C Authentication Data Entries. Click New and enter the user ID and password that can access the Big3 database as shown in Figure 11-26 on page 377. Click OK.
376
k. The definition of the data source is now complete. Click Save to apply changes to the master repository. 2. Install the EAR file a. Now, let's start installing the EAR file. From the navigation pane on the left, click Applications -> Install New Application. b. Browse to the location where you have saved the deployed EAR file for the Big3 application (see Figure 11-27 on page 378). Note: If you were not able to successfully create an EAR file, you can use the EAR file provided with the Big3 code. Browse to the directory <Big3_Dirs>\V35\Solution and use the file Deployed_V35Big3.ear.
377
c. Click Next. d. Accept all the defaults on the You can choose to generate default bindings and mappings window. Click Next. i. On the Step 1 window, accept the defaults and click Next. ii. On the Step 2 window, accept the default JNDI names and click Next. iii. On the Step 3 window, provide the JNDI name of the data source as shown in Figure 11-28 on page 379. Leave the User Name field blank. Click Next.
378
iv. On the Step 4 window, shown in Figure 11-29, select the JNDI name Big3DS_CMP from the drop-down box, check the boxes for Claim and Policy beans, and click Apply. Click Next.
Figure 11-29 Select JNDI name from drop-down box and check boxes for both EJBs
379
v. On the Step 5 window, accept the default. Click Next. vi. On the Step 6 window, accept the default. Click Next. vii. On the Step 7 window, accept the default. Click Next. viii.On the Step 8 window, click Finish. e. The application will now install. After successful installation you will the see a window as shown in Figure 11-30.
f. Save your configuration by clicking Save to Master Configuration. Click Save on the subsequent window. g. Your Big3 application is now installed on WebSphere V5. 3. Start the Big3 application a. Using the navigation pane on the left, start the Big3 application. Click Applications -> Enterprise Applications. Check the box next to Big3V35.ear and click Start. After successfully starting the application, open a Web browser and go to http://localhost:9080/Big3/index.html. Note: For the sake of simplicity, we're using port 9080, which is the internal HTTP transport in WebSphere. Alternatively, you can also use your Web Server to front this application. b. You will see the Big3 application window. On the Enter Claim Data window, click Submit with the default values. You will see a message indicating the successful processing of a claim. This completes the manual migration of the Big3 application from WebSphere 3.5 to WebSphere 5.0.
380
2. Create a WebSphere 4.0 data source: a. Go to http://localhost:9090/admin and log in to the WebGUI using a login identifier of your choice. b. Click Resources -> JDBC Providers -> Sample DB Driver. c. Scroll to the bottom of the Sample DB Driver configuration page and click Data Sources (Version 4). Note: We are required to use a WebSphere V4 compliant data source because we're installing a V4.0 compliant EAR file. d. Create a new data source by clicking New and provide values as shown in Figure 11-31 on page 382.
381
Note: You must have the Big3 database already created on your system before you can run the application. e. Click OK. f. The creation of the data source is now complete. 3. Install V4.0's Big3 application in V5.0 a. Using the WebGUI navigation pane, start the installation of a new Enterprise Application. When prompted for the EAR file, go to <Big3_Dir>\V40\solution\Deployed_V40Big3.ear. b. Accept the defaults on the remaining windows until you finish the installation. You will see the message that the application has been successfully installed. The Big3 application is now installed on WebSphere V5. 4. Testing the application a. From the navigation pane on the left, start the Big3 application. Click Applications -> Enterprise Applications. Check the box next to Big3V40.ear and click Start.
382
b. After a successful start of the application, go to http://localhost:9080/Big3/index.html. Note: For the sake of simplicity, we're using port 9080, which is the internal HTTP transport in WebSphere. Alternatively, you can also use your Web Server to front this application. c. You will see the Big3 application window. On the Enter Claim Data window, click Submit with the default values. You will see a message indicating the successful processing of a claim. This completes the manual migration of the Big3 application from WebSphere 4.0 to WebSphere 5.0.
383
Figure 11-32 WebSphere V3.5 Administrative Console with sample Big3 application installed
The objects that we migrating to V5.0 are: The application configuration: EJBs, Servlets, HTML defined for the File Serving Enabler The application files: servlets.jar, deployed EJBs.jar, and all the HTML directories WebSphere objects: Data Source, DB driver, AppServer, Servlet Engine, WebApp and EJB Container To perform this migration, we use the migration utility that is shipped with V5.0. This utility comprises of two scripts: WASPreUpgrade WASPostUpgrade These scripts are provided in the <WASV5_HOME>\bin directory. WASPreUpgrade reads the V3.5 configuration and saves it into a backup directory and then WASPostUpgrade reads that configuration into V5.0 runtime. Using these two scripts you can automatically: Package the V3.5 application files such as the Servlet JAR files, the EJB JAR files and the HTML files in a V5.0 compliant EAR file. Create the deployment descriptor for the EJBs and the Servlets based on the serialized deployment descriptor and the information in the repository.
384
Install this repackaged version of the application in WebSphere 5.0. This repackaged application should be ready to run in WebSphere 5.0 (there may be some deprecated APIs that need to be fixed, but it will still work). Migrate the WebSphere domain configuration from V3.5 to V5.0. Note: If you are using the migration utility to migrate from WebSphere 4.0, the EAR file from V4.0 is used as in WebSphere V5. Redeployment will not take place. The scripts WASPreUpgrade and WASPostUpgrade can be invoked in two ways: Automatically via the V5 installation GUI Manually by typing them on a command line
385
Figure 11-33 WebSphere installation window shows WebSphere Application Server V3.5 is installed on this machine
Figure 11-33 shows all the WebSphere installations that you have on your machine. We have only one version of WebSphere installed, which is V3.5, and so that's the only one that shows in the list. If you have multiple versions of WebSphere already installed on this machine, ensure that you highlight the correct version of WebSphere that you wish to migrate from. Also, ensure that the option to Migrate is checked. If you do not check this box, migration will not take place. Click Next.
386
Figure 11-34 Installation window showing backup directory and migration log file
In Figure 11-34, fill in the fields Backup Directory and Migration LogFile with directories of your choice. Ensure that the administrative server of the existing 3.5.x environment is running before you go to the next step. Click Next. The WASPreUpgrade script will now be invoked by the installation GUI as shown in Figure 11-35 on page 388.
387
Your V3.5 configuration will be read and backed up in the backup directory that was specified in an earlier step. This backup directory will contain all files from the directories deployableEJBs, deployedEJBs, hosts, properties and Servlets in the existing Version 3.5.x configuration. The WASPreUpgrade tool saves selected files from the V3.5 /bin directory as well. It also exports the existing V3.5 application server configuration from the repository. After successful completion of the WASPreUpgrade task, keep clicking Next and you see the invocation of the WASPostUpgrade utility as seen in Figure 11-36 on page 389.
388
This window shows the invocation of the WASPostUpgrade task. During this task, the WebSphere V3.5 information is read from the Backup directory and is imported into the WebSphere V5.0 environment. After you see the successful completion message, click Next. The migration portion of the installation is now finished. Continue with the rest of the V5.0 installation tasks until the entire installation finishes. When you start the WebSphere V5.0 instance, you will see that the V3.5 configuration has been imported into the WebSphere V5.0 runtime.
389
Where: C:\websphere_backup is currently a non-existent directory where the V3.5 configuration will be backed up. C:\WebSphere\AppServer is the installation directory of WebSphere V3.5. Note: If migrating from WebSphere 4.0, provide the installation directory of WebSphere 4.0. cocasse is the host name of the system. After your current V3.5 configuration has been backed up, you will see a successful completion message. Next, run the WASPostUpgrade command. The format of the command is:
<WASV5_HOME>\bin\WASPostUpgrade.bat <backupDirectoryName> [-import <xml data file>] [-cellName <cell name>] [-nodeName <node name>] [-webModuleAdditionalClasspath < classpath > ] [-documentRootLimit < number >] [-substitute <"key1=value1[;key2=value2;[...]]">] [-transportSeed < HTTP transport starting block >] [-traceString <trace spec> [-traceFile <file name>]]}
Where C:\websphere_backup is the backup directory specified in the WASPreUpgrade script. Running this utility may take several minutes because during this task, a new EAR file will be created and EJBs will be deployed to run in V5.0, and so on.
390
After successful completion of WASPostUpgrade, you can move the EJB and Web modules to an application server of your choice. Move Big3.jar and Big3.war to application server server1. Start the enterprise application. To test the migrated application, go to http://localhost:9080/Big3/index.html. Accept the default values and click Submit. You will see a message indicating an error. The error message states that access to the database has failed because the table EJB.POLICYBEANTBL cannot be found. We know that the table name is POLICY and not EJB.POLICYBEANTBL, but the migration utility assumes the schema name to be EJB and appends BEANTBL to the table name, thus causing the failure. This will happen when you try to migrate any EJBs that were originally deployed in WebSphere V3.5 using VisualAge for Java's EJB Deployment feature. The EJBs in the Big3 application had also been deployed using VisualAge for Java. In order to rectify this problem, these EJBs will have to be redeployed using tools other than VisualAge for Java, such as AAT or WebSphere Studio Application Developer. In this example we will not be redeploying these EJBs. Please refer to previous sections of this chapter for instructions on using AAT for deploying EJBs. The scenario that we've discussed above is a single node, single application server scenario and does not explain the single node, multiple application servers topology. Multiple application servers can also be migrated in a similar fashion as shown in the single node, single application server scenario. Each new application server in V3.5 will become a new application server in the V5.0 installation.
391
samples in this section. The FP level of your V3.5 installation can be found in <WAS35_HOME>\properties\com\ibm\websphere\product.xml. The following two interoperability scenarios are discussed in this section: A Servlet running in V3.5.6 and invoking a Session EJB in V5.0 A stand-alone Java client using WebSphere V3.5.6's code to invoke a Session EJB in V5.0 The above migration scenarios can have the variations shown in Table 11-1.
Table 11-1 Interoperability scenarios
Client V3.5.6 client (Servlet/session bean or stand-alone Java client) Server EJB 1.0 in an EJB 1.1 module Notes An EJB 1.1 module is one that's been developed by WebSphere V4's AAT. The WebSphere V5.0 migration utilities (WASPreUpgrade and WASPostUpgrade) also generate an EJB 1.1 module. From an interoperability standpoint, this is a supported configuration. In this section, a sample is provided for this configuration. An EJB 1.1 module is one that's been developed by WebSphere V4's AAT. The WebSphere V5.0 migration utilities (WASPreUpgrade and WASPostUpgrade) generate an EJB 1.1 module. This interoperability scenario is a supported configuration. An EJB 2.0 module is created using WebSphere V5.0's AAT. This scenario is not supported.
392
To run this sample scenario in your environment, perform the following steps: 1. Install the Big3 server in V5.0. Install the EAR file <Big3_Dir>\V40\solution\V40Big3.ear in WebSphere V5.0. For installation instructions, refer to 11.1, Migrating the WebSphere runtime to V5.0 on page 362. 2. Create a Name Space Binding in V5.0. In order to externalize the EJBs in V5.0 to a V3.5 based Java program, we need to create a Name Space Binding for the ProcessClaimBean. Using V5.0's WebGUI, click Environment -> Naming -> Name Space Bindings. Click New to create a new Name Space Binding and enter values as shown in Figure 11-38 on page 394.
393
3. Install the Big3 application's WebApp in WebSphere 3.5.6. Follow the steps in Appendix C, Installing the Big3 application on page 413 to install Big3 application's Web application. In this sample, since you will be using the EJB from the V5.0 runtime, do not install the EJB container in the V3.5.6 runtime. If you already have the Big3 application set up on V3.5.6, delete the EJB container to be sure that your classpath does not pick up the EJB classes at the V3.5 level. Your configuration should look like Figure 11-39 on page 395.
394
Figure 11-39 V3.5 advanced Administrative Console showing the installed Big3 application
4. Update the classpath of Big3 server to point to Deployed EJBs in V5.0. Add <WASV5_HOME>\installedApps\<node>\V40Big3.ear\Big3.jar to the Big3 AppServer's classpath as shown in Figure 11-40.
Figure 11-40 Updating the Big3 server classpath to include V5.0 deployed EJBs
395
5. Test your V3.5 and V5.0 interoperability scenario Start the Big3 Server in 3.5.6. Start IBM HTTP Server that points to V3.5.6. Start the Big3 server in V5.0. You should now be able to test the above configuration by pointing your browser to http://localhost/Big3/index.html. This URL points to IBM HTTP Server, which in turn forwards it to WebSphere V3.5's Big3 application. When you see the Big3 claim options, change the ProcessClaim IIOP URL to iiop://localhost:2809/ since V5.0's default bootstrap port is 2809. This is shown in Figure 11-41.
The Big 3
Figure 11-41 Setting the URL to the V5.0 default bootstrap port 2809
396
iiop://localhost:2809/ ProcessClaimBean
Figure 11-42 V3.5 Servlet communication with V5.0 EJB using the V5.0 default bootstrap port 2809
This sample consists of a Big3 Java client in WebSphere 3.5.6 invoking an EJB 1.0 packaged inside an EJB 1.1 module deployed in WebSphere 5.0. Here are the steps to test this configuration in your environment: 1. Install the enterprise application Big3V35.ear. If you've completed steps in 11.1.1, Example: V3.5 to V5.0 manual migration on page 363 or 11.1.2, Example: V4.0 to V5.0 manual migration on page 381, you need not perform any additional tasks. Otherwise, install the Big3 application in V5 as described in 11.1.1, Example: V3.5 to V5.0 manual migration on page 363. 2. Prepare the Java client a. Change directory to <Big3_Dir>\V35. b. Open the batch file RunV35Client.bat in a text editor. Prior to running the client, make sure that the various environment variables accurately reflect your system. Make sure that the file <WASV5_HOME>\installedApps\<node>\Deployed_V35Big3.ear\Big3.jar is in the client's classpath. 3. Run the Java client a. Run the batch file RunV35Client.bat in the following manner:
<Big3_Dir>\V35\RunV35Client.bat 4545 5656 3434 "localhost:2809"
Since the default bootstrap port of WebSphere V5.0 is at port 2809, we need to specify that port. If no port is specified, "localhost" is used and it will default to the IIOP port 900, which is the default bootstrap port for V3.5.
397
You will see a message indicating that the transaction was successful. This completes the interoperability samples for WebSphere V3.5 and V5.0.
Figure 11-43 Configuring Web server to load the WebSphere V4.0 plug-in
2809 is the default bootstrap port of WebSphere V5.0. Click Submit. You will see a message indicating successful completion of the transaction.
398
Since the default bootstrap port of WebSphere V5.0 is at port 2809, we need to specify that port. If no port is specified, localhost is used and it will default to the IIOP port 900 which is the default bootstrap port for V3.5. You will see a message indicating that the transaction was successful. This completes the interoperability samples for WebSphere V4.0 and V5.0.
399
You can test a subset of the production machines by migrating only a few of them to V5.0. The trusted V3.5/V4.0 installation is still in place receiving the bulk of requests from clients. Coexistence of V3.5/V4.0 and V5.0 domains can be achieved either at the HTTP Sprayer level or at the WebSphere Web Server plug-in level. We tested the Big3 application in both these configurations.
HTTP Client V3.5 AppServer HTTP HTTP Sprayer Network HTTP Such as IBM eNetwork Dispatcher HTTP V5.0 AppServer V5.0 AppServer
Figure 11-44 Architecture for supporting a combination of WebSphere V3.5 and V5.0, or WebSphere V4.0 and V5.0 using an HTTP sprayer
400
Coexistence of V3.5/V4.0 and V5.0 nodes at the Web Server plug-in level
By running the V3.5/V4.0 plug-in and the V5.0 HTTP Server Plug-in within the same Web Server, V3.5 WebSphere nodes can co-exist with V5.0 WebSphere nodes at the same time. This lets a cluster of V3.5 machines and a cluster of V5.0 machines coexist as you migrate machines one at a time from V3.5 to V5.0.
HTTP Client V3.5 or V4.0 AppServer HTTP WebSphere Plug-In HTTP Web Server HTTP Such as IBM eNetwork Dispatcher OSE/ HTTP V3.5 or V4.0 AppServer
Network
Figure 11-45 Architecture for supporting a combination of WebSphere V3.5 and V5.0, or WebSphere V4.0 and V5.0 using WebSphere plug-ins
401
2. Ensure that the IBM HTTP Server machine has V3.5 and well as V5.0 plug-ins installed. 3. Open <IHS_HOME>\conf\httpd.conf in a text editor and configure both plug-ins as in the following example.
# Plugin for WebSphere V5.0 LoadModule ibm_app_server_http_module "C:\Program Files\WebSphere\AppServer/bin/mod_ibm_app_server_http.dll" WebSpherePluginConfig "C:\Program Files\WebSphere\AppServer/config/plugin-cfg.xml" # Plugin for WebSphere V3.5 LoadModule ibm_app_server_module D:/WebSphere/AppServer35/bin/mod_ibm_app_server.dll Alias /IBMWebAS/ "D:/WebSphere/AppServer35/web/" NcfAppServerConfig BootFile D:\WEBSPH~1\APPSER~1\properties\bootstrap.properties
# Plugin for WebSphere V5.0 LoadModule ibm_app_server_http_module "C:\Program Files\WebSphere\AppServer/bin/mod_ibm_app_server_http.dll" WebSpherePluginConfig "C:\Program Files\WebSphere\AppServer/config/plugin-cfg.xml"
The limitation in the above configuration is that we cannot have the same URI being serviced by both WebSphere versions. For example, if both WebSpheres have the same URI configured in their plug-ins, we will see duplication of URIs and the operating behavior will be erratic.
402
This incremental migration strategy works well when we break down the V5.0 and V3.5 domains by Web applications, so that they do not have a URI overlap, otherwise whichever URI loaded last will service the request. This cannot be used to load balance the same URI in an environment that has a combination of V3.5 and V5.0, but instead can be used to service independent Web applications in a V3.5 and V5.0 hybrid environment.
403
404
Appendix A.
405
# There is no default value; localhost is assumed if no value is given. #------------------------------------------------------------------------#com.ibm.ws.scripting.host= #------------------------------------------------------------------------# The defaultLang property determines what scripting language to use. # Jacl is the sole supported language #------------------------------------------------------------------------com.ibm.ws.scripting.defaultLang=jacl #------------------------------------------------------------------------# The traceFile property determines where trace and logging # output are directed. If more than one user will be using # wsadmin simultaneously, different traceFile properties should # be set in user properties files. # The default is that all tracing and logging go to the console; # it is recommended that a value be specified here. # If the file name contains DBCS characters, use unicode format such as \uxxxx, where xxxx is a number #------------------------------------------------------------------------com.ibm.ws.scripting.traceFile=C:/WebSphere/AppServer/logs/wsadmin.traceout #------------------------------------------------------------------------# The validationOutput property determines where validation # reports are directed. If more than one user will be using # wsadmin simultaneously, different validationOutput properties should # be set in user properties files. # The default is wsadmin.valout in the current directory. # If the file name contains DBCS characters, use unicode format such as \uxxxx, where xxxx is a number #------------------------------------------------------------------------#com.ibm.ws.scripting.validationOutput= #------------------------------------------------------------------------# The traceString property governs the trace in effect for # the scripting client process. # The default is no tracing. #------------------------------------------------------------------------com.ibm.ws.scripting.traceString=com.ibm.*=all=enabled #------------------------------------------------------------------------- # The profiles property is a list of profiles to be run before # running user commands, scripts, or an interactive shell. # securityProcs is included here by default to make security # configuration easier. #------------------------------------------------------------------------com.ibm.ws.scripting.profiles=C:/WebSphere/AppServer/bin/securityProcs.jacl #-------------------------------------------------------------------------
406
# The emitWarningForCustomSecurityPolicy property controls whether # message WASX7207W is emitted when custom permissions are found. # Possible values are: true, false # The default is "true" #------------------------------------------------------------------------# com.ibm.ws.scripting.emitWarningForCustomSecurityPolicy=true #------------------------------------------------------------------------# The tempdir property determines what directory to use for temporary # files when installing applications. # The default is that the JVM decides -- this is java.io.tmpdir #------------------------------------------------------------------------#com.ibm.ws.scripting.tempdir= #------------------------------------------------------------------------# The validationLevel property determines what level of validation to # use when configuration changes are made from the scripting interface. # Possible values are: NONE, LOW, MEDIUM, HIGH, HIGHEST # The default is HIGHEST #------------------------------------------------------------------------#com.ibm.ws.scripting.validationLevel= #------------------------------------------------------------------------# The crossDocumentValidationEnabled property determines whether the validation # mechanism examines other documents when changes are made to one document. # Possible values are: true, false # The default is true #------------------------------------------------------------------------#com.ibm.ws.scripting.crossDocumentValidationEnabled= #------------------------------------------------------------------------# The classpath property is appended to the list of paths to search for # classes and resources. # There is no default value. #------------------------------------------------------------------------#com.ibm.ws.scripting.classpath=
The com.ibm.ws.scripting.traceFile and com.ibm.ws.scripting.validationOutput properties specify the names of output files. If an installation intends to have several users running wsadmin scripts on the same machine at the same time, this property should be defined in the user default properties file.
407
408
Appendix B.
409
Notes:
1 2
Servlet 2.2/ JSP 1.1 Introduced in V3.5.2 Superset of Preceding API 3 Support in AE, JCA Adopted after J2EE 1.2 4 plus Extension
In accordance with the Servlet 2.3 specification, HttpSession objects must be scoped within a single Web application context; they may not be shared between contexts. This means that a session can no longer span Web applications. Objects added to a session by a Servlet or JSP in one Web application cannot be accessed from another Web application. The same session ID may be shared (because the same cookie is in use), but each Web application will have a unique session associated with the session ID. Relative to session security, the default Session Manager setting for Integrate Security is now false. This is different from the default setting in some earlier releases.
410
In V3.5, JSPs that contained the usebean tag with scope set to session did not always work properly when session persistence was enabled. Specifically, the JSP writer needed to write a scriplet to explicitly set the attribute (that is, call setAttribute()) if it was changed as part of JSP processing. Two new features in Version 5.0 help address this problem: You can set dosetattribute to true on the JSP InitParameter. You can set the Write Contents option to Write all. The differences between the two solutions are summarized in the following table:
dosattribute set to true Applies to Configured at Action JSP JSP enabler Assures that JSP session-scoped beans setAttribute() Write Contents option set to Write Servlet or application All session data (changed or unchanged) all JSP server external location
If session persistence is enabled and a class reload for the Web application occurs, the sessions associated with the Web application are maintained in the persistent store and will be available after the reload. Some of these differences might impact how you choose to track and manage sessions.
Table B-2 Summary matrix for migrating applications to WebSphere V5.0
Functional area Support in 3.5.x or 4.x version Must migrate from Version 3.5.x? Yes Must migrate from Version 4.x? Not applicable Details
Enterprise Beans
EJB 1.0
Many EJB 1.0 applications can run unchanged in Version 5.0 although some changes may be required or recommended. Full support for EJB 1.1 is provided. Many applications can run unchanged in Version 5 although some changes may be required or recommended.
No Not applicable
411
Functional area
Details
JSP files
JSP 1.0 APIs are a pure subset of JSP 1.2. JSP 1.1 APIs are a pure subset of JSP 1.2. Changes might be required due to J2EE security. Many Servlet 2.1 applications can run unchanged in Version 5 although changes might be required or recommended. Servlet 2.2 APIs are a pure subset of Servlet 2.3. Many applications can run unchanged in Version 5 although changes might be required or recommended. Change in import statement. Also, one data source connection cannot be used across multiple user transactions. Many applications can run unchanged although changes to use new support are recommended. Changes to move to the supported API XML4J V4.0.6 level are required. Recompilation is required to convert to XML4J V4.0.6. Use JMX supported provided by WSAdmin. See 6.2, Current usage of XMLConfig and wscp on page 204. Use JMX supported provided by WSAdmin. See 6.3, wsadmin primer on page 206 and 6.4, Migration mapping on page 226.
Security Servlets
IBM Security Servlet 2.1 Specification and IBM extensions Servlet 2.2 Specification IBM Sessions IBM Transactions Apache SOAP 2.2 XML 2.0.x supported XML4J V3.1 XMLConfig
Servlets Sessions
No Yes
No Yes
Transactions
Yes
No
Web services
Yes
XML Parser XML Parser XML configuration tool WebSphere Control Program
wscp
Yes
Yes
412
Appendix C.
413
Front-tier Presentation
Policy bean
Back-tier RDB
Session Bean
Database
Client
The source code for Big3 is in the folder <Big3_Dir>\V35\source. 1. Start the V3.5 adminserver and adminclient as you normally would. 2. Configure the Big3 data source: In this sample, we use a DB2 data source. If you already have a JDBC driver for DB2, you can use it for this sample as well. Otherwise, create a JDBC driver as follows: a. From the Type view of the adminclient, right-click the JDBCDrivers folder and click Create from the pop-up menu. This will display the Properties window where information concerning the JDBC Driver needs to be specified.
414
DB2Driver jdbc:db2 (accept the default value) false (accept the default value)
c. After the values have been entered, click OK in the Properties window. Right-click the DataSources folder, then click Create. In the Properties window, enter the following values:
Note: The database specified in the database name should be created prior to running the application. Make sure that the database Big3 exists in your DB2 installation. Data Source Name Database Name DB2Driver
big3DS big3 DB2Driver
d. Click OK and wait for the confirmation window to appear. Again, you can check the Topology view for the big3DS data source entry. Select Default DataSource to view the properties sheet. e. From the Topology view, locate the DB2Driver that you have already created. f. Right-click the driver, then select Install. This will display an Install Driver window. g. Select your local machine as the node on which to install the driver. This will enable the Browse button. Select the file <DB2_HOME>\sqllib\java\db2java.zip and click Open. The path name appears in the JAR file field. h. To complete the configuration, click Install. A confirmation window will appear indicating that the administrative server is now aware of the location of the JDBC driver code. i. The configuration for database support is now complete. In the next step you will create the EJB container that will make use of this data source. 3. Create the Big3 Application Server: In this step, you configure the Big3 application code, including the HTML pages, Servlet, and Enterprise Java Beans, using the Administrative Console. First, you create an application server to host the EJB container and the Servlet Engine. The Big3 EJBs will be deployed into the EJB container, and the Servlets and HTML pages will be deployed in a Web application within the Servlet Engine.
415
The Administrative Console provides wizards that allow for the configuration and customization of all these objects. The wizards are located on the toolbar. Click the magic wand icon to display the list of task wizards. Alternatively, you can click the Console menu and select Tasks from the drop-down menu. a. To create an application, select Create Application Server from the list of tasks. An explanation of the task will appear in the content pane. b. When the wizard starts, select the Enterprise Beans and Web Applications checkboxes and click Next. c. If you do not select any choices, an application server without any resources will be created. These resources can be added later. However, we will add them now. Selecting Enterprise Beans allows for the configuration of a container and enterprise beans. The Web Applications option allows for the configuration of a Servlet Engine, a Web application and a Servlet. d. The next window allows you to configure the properties of application server. Under the General view, these settings are grouped under the title of EJBServer Properties. Specify the following values:
f. The next window lets you specify whether the application should be started automatically after the configuration is complete. Select Do not start the server automatically after creating it and click Next. g. Specify the node on which the application server will reside. Select the node and click Next. 4. Install the EJBs: You are now ready to deploy the enterprise beans for the Big3Server to manage. a. Click Browse. The browse window displays the <WAS35_HOME>\deployedEJBs directory. b. Select the file <Big3_Dir>\V35\solution\big3deployed.jar. Click Select. Select Yes to confirm you want to deploy all of the EJBs and deploy the JAR file. c. Click Next. This will bring up the page to configure a container. Do the following: i. On the General tab, set the EJBContainer Name as Big3Container.
416
ii. On the DataSource tab, click the Change button and select the Big3DS data source. Click OK. Fill in the user ID and password that can access the DB. 5. Configure the virtual host: Click Next to select a virtual host. This window allows you to use an existing virtual host or create a new one. Select default_host. 6. Configure the Servlet Engine: a. Click Next to configure a Servlet Engine. On this window you can specify a name for the Servlet Engine. For the Servlet Engine name, enter Big3ServletEngine. b. Click Next to specify the Web Application properties. Use the following settings:
417
e. Click Apply. 8. Configure the ProcessClaimServlet: a. From the Wizards menu, select the Add a Servlet wizard. This will display the first page of the task. b. You are asked Do you want to select an existing Servlet JAR file or Directory that contains Servlet classes? Select No. Click Next. c. This window lets you select an application into which to add the Servlet. Expand the tree until the entry for Big3WebApp appears. Select it and click Next. d. This task has a feature that lets you pick out the type of Servlet. On this window select Create User Defined Servlet to choose the latter configuration option. Click Next. e. The physical location of the Servlet and the WebSphere alias are specified on this display. Use the following values:
Servlet Name
ProcessClaimServlet
Note: The ProcessClaim.html form's action must match the Servlet Web Path. The default_host/Big3/ is automatically prepended to the Servlet Web Path by the wizard.
g. Click Finish. Look for the confirmation window indicating success. Locate the new entry in the Topology view. Under what WebSphere resource does it appear? 9. Placing the files: Now you must move the Servlets and the HTML files into the WebSphere document root and Servlets directories: a. Make a directory in <WAS35_HOME>\hosts\default_host\ called Big3WebApp. b. Make a directory in <WAS35_HOME>\hosts\default_host\Big3WebApp\web. c. Make a directory in <WAS35_HOME>\hosts\default_host\Big3WebApp\servlets. d. Copy all the HTML files from <Big3_Dir>\V35\html to the Web directory you just created. e. Copy the file servlets JAR file from <Big3_Dir>\V35\solution to the Servlets directory you just created.
418
10.Adding aliases to the default_host: a. In the Topology view, select default_host. b. In the property sheet for the default_host, click the Advanced tab and scroll to the Host Aliases list. Add the fully qualified host name for your machine to the list. Click Apply. As you can see, there are entries for localhost, your AIX machine short name, your IP address, and now, the fully qualified name. This makes your application more accessible, enabling the use of any of these forms of address from the Web browser and Java client applications. 11.Testing the Big3 application: a. From the Topology view, select Big3Server. Click Start in the toolbar (the green arrow) or right-click Big3Server and select Start. Wait for the Big3Server and its components to start. This will be indicated by a confirmation message. b. View the Data source tab for the two entity EJBs. Note that the Create Table checkbox is no longer checked. c. Go to http://<fully_qualified_machine_name>/Big3/index.html. The main page of the Big3 Web application will appear. d. These static pages are served up by the WebSphere Administrative Server. This shows that the File Serving Enabler has been configured correctly. Click Submit on the form in the content pane. This sends the request back to WebSphere, which passes it to the ProcessClaimServlet. The Servlet invokes the enterprise beans to complete the processing. The beans use the database connections specified for the Big3EJBContainer and store information in the database. When all the transactions are completed successfully, a message showing the response time is sent back to the browser. In the event of failure, an error message indicating the failing component is returned. e. To test the EJBs using the Java client, open an MS DOS window on the Windows NT machine and change to the C:\big3 directory. Check the GetClientClassPath.bat file and make sure that the WAS_HOME is set up correctly. f. Execute the following command to run the Big3Client:
RunClient <policy_number> <claim_number> <amount_of_claim> <AIX_Machine_name>
Replace the parameters in <> with values. (For example: RunClient 1234 5678 10 XX where XX is your machine name.) g. At the completion of the test, check the database for new records. This completes the Big3 installation on V3.5.6.
419
2. Install the enterprise application Big3: a. As shown in Figure C-3 on page 421, install the EAR file <Big3_Dir>\V40\solution\Deployed_V40Big3.ear in your WebSphere V4.0 runtime.
420
b. Accept all the defaults on the subsequent window. When asked if you would like to generate deployment code for this application, select No, because the deployment code has already been generated using AAT. 3. Test your application: a. Go to http://localhost:9080/Big3/index.html. On the ProcessClaim window, click Submit with the default values. A message will appear indicating that the transaction was successful. This completes the installation of the Big3 application in WebSphere V4.0.
421
422
Appendix D.
Additional material
This redbook refers to additional material that can be downloaded from the Internet as described below.
Select the Additional materials and open the directory that corresponds with the redbook form number, SG246910.
423
Description Big3 application used in Chapter 11, System and runtime migration examples on page 361
3 MB minimum Windows/UNIX Equal or better than Pentium 500 MHz or RS/6000 375 MHz, Sparc workstation 440 MHz 512 MB RAM or greater
424
Related publications
The publications listed in this section are considered particularly suitable for a more detailed discussion of the topics covered in this redbook.
IBM Redbooks
For information on ordering these publications, see How to get IBM Redbooks on page 431.
WebSphere Studio Application Developer Programming Guide, SG24-6585 EJB Development with VisualAge for Java for WebSphere Application Server, SG24-6144 (see Appendix B) WebSphere Version 4 Application Development Handbook, SG24-6134, (See the section Migrating 1.0 EJBs to 1.1 EJBs on pages 267-268) Programming J2EE APIs with WebSphere Advanced, SG24-6124 (See the section on EJB 1.1 code changes on pages 113-114)
Other resources
These publications are also relevant as further information sources:
Enterprise Java Beans Specification, Version 1.1, available at http://java.sun.com/products/ejb/docs.html (see Section 1.3, Application compatibility).
425
The IBM WebSphere InfoCenter, found at http://www.ibm.com/software/webservers/appserv/doc/v40/aes/infocente r/index.html. Refer to the following sections: Transitioning to Version 4.0 (Click Application Server AE ->Migration -> Transitioning to Version 4.0 and read the Role-based security section.) Migrating to supported EJB specifications (Click Application Server AE -> Migration -> 3.3 Migrating APIs and specifications -> 3.3.1 Migrating to supported EJB specifications.) Migrating from Version 3.x (Click Application Server AE ->Migration -> 3.2 Migrating from previous products versions -> 3.2.2 Migrating from Version 3.x.)
Extreme Programming Explained: Embrace Change, by Kent Beck, published by Addison-Wesley, 1999 Refactoring: Improving the Design of Existing Code, by Martin Fowler, published by Addison-Wesley, 1999
426
Related publications
427
JMX Specification (JSR003): http://jcp.org/en/jsr/detail?id=3 An article on using Ant with WebSphere Studio Application Developer (including J2EE project builds/exports): http://www.ibm.com/websphere/developer/library/techarticles/0203_sea rle/searle1.html An article on optimizing complex builds in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/0204_sea rle/searle.html An article on J2EE class loading (J2EE modules and class paths) in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/0112_deb oer/deboer.html An article on developing J2EE utility JARs (Java JARs in J2EE modules) in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/0112_deb oer/deboer2.html An article on team support in WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/library/techarticles/ 0108_karasiuk/ 0108_karasiuk.html An article on migrating Enterprise Access Builder components from VisualAge for Java to WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/techjournal/0201_minocha/mino cha.html An article on EJB application design using the Session Facade to talk to CMPs: http://www.ibm.com/websphere/developer/library/techarticles/ 0106_brown/sessionfacades.html An article on WebSphere Application Server Best Practices: http://www.ibm.com/software/webservers/appserv/ws_bestpractices.pdf An article on WebSphere Best Practices zone: http://www.ibm.com/websphere/developer/zones/bp/ WebSphere Developer Domain main Web page: http://www.ibm.com/websphere/developer WebSphere Developer Domain technical articles: http://www.ibm.com/websphere/developer/techjournal/ Information about the WebSphere Studio family, and the features and directions of WebSphere Studio Application Developer: http://www.ibm.com/websphere/developer/zones/studio/transition.html
428
IBM WebSphere Studio family of development tools: http://www.ibm.com/websphere/developer/library/techarticles/0108_stu dio/studio_beta.html External Application Developer newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.application-sit e-developer External workBench (Eclipse) newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.workbench External WebSphere Application Server newsgroup: news://news.software.ibm.com/ibm.software.websphere.application-server An article on deploying a J2EE application from WebSphere Studio Application Developer to WebSphere Application Server: http://www.software.ibm.com/vad.nsf/Data/Document3584 Application Developer Software Configuration Management (Source Code Management) vendors: http://www.ibm.com/software/ad/studioappdev/partners/scm.html Migrating applications to Application Developer from competitors development tools: http://www.ibm.com/websphere/developer/zones/studio/migration.html Migrating VisualCaf WebLogic applications to Application Developer (still deploying to WebLogic): http://www.ibm.com/websphere/developer/library/techarticles/0209_sea rle/searle1.html Eclipse.org: http://www.eclipse.org WebSphere Developer Domain Plugin Central: http://www.ibm.com/websphere/developer/downloads/plugin/ Eclipse workbench plug-ins (not part of Eclipse.org): http://www.eclipse-workbench.com/jsp/plugins.jsp Eclipse plug-ins (not part of Eclipse.org): http://www.eclipse-plugins.2y.net/eclipse/plugins.jsp WebSphere V5.0 prerequisites: http://www.ibm.com/software/webservers/appserv/doc/latest/prereq.htm l J2EE 1.3 prerequisites: http://java.sun.com/j2ee/compatibility.html Java 1.3 prerequisites: http://java.sun.com/j2se/1.3/ JUnit testing tool: http://www.junit.org
Related publications
429
Ready for WebSphere Studio Software validation: http://www.developer.ibm.com/websphere/ready.html Developer Domain Application Developer Web page: http://www.ibm.com/websphere/developer/zones/studio/appdev/ eFix for Application Developer Web site: http://www14.software.ibm.com/webapp/download/product.jsp?type=s&id= SPA-524G3S The WebSphere Application Server InfoCenter: http://www.ibm.com/software/webservers/appserv/doc/v40/aes/infocente r/index.html Differences between WebSphere Application Server Version 3.5 and 4.0: http://www.ibm.com/software/webservers/appserv/doc/v40/aes/infocente r/was/03.html and http://www.ibm.com/software/webservers/betas/common/doc/migration.pd f VisualAge for Java to WebSphere Studio Application Developer export facility: http://www.instantiations.com/vaj-migrate Instantiations, Inc. Web site: http://www.instantiations.com/codepro/ws. EJB 1.1 Export Tool: http://www7.software.ibm.com/vad.nsf/Data/Document4624 Visual Composition Editor Code Generation/Export Feature:http://www7.software.ibm.com/vad.nsf/data/document4293 WebSphere Developer Domain downloadable tools Web site: http://www-3.ibm.com/software/ Latest updates and prereqs for WebSphere Application Server: http://www-3.ibm.com/software/webservers/appserv/doc/latest/prereq.h tml YourBank Application installed in WebSphere Studio Application Developer 4.0, downloadable from the WebSphere Developer Domain at http://www7b.boulder.ibm.com/wsdd/library/presents/AppDevTraining.ht ml
430
WebSphere Application Server Version 3.5 to 4.x - Migration Hints & Tips: http://www7b.software.ibm.com/wsdd/library/techarticles/0208_wright/ wright.html
You can also download additional materials (code samples or diskette/CD-ROM images) from that site.
Related publications
431
432
Index
Numerics
2809 269 900 269 testConnection 216 trace 216 Administration - other tasks Disable local OS security 241 Enable security 240 Install JDBCDrivers 241 Ping node and AppServers for current status 241 Regenerate the plug-in configuration 243 Setting the Trace specification 239 Test connections to data sources 242 Administration of configured objects Display help 237 List actions available on configured objects 237 List the configured server groups 236 Modifying attributes of application server 236 Modifying attributes of enterprise applications 236 Administration of runtime objects 236 Administrative Console Base vs ND 201 limitations 281 V3.5 198 V4.0 199 V5.0 200 Ant 71, 128, 181 API 246 Application code 24 Application management Enterprise Application - edit 235 Enterprise Application - install 233 Enterprise Application - uninstall 235 application server 9, 12 authentication 271 Automated migration support 266 autoResponseEncoding 272
A
AAT 199, 252, 363, 366, 391 AdminApp Export 220 exportDDL 220 install 219 installInteractive 219 listModules 220 options 220 uninstall 220 AdminConfig attributes 217 create 218 createClusterMember 219 createUsingTemplates 218 defaults 218 getid 219 installResourceAdapter 219 listTemplates 217 modify 218 parents 218 queryChanges 218 remove 218 save 218 showall 218 types 217 AdminControl completeObjectName 215 getAttributes 215 getCell 215 getNode 215 getPropertiesForDataSource 215 invoke 215 invoke_jmx 216 isRegistered 216 queryNames 216 setAttribute 216 startServer 216 stopServer 216
B
Bean Scripting Framework (BSF) 207 Before you migrate assessment 36 code preparation 37 education 36
433
installation of a new development environment 37 installation/upgrade of system test environments 37 plan 38 research 37 best practices suggestions 33 Big3 sample application 362 BSF 207 Build and deployment 24 build process Ant 71, 128, 181
D
Data Access Bean Builder 69 data source configuration 273 datasources.xml 273 Default Server 270 DefaultErrorReporter 271, 275276 deploying EJBs 250 deployment manager 10, 15, 270 development environment 22, 24, 27, 31, 37, 65, 72, 74, 245, 269, 287, 323 Development tool migration 81, 133 downloadable tools Web site 247 Downloads WebSphere Studio Application Developer V5 updates 83, 134 WebSphere Studio development products 82, 134
C
CACT 254 cell 10, 15 Circular project dependencies 143 Class API checker tool 254 ClearCase 90, 96, 148, 153 ClientUpgrade 256, 269 cluster 10, 16, 285 Cluster administration Clone a ServerGroup 238 Create a server group 238 Remove a clone 239 Start a ServerGroup 239 Stop a ServerGroup 239 CMP 117118, 139, 173175 CMP Resource Bindings 372 coexistence 265266, 276277, 391, 400 com.ibm.ejs.ns.jndi.CNInitialContextFactory 280 com.ibm.servlet.engine.webapp 272 com.ibm.websphere.naming.WsnInitialContextFactory 280 com.ibm.ws.webcontainer.servlet 272 Concurrent Versioning System (CVS) 70, 84, 141 configuration 268 configuration repository 284 Connection Manager 270 Container Managed Persistence (CMP) 139 content type 272 context root 275 convert EAR files 246 convert J2EE 1.2 EAR to J2EE 1.3 EAR 252 converting source code 246 Corporate WebSphere environment 26 CSIv2 282 CVS 70, 84, 90, 96, 141, 148, 153
E
EAR 8, 7172, 246, 250, 252253, 256, 272273, 275276, 279 earconvert 252 education and training 27 eFixes 279 EJB 1.0 109110, 119, 166167, 175 EJB 1.1 119, 175 EJB 2.0 119, 175 EJB Export Tool 109, 165 EJB-1.1 beans 139 ejbdeploy 250 EJBException 119, 175 EJBQL 118, 175 embedded valueTypes 280 ensure quality 276 Enterprise Access Builder (EAB) 69 enterprise application 273 Express test environment 83
F
federate 270, 284 FileServingEnabled attribute 274, 276
G
GenPluginCfg 190 getters 278 Global Security 271 guideline 103, 161, 280
434
H
Home interface 278 HTML 273 HTML and JSP distinctions 89, 146 HTTP 57, 187 HTTP Server Plugin migration Apache/IBM HTTP Server 191 Domino migration 193 IIS 195 iPlanet/Sun 192 HTTP Server Plugin V3.5 OSE plug-in 185 OSERemoteCfg 190 queues.properties 187 rules.properties 187 Servlet Redirector 187 vhosts.properties 187 HTTP Server Plugin V4.0 plugin-cfg.xml 187 HTTP Server Plugin V5.0 GenPluginCfg 190 plugin-cfg.xml 187 HTTP transports 275 httpd.conf 192
I
IBM Software Development Kits 122 and 131 280 ibm-web-ext.xmi 274 IDE 246 IIOP 57, 61, 187 incremental version upgrade 266 InitialContext 281 installation program 268 installing the Big3 application 413 integration 276 interoperability 57, 71, 265266, 276, 278279, 282, 391392, 396, 398399 InvokerServlet 271, 274, 276
java:compUserTransaction 281 JDBC driver 273 JMS listener application conversion 253 JMX 207 JNDI 413 JNDI lookup 281 JNDI name -BindJndiForEJBNonMessageBinding 235 change 235 specifying 372 JSP 273, 275 JSP .91 tags $ 248 <DBCONNECT> 248 <DBMODIFY> 248 <DBQUERY> 248 <INSERT> 248 <PARAM> 248 <PASSWD> 248 <REPEAT> 248 <REPEATGROUP> 248 <SCRIPT> 248 <SERVLET> 248 <USERID> 248 JSP .91 to JSP 1.1 conversion 246 JSP 1.01.1 tags <jsp:getProperty> 248 <jsp:include> 248 <jsp:param> 248 <jsp:setProperty> 248 <tsx:dbconnect> 248 <tsx:dbmodify> 248 <tsx:dbquery> 248 <tsx:passwd> 248 <tsx:repeat> 248 <tsx:userid> 248 JSP 1.1 246 JSP 1.2 246 jtausertransaction binding 281
J
J2EE 1.2 246 J2EE 1.3 246 J2EE build tool 71 JAR 273 Java 1.3 prerequisites 17 Java Management Extensions (JMX) 207 java.math.BigDecimal 280 java:comp 281
L
load balancer 4243, 45 load distribution 190 LoadBalanceWeight 190 LTPA 271
M
Mapping
Index
435
Bootstrap port 269 Cluster members 270 Command line parameters 269 Default Server 270 Directories 269 enterprise applications for cluster members 270 JDBC drivers and data sources 270 JSP .91 to JSP 1.01.1 248 Migration after federation 270 Name bindings 270 Node name 270 OSE plug-in to V5.0 plug-in 187 PageList Servlet 271 Properties files and classes files 271 Samples 271 Security 271 Servlet 2.1 to 2.2 249 Servlet package name changes 271 Transport ports 272 V4.0 HTTP plug-in to V5.0 plug-in 187 Web modules 272 WebSphere Application Server editions 10 wscp 4.0 to wsadmin 5.0 230 master copy 284 master repository 284 mb2mdb 253 MBeans Application 209 Application Manager 209 AppManagement 209 Cluster 210 ClusterMgr 210 DeployedObject 210 DeploymentManager 210 EJB 210 How can I add to system? 208 How to list all the methods 209 How to list the attributes 209 JDBCProvider 210 JMSDestination 210 JMSServer 210 JMXConnector 210 JVM 210 NameServer 210 NodeAgent 210 SecurityAdmin 211 Server 211 ThreadPool 211 Transaction 211
WAS40DataSource 211 WebContainer 211 What is it used for? 208 What is it? 207 memory heap size 269 migrate EJB1.1 project to EJB 2.0 project 118, 174 MigrateWC 86, 143, 246 migrating Big3 application from V3.5 to V5.0 363 migrating Big3 application from V4.0 to V5.0 381 Migrating code from EJB 1.0 to EJB 1.1 116, 172 Migrating EJB 1.x to EJB 2.0 118, 175 Migrating from Version 3.5 to 5.0 65 clones to clusters 285 Enterprise beans 273 Integration of generated EAR files into WebSphere Studio Application Developer 275 J2EE EAR files 273 J2EE security 274 JSP levels 274 OS upgrade scenarios 264 Servlet package name changes 274 Servlet Redirector 274 Transports 275 Version 3.5 datasources.xml 273 XMLConfig and wscp 228 Migrating from Version 4.0 to 5.0 72 Enterprise beans 275 J2EE security 276 JSP precompiling 275 server groups to clusters 285 Servlet package name changes 276 wscp 230 Migrating from WebSphere Studio Application Developer Version 4.0.x to Version 5.0 84, 141 Migration guide updates 135 migration of a single server 39 Migration plan Assessment 73 Build 75 Deployment and configuration 75 Development environment 74 Documentation 76 Education 73 Pre-production and production 75 Scheduling 77 System test environment 75 Testing 75 Migration scenarios Multiple applications on a single server 41
436
Multiple applications on multiple servers (horizontal migration) 46 Multiple applications on multiple servers (vertical migration) 52 Single application on a single server with one machine 39 Single application on a single server with two machines 40 Single application on multiple servers 41 migration steps 265 migration strategies divide and conquer 28 dump-and-chase 30 run, right, fast, small 31 vertical slice, 29 minimal downtime 53 mod_ibm_app_server_http.dll 192 mod_ibm_app_server_http.sosl 192 Multiple installations 277 multiple instances 277 multiple servers 41 Multiple tiers 57 multiple versions 277
P
Page Designer enhancements 88, 146 versus Page Designer Classic 88, 146 Page Designer Classic 87, 145 versus Page Designer functions 88, 146 Persistence Builder 121, 177 persistent HttpSessionState 45 Planning 276 plugin_common.dll 192 plugin-cfg.xml 187, 190 PQ51387 279 PQ60074 279 PQ60335 280 PQ60336 280 PQ63548 280 precedence 276 -preCompileJSPs option 276 pre-production environment 26 Prerequisites API prerequisites 17 J2EE 1.3 prerequisites 17 Java 1.3 prerequisites 17 most recent operating system levels and software website 268 WebSphere V5.0 prerequisites 17 prevent downtime 276 primary servers 190 production environment 23, 2527, 36, 72, 75, 77, 276, 399 production/testing environments 25
N
name binding 270 namebindings.xml 280 naming client 279 naming service 269 Network Deployment 265, 269 node 10, 13 node agent 10, 13 node configuration 284
Q
QA 276
O
Object Request Broker 279 Object Request Broker (ORB) 61 AdminConfig list 217 one-to-one mapping 274 Open Servlet Engine 186, 275 ORB 61, 279 org.omg.CORBA.MARSHAL exceptions 280 OSE 186187, 275 OSE plug-in 185, 187 OSERemoteCfg 190
R
Rational ClearCase 84, 141 Redbooks Web site 431 Contact us xvii repository 276 RMIIIOP 413 role-based authorization 274 Runtime environments 25
S
SCM 96, 153 SCM plug-ins 92, 149
Index
437
SCM repository 87, 144 secondary servers 190 Security 284 security connections 282 Server administration Connect to remote server 233 Create a new application server 232 Remove an application server 233 Start an application server 231 Stop an application server 232 server1 270 ServerCluster 190 ServerGroup 190 ServeServletsByClassnameEnabled attribute 274, 276 Servlet 2.1 to Servlet 2.2 conversion 246 Servlet 2.2 246 Servlet 2.3 246 Servlet Redirector 187 setters 278 SimpleFileServlet 271, 274, 276 snoopServlet.java 247 snoopServlet.java.new 247 snoopServlet.log 247 SOAP 57 software configuration management (SCM) 84, 141 software prerequisites 268 SSI <!-- config 248 <!-- echo 248 <!-- flastmod 249 <!-- fsize 248 <!-- include 248 SSLv3 282 stand-alone machine 276 stand-alone migration tools 245 stateless applications 45 Static versus J2EE Web projects 87, 145 supported coexistence configurations 277 SWAM 271 synchronize 284 system test environments 26
test 276 test and integrationproduction environment 276 testing 26 tools 246
U
UserTransaction 281
V
V5.0 architecture terminology application server 9 Cell 9 Cluster 9 Deployment manager 9 Node 9 Node agent 9 VirtualHost 275, 284 Visual Composition Editor (VCE) 67 VisualAge for Java Code formatter 105, 163 EJB Export Tool 109, 165 EJB server configuration 106, 163 Java files and project resource files 106, 164 Persistence Builder 121, 177 Project class path 105, 162 Resource associations 105, 163 VisualAge Persistence Builder (VAP) 69
W
WAR 273, 275 was.policy 271 WASPostUpgrade 259, 265, 268, 270, 272, 384 WASPreUpgrade 257, 264, 268, 384 Web module 276, 363 Web project 87, 144 web.xml 275276 web-application 273 WebSphere Application Server changes 85, 143 editions 10 Servlet/JSP conversion tools 85, 143 Version 4.0x versus Version 5 83, 140 WebSphere Developer Domain 247 WebSphere scripting command See wsadmin WebSphere Studio Application Developer Code formatter 105, 163 EJB 1.1 project structures 86, 144
T
TCP/IP 186 Team Server 70 Team support 94, 152 template for project plan 76
438
EJB server configuration 106, 163 Java files and project resource files 106, 164 Project class path 105, 162 Resource associations 105, 163 testing your migrated application 107, 164 Web project structures 87, 144 WebSphere V5.0 prerequisites 17 WebSphere Version 4.0.3 changes from 86, 143 WLM 190, 281 WorkLoad Management 190, 281 wsadmin AdminApp 219 AdminConfig 217 AdminControl 214 command syntax 211 connectionType 405 -conntype 212 -conntype NONE 217 Examples 214 script parameters 212 securityoff 241 securityon 240 wsadmin.properties 405 wscp ApplicationServer 231232 DrAdmin 239 EnterpriseApp 235 help 237 JDBCDriver 241 Node 243 SecurityConfig 240 ServerGroup 236 set 233 wscp.hostname 233
X
XMLConfig 229, 385 XMLconvert 86, 143
Index
439
440
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.