Application Migration Tool Built on Rational Software Analyzer technology
by user
Comments
Transcript
Application Migration Tool Built on Rational Software Analyzer technology
WebSphere Application Server Application Migration Tool Built on Rational Software Analyzer technology Version 1.2.0 July 27, 2010 A combined effort: IBM Software Group, Application and Integration Middleware Software IBM Software Group, Rational Software © Copyright IBM Corp. 2009, 2010 2 | Application Migration Tool | Contents Contents Overview................................................................................................................................ 3 New for this release...............................................................................................................4 Version 1.2............................................................................................................................................... 4 Version 1.1............................................................................................................................................... 4 Support...................................................................................................................................7 Installing and updating the migration tool.........................................................................8 Importing applications....................................................................................................... 11 Shared Java Projects...............................................................................................................................11 EAR-Level Library.................................................................................................................... 11 WAR-Level Library................................................................................................................... 13 Configuring a Java EE Runtime Library................................................................................................14 Configuring the tool for analysis....................................................................................... 17 Running analysis................................................................................................................. 22 Completing the Process...................................................................................................... 25 WebLogic to WebSphere Application Server rules and quick fixes.............................. 26 WebLogic WebLogic WebLogic WebLogic Java code review rules..........................................................................................................26 JSP code review rules...........................................................................................................30 XML file review rules.......................................................................................................... 30 class path review rules..........................................................................................................33 JBoss to WebSphere Application Server rules and quick fixes......................................34 JBoss Java code review rules................................................................................................................. 34 JBoss XML file review rules..................................................................................................................35 JBoss class path review rules................................................................................................................. 36 Troubleshooting.................................................................................................................. 37 Software Analyzer options not shown................................................................................................... 37 Java EE constructs or JSP not read correctly......................................................................................... 37 Logging and trace...................................................................................................................................37 Reports and history.................................................................................................................................38 Markers...................................................................................................................................................38 Known issues..........................................................................................................................................38 Copyright and trademarks.................................................................................................40 Application Migration Tool | Overview | 3 Overview Converting Java™ Platform, Enterprise Edition (Java EE) applications from one third-party application server to another platform can be costly and time consuming. The conversion process can involve modifying Java source code, JavaServer™ Pages (JSP), and deployment descriptors. The Application Migration Tool can assist you in performing these types of migrations. The Application Migration Tool is part of the IBM® WebSphere® Application Server Migration Toolkit. This toolkit is part of the overall strategy and plan for assisting customers in migrating from one application server to the IBM WebSphere Application Server. This document explains how to install, configure, and use the tooling to assist in the conversion process. The tooling is based on IBM Rational® Software Analyzer, which provides a single solution to identify, analyze, and optimize the application health. The migration tool uses the scanning capabilities of Rational Software Analyzer to look for specific constructs unique to the Oracle® WebLogic application server. The tool then provides a way to review and change that data so that the application can run on IBM WebSphere Application Server. The tool flags a number of known differences between applications hosted on Oracle WebLogic or JBoss and WebSphere Application Server. In many cases, the tool can automatically convert these key differences. If the tool is unable to perform the fix, it flags the file in question to provide insight to where design changes are needed. The migration tool supports: • • • • • Migrating applications to WebSphere Application Server Version 7 Migrating WebLogic Java, JSP, and class path artifacts (Java EE 5 and prior versions) Migrating WebLogic deployment descriptors (Java EE 5 and prior versions) Migration JBoss Java and class path artifacts (Java EE 5 and prior versions) Migrating JBoss deployment descriptors (Java EE 5 and prior versions) 4 | Application Migration Tool | New for this release New for this release Version 1.2 Application Migration Tool version 1.2 adds support to existing rules and quickfixes for Java EE 5, and it provides additional rules for JBoss migration. New JBoss rules and quick fixes: • • Use WebSphere extensions to define CMP mappings Use WebSphere bindings to define message-driven bean JNDI names Rules with Java EE 5 support: • • • • • • • • Do not use local JNDI names Use WebSphere bindings to define EJB JNDI names Use WebSphere bindings to define EJB reference names Use WebSphere bindings to define resource reference names Use WebSphere extensions to define concurrency strategy Use WebSphere extensions to define transaction timeout seconds Use WebSphere extensions to define Web module context root Use WebSphere bindings to define message-driven bean JNDI names The tool is translated into the following additional languages: • • • • • • • German (de) Spanish (es) French (fr) Japanese (ja) Korean (ko) Brazilian Portuguese (pt_BR) Simplified Chinese (zh_CN) Version 1.1 Application Migration Tool version 1.1 adds new rules and quick fixes for WebLogic deployment descriptor migration (J2EE 1.4), additional rules for WebLogic Java code (including Java EE 5, EJB 3, and JPA), and JBoss support. Also new in this release is the Quick Fix All Category results menu option. Quick Fix All Category has a larger scope than Quick Fix All and allows you to run all quick fixes for the selected rule provider with one click. When quick fixes are applied for deployment descriptor rules, the line in the WebLogic or JBoss deployment descriptor is commented with a <!--$ANALYSIS-IGNORE, QUICKFIX APPLIED--> comment. This comment prevents the rule from triggering again and allows you to review your WebLogic and JBoss deployment descriptors to verify that all information was migrated. WebLogic Java rules and quick fixes: • • Do not use Commons Logging system level property1 Do not use invalid JPA imports3 Application Migration Tool | New for this release | 5 • • • • • • • • • • • • • • • • • • • • Do not use kodo properties that have no openJPA equivalent1 Use OpenJPA property names instead of Kodo-specific property names when equivalent1 Do not use non portable JPA imports1 Do not use subclass of EntityManager or EntityManagerFactory for injected JPA elements1 Do not use WebLogic log4j logging objects3 Do not use WebLogic LoggingHelper object to get Logger instance1 Do not use WebLogic logging objects1 Do not use WebLogic NonCatalogLogger object1 Do not use WebLogic servlet attributes for XML parsing1 Do not use WebLogic-specific JDBC properties or extensions3 Do not use WebLogic-specific JNDI environment properties for initial context1 Do not use WebLogic StAX objects3 Do not use WebLogic TransactionManager object3 Do not use WebLogic Transaction object3 Do not use WebLogic TransactionSynchronizationRegistry object3 Do not use WebLogic RollbackException object3 Do not use WebLogic WLLevel object1 Do not use WebLogic XPath objects3 Use OpenJPA property names instead of Kodo-specific property names when equivalent1 Use unitName attribute for injected JPA elements1 WebLogic XML rules and quick fixes: • • • • • • • • • • • • • • • Do not use local JNDI names2 Do not use WebLogic servlet filter for XML parsing1 Do not use WebLogic-specific EJB Query Language constructs3 Use WebSphere bindings to define EJB JNDI names2 Use WebSphere bindings to define EJB reference names2 Use WebSphere bindings to define message-driven bean JNDI names2 Use WebSphere bindings to define resource reference names2 Use WebSphere extensions to define CMP mappings1 Use WebSphere extensions to define concurrency strategy2 Use WebSphere extensions to define transaction timeout seconds2 Use WebSphere extensions to define Web module context root1 Do not use kodo PersistenceServerServlet in web.xml1 Do not use kodo properties that have no openJPA equivalent1 Do not use kodo-specific values for kodo properties and use openJPA equivalent values1 Use openJPA properties instead of kodo properties when equivalent1 JBoss Java rules and quick fixes: • • • • Do not use JBoss-specific JNDI name values1 Do not use JBoss-specific packages3 Do not use MBeans for JBoss application startup or shutdown logic1 Use portable JNDI names3 JBoss XML rules and quick fixes: • • • • • Do not use local JNDI names1 Manually migrate resource references for URLs and resource managers3 Use WebSphere bindings to define EJB JNDI names1 Use WebSphere bindings to define EJB reference names1 Use WebSphere bindings to define resource reference names1 Use WebSphere extensions to define Web module context root1 Do not use jboss.xml file3 Do not use jboss-app.xml file3 Do not use jboss-client.xml file3 Do not use jbosscmp-jdbc.xml file3 Do not use jboss-web.xml file3 Do not use JBoss Web services deployment descriptor1 • • • • • • • JBoss class path rules and quick fixes: Use MANIFEST.MF for application class path1 • 1 2 3 This is a new rule with a quick fix that is added in release 1.1. This is a new quick fix that is added in release 1.1 to an existing rule. This is a new rule that is added in release 1.1 without a quick fix. Application Migration Tool | Support | 7 Support The Application Migration Tool scans for a number of known issues in applications being migrated from WebLogic or JBoss to WebSphere Application Server. Where possible, a quick fix is provided to change your code to a more portable solution. Supported WebLogic rules and quick fixes are documented in WebLogic to WebSphere Application Server rules and quick fixes on page 26. Supported JBoss rules and quick fixes are documented in JBoss to WebSphere Application Server rules and quick fixes on page 34. The tool will be updated on developerWorks as new rules and quick fixes are available. You can use the quick fix preview support in the migration tool to decide if you want to accept the suggested code change. Also, view the help information provided with the rules to decide if you want to run the quick fix. Always make a backup copy of your source code before starting a migration. During the scanning process, the tool detects areas that require design changes and code rewrites. The tool highlights these problem areas but does not provide a quick fix. The tool does not catch all problems. As you encounter patterns that the tool does not flag, we want to hear your feedback. The Application Migration Tool forum is available to provide input and get questions answered. (http://www.ibm.com/ developerworks/forums/forum.jspa?forumID=2106). If you have access to IBM Passport Advantage, you can open a customer defect. Other users can use the forum to report issues or suggestions and ask questions. For more information on the Rational Software Analyzer product, go to http://www.ibm.com/developerworks/rational/ products/rsar/. 8 | Application Migration Tool | Installing and updating the migration tool Installing and updating the migration tool The Application Migration Tool is a plug-in that you install into an existing Eclipse or Rational Application Developer environment. The tool is supported on Eclipse version 3.4.2 or higher and Rational Application Developer version 7.5 and higher. The preferred environments are Rational Application Developer and Rational Application Developer for Assembly and Deploy since they provide all the tools for application development and deployment. However, the tool works with a basic Eclipse IDE. If an Eclipse IDE is not already installed, then download and install Eclipse 3.4.2 or higher from http:// www.eclipse.org. To install or update the Application Migration Tool, perform the following steps: 1. Download the latest version of the migration tool from developerWorks site http://www.ibm.com/developerworks/ websphere/downloads/migration_toolkit.html and save it locally. 2. Start the IDE. 3. If this is not a Rational Application Developer environment, install the prerequisite plug-ins from either the Galileo or Ganymede site depending on your Eclipse version. Rational Application Developer is configured with the required plug-ins. Use the appropriate example, depending on your version of Eclipse: For Eclipse 3.5 and higher For Eclipse 3.4 (3.4.2 and higher) From the Eclipse menu bar, select Help > Install New Software From the Eclipse menu bar, select Help > Software updates Using the Galileo update site (http:// download.eclipse.org/releases/galileo) on Eclipse 3.5 or the Helios update site (http:// download.eclipse.org/releases/helios) on Eclipse 3.6 install Business Intelligence, Reporting and Charting and Web, XML, and Java EE Development. Using the Ganymede update site (http:// download.eclipse.org/releases/ganymede), install Charting and Reporting and Web and Java EE Development. Figure 1: Eclipse plug-in installation 4. Use the previous installation dialog to install or update the Application Migration Toolkit. Click Add in Eclipse 3.5 or click Add Site in Eclipse 3.4. (Rational Application Developer is built on Eclipse 3.4.) 5. In the Add Site window, enter the following information: (Figure 2: Tool installation on page 9). Application Migration Tool | Installing and updating the migration tool | 9 • • 6. 7. 8. 9. Name: Application Migration Tool Location: Use the Archive button to find the compressed file you downloaded. Figure 2: Tool installation Click OK Complete the following actions in the Install window: (Figure 3: Select Plug-In on page 10). a) Select the check box for Application Migration Tool. b) Select the check box to Contact all update sites during install to find required software and click Next. Click Next on the Install Details panel. On the Review Licenses panel, read the terms and accept the license agreements, if any are presented. Click Finish. The install status window shows the installation progress. Figure 3: Select Plug-In 10. Restart the IDE when the Software Updates window is displayed. Figure 4: Restart dialog Application Migration Tool | Importing applications | 11 Importing applications If the application to migrate is not already in the IDE, you must import the application enterprise archive (EAR) file or modules with source code into the IDE before performing analysis. The preferred approach for doing this is to create new projects in the workspace for each EAR, Web archive (WAR), and Enterprise JavaBeans™ (EJB) module. The EAR file should be created as an enterprise application project. Each WAR file within the EAR file should be created as a dynamic Web project, and each EJB module should be created as an EJB project. You must install Java EE Developer Tools for Eclipse to create these projects. Review the following guidelines for structuring projects: • • • • Java source code for a WAR file (for example, servlet, model, or utility classes), belong in the src folder of the project. The src folder is defined and can be changed in the Java Build Path properties for the project. If the Java source code needs to be referenced by more than one WAR, see the Shared Java Projects section of this document. Java source code for an EJB module can be placed in the ejbModule folder of the EJB project. Precompiled Java archive (JAR) libraries for a WAR file belong in the WebContent/WEB-INF/lib folder. EAR-level JAR libraries can be placed in the EarContent folder of the enterprise application project. If your project contains an APP-INF/lib folder, it can be placed in the EarContent folder; however, you must run the class path rule and its quick fix to update the class paths correctly Shared Java Projects There are two options for referencing those Java classes from a Web project: 1. Create a single copy of the Java project's JAR file in the EAR file. Each WAR file references the JAR file. This approach is preferable, since it reduces the size of the EAR file. 2. Create a copy of the JAR file in each WAR file. This approach works well if only one WAR file references the JAR file. EAR-Level Library Complete the following steps to place Java source files in a separate project: 1. Create a new Java project and add the Java source into the project's src folder. 2. Go to the Properties dialog of the EAR project (right-click the project in the Project view and select Properties). Select the Java EE Module Dependencies item from the left pane, and on the right pane select the check box next to the Java projects you want to reference. 12 | Application Migration Tool | Importing applications Figure 5: Java EE EAR module dependencies 3. Open the Properties dialog for each Web project that needs to reference a JAR file. Select the Java EE Module Dependencies item from the left pane, and ensure that the J2EE Modules tab is selected. Select the check box beside the JAR files to reference. Application Migration Tool | Importing applications | 13 Figure 6: Java EE module dependencies WAR-Level Library For the second approach, which creates a copy of the JAR file in each WAR file, complete the following steps: 1. Open the Properties dialog of the Web project. Right-click on the project in the Project view and select Properties. Select the Java EE Module Dependencies item from the left pane, and then click on the Web Libraries tab in the right pane. The table contains every Java project available. 14 | Application Migration Tool | Importing applications Figure 7: Web Libraries Module Dependencies 2. Select the check box beside the project to add it to the WAR file. Configuring a Java EE Runtime Library When using Eclipse with the Java EE tooling installed, the Java compiler is not able to resolve references to the Java EE APIs unless a target runtime environment is configured. Follow these steps to configure the Java EE Runtime Library: 1. Open the Eclipse preferences by choosing Preferences under the Eclipse Window menu. 2. Navigate to the Server > Runtime Environments item on the left pane. Application Migration Tool | Importing applications | 15 Figure 8: Server Runtime Environments 3. Click Add and choose Basic > J2EE Runtime Library. 4. On the next wizard page, click Browse to choose the library location, and locate the dev/JavaEE folder of your WebSphere Application Server installation and select the appropriate Java EE version. That folder contains the j2ee.jar file with the Java EE APIs. To use this runtime library in a Web or EJB project, go to the project properties dialog. Right-click on the project in the Project view and select Properties, and choose the Targeted Runtimes item. Figure 9: Targeted Runtimes Under the runtime listing, select the check box next to the recently configured Java EE runtime library, and click OK. Application Migration Tool | Configuring the tool for analysis | 17 Configuring the tool for analysis You can configure the tool to define a set of rules to run and define the scope of analysis within the workspace. The scope can be a project, a working set, or the entire workspace. Once defined, you can save the analysis configuration to use or modify later. With the migration tool installed, you have new analysis options to configure and run an analysis. You can access the options in the Eclipse Run menu, in the Launch toolbar, and in the explorer context menus. The following figure demonstrates the different ways you can run the analysis using the Application Migration Tool. From the Eclipse menu: From the Launch Eclipse toolbar: From the explorer context menu: Figure 10: Options for running the tool If you do not see Software Analyzer options, see Software Analyzer options not shown on page 37. To configure the analysis using the toolbar, complete the following steps: 1. On the toolbar, select Software Analyzer ( configuration dialog. ) > Software Analyzer Configurations to display the main You can add or remove analysis configurations by using the icons in the dialog. 18 | Application Migration Tool | Configuring the tool for analysis Figure 11: Configuration dialog 2. In the configurations list, select Software Analyzer then click New the basic configuration interface. . The right side of the dialog changes to show Application Migration Tool | Configuring the tool for analysis | 19 Figure 12: Configuration Setup 3. In the Software Analyzer Configuration dialog, enter a name for the configuration, such as “AppMigration” as shown in Figure 12: Configuration Setup on page 19. 4. On the Scope tab, select Analyze entire workspace to scan all projects in the workspace. You can limit the scope of an analysis by using the other options on this dialog to analyze a working set or a selection of projects. Tip: When you use the explorer context menu to run your analysis, the scope of the analysis is limited to the node in the project where the context menu was selected. This allows you to perform a quick analysis on a limited set of code. 5. On the Rules tab, select the type of analysis to perform (see Figure 13: Rule selection on page 20). There are two migration related rule sets, WebLogic Application Migration and JBoss Application Migration. To automatically select all of the rules from one of these rule sets, select it from the list and click Set. The migration tool has rules under the following analysis providers: • • • • Class-Path Review Java Code Review JSP Code Review XML File Review The Rules tab displays a directory tree, where you can select or clear analysis elements. This tab also includes additional buttons for importing and exporting rule selections. The nodes at the beginning of the domain tree are analysis providers, which represent the types of analysis tools that are recognized by the analysis framework. Providers contain categories which organize the rules. 20 | Application Migration Tool | Configuring the tool for analysis See Figure 13: Rule selection on page 20 for an example of selected rules Tip: To obtain additional information about a rule, highlight the rule and press F1. Help for the rule is shown in the configuration dialog. The initial help page includes a short description and a link to more information. Note: The number of rules in the analysis configuration dialog varies depending on the platform on which the tool is installed. Analysis rules are available in several Rational products such as Rational Application Developer; therefore, the included rule sets might be different. Figure 13: Rule selection 6. To save the rule configuration, click Apply. Some rules have additional configuration options. When a rule with configuration options is selected, the rule properties are shown in the Properties tab under the list of rules. Figure 14: Rule Properties on page 21 shows the rule properties for a Web services rule. If you do not update the properties, the rule uses the default values. Application Migration Tool | Configuring the tool for analysis | 21 Figure 14: Rule Properties 22 | Application Migration Tool | Running analysis Running analysis Run the analysis and display the results. 1. To start the analysis, click Analyze on the Configuration dialog. 2. The results are displayed in the Software Analysis Results view (Figure 15: Java Code Review results view on page 22). Depending on which rules you are running, the results view might vary. The results generated by the migration tool are displayed in one of four tabs: • • • • Class-Path Review Java Code Review JSP Code Review XML File Review Some results views, such as Java Code Review, support viewing results in more than one format. For example, results can be viewed in a table or a tree format. Figure 15: Java Code Review results view If no results are shown in the panel, no issues were identified while scanning. Right-clicking on individual results gives access to options such as viewing the source code where the problem occurred or correcting the problem with a provided fix. Application Migration Tool | Running analysis | 23 Figure 16: Result options with Quick Fix Preview and Help Not all rules have all actions available, but the possible actions include: • • • View Result - Opens an editor showing the source file that triggered the rule. The cause of the problem is highlighted and a rule violation icon is shown in the left margin of the editor. Quick Fix - The light bulb overlay on the result list icon ( ) indicates this rule has a quick fix. Selecting this option runs the conversion that modifies the affected Java code, XML file, JSP or manifest file, allowing it to run in WebSphere Application Server. The quick fix might change the code directly or it might present the steps needed to complete the fix. Quick Fix Preview - This option is available for the rules that support showing a side-by-side comparison of the original code and the code after the quick fix is applied. This option allows you to see the changes before they are made. Figure 15: Java Code Review results view on page 22 shows an example of the quick fix preview. Some quick fixes modify more than one file. When you select Quick Fix Preview for a fix affecting multiple files, the files are shown in the Structure Compare portion of the Compare view. Double-click each file to view the differences. For example, Figure 17: Quick Fix Preview with multiple files on page 24 shows the changes that will be made to a web.xml file. • • • Figure 17: Quick Fix Preview with multiple files Ignore Result - This option removes the rule from the list without making a code change. For Java files, a comment annotation is added to the file so that the rule is not triggered on future analysis runs. Quick Fix All - This option resolves all issues identified for a given rule. Quick Fix All Category - This option runs all quick fixes identified for the provider type the rule belongs. A rule must have Quick Fix All enabled in order for Quick Fix All Category to run its quick fix. For example, if you choose this option on a Java rule, the quick fixes for all Java rules that have the Quick Fix All option are run. Context sensitive help is displayed in the Help view as you select each result. The first panel is a short description. Click Detailed Help to get more information. Press F1 to open the Help view. Application Migration Tool | Completing the Process | 25 Completing the Process After correcting the issues highlighted by the migration tool by running quick fixes or by making manual code changes, there are a number of additional rules provided by the Rational Software Analyzer product that can help improve the quality of your code. These rules are not required for conversion. Figure 18: Other architectural and Java rules on page 25 shows examples of the additional rules. Figure 18: Other architectural and Java rules Access these rules by creating a new analysis configuration or modifying an existing one. These rules are not automatically selected as part of the WebLogic Application Migration rule set. When the selected rules run and necessary changes are made, the updated application must be exported and tested on WebSphere Application Server. If using Rational Application Developer, there are tools available to create deployments and test the application within the Rational Application Developer environment. 26 | Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes WebLogic to WebSphere Application Server rules and quick fixes The Application Migration Tool evaluates Java code, JSP code, deployment descriptors, and Web services deployment descriptors as part of its analysis set. This section provides specific details on the rules and quick fixes that are provided. WebSphere Application Server conversion rules are included in the following analysis domains: Figure 19: Analysis domains WebLogic Java code review rules Under the Java Code Review set of rules, the WebLogic to WebSphere code migration category contains multiple rules. For more information, press F1 when viewing the rule in the configuration dialog or in the results viewer. Rule Name Quick Fix Action Taken Release Do not use Commons Logging system level property Yes This rule detects setting the commons logging implementation class using the system property. 1.1 The quick fix removes the entry. Do not use invalid JPA imports No This rule detects the use of specific kodo import statements that do not have equivalent openJPA imports. 1.1 These references are flagged so you can evaluate their usage and migrate manually. Do not use kodo properties that have no openJPA equivalent Yes Use OpenJPA property names instead of Kodospecific property names when equivalent Yes Do not use non-portable JPA imports Yes This rule detects JPA properties that start with kodo.* in java files but have no equivalent openJPA values. 1.1 The quick fix removes these properties. This rule detects the JPA properties with kodo specific values in Java files. 1.1 The quick fix changes these values to valid openJPA values. This rule detects WebLogic-specific kodo import statements. The quick fix replaces them with openJPA equivalent import statements. 1.1 Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes | 27 Rule Name Quick Fix Action Taken Release Do not use subclass of EntityManager or EntityManagerFactory for injected JPA elements Yes This rule detects injected JPA PersistenceContext or PeristenceUnit where the injectable type is a subclass of EntityManager or EntityManagerFactory. 1.1 Do not use UserTransaction interface from CMT beans No The quick fix changes the class to use the standard JPA object. This rule detects references to ctx.lookup('javax.transaction. UserTransaction') within container managed transaction enterprise beans. References to the UserTransaction object are not allowed from CMT beans. 1.0 These references are flagged so that you can remove this Java EE violation. Do not use WebLogic log4j logging objects No This rule detects the proprietary WebLogic log4j classes and flags them for manual migration. 1.1 Do not use WebLogic LoggingHelper object to get Logger instance Yes This rule detects the LoggingHelper object usage. 1.1 Do not use WebLogic logging objects Yes The quick fix converts the class instance to Java Logger. This rule detects WebLogic logging objects. 1.1 The quick fix changes the code to use the Java objects. Do not use WebLogic NonCatalogLogger object Yes This rule detects the NonCatalogLogger usage. 1.1 The quick fix converts these objects to Java Logger object. In addition, it converts all the logging method calls to valid logging calls. The level is controlled by the user using rule properties. Do not use WebLogic RMI API calls Yes This rule detects the use of references to the proprietary weblogic.rmi packages. 1.0 The quick fix changes weblogic.rmi to java.rmi to use the Java-provided classes. Do not use WebLogic servlet attributes for XML parsing Yes This rule detects the use of setAttribute and getAttribute methods used with specific attributes to parse XML. 1.1 The quick fix removes the entries. Do not use WebLogic-specific JDBC properties or extensions No This rule detects the usage of several WebLogic JDBC properties and extensions that must be manually migrated. 1.1 Do not use WebLogic-specific JNDI environment properties for initial context Yes This rule detects the usage of the weblogic.jndi.Environment class to set context properties. 1.1 The quick fix migrates the objects used in the Environment references to a hash table used to initialize the InitialContext object. 28 | Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes Rule Name Quick Fix Action Taken Release Do not use WebLogic-specific JNDI name values Yes This rule detects the usage of following proprietary JNDI name values: 1.0 • • java.naming.factory.initial = weblogic.jndi. WLInitialContextFactory java.naming.provider.url = t3://localhost:7001 If found, users are given the option to change the JNDI names to default portable JNDI name values: • • java.naming.factory.initial = com.ibm.websphere.naming. WsnInitialContextFactory java.naming.provider.url = corbaloc:iiop:localhost:2809 Restriction: The JNDI name values must be in the same Java source file where the context is initialized with the javax.naming. InitialContext(Hashtable) constructor. Do not use WebLogic startup or shutdown classes Yes This rule looks for classes that implement the WebLogic startup and shutdown interfaces. 1.0 The quick fix converts these classes to use the javax.servlet.ServletContextListener interface and registers it in the web.xml file of the application. Do not use WebLogic StAX objects No This rule detects the use of WebLogic proprietary XML Streaming (StAX) objects that must be migrated manually. 1.1 Do not use WebLogic TransactionManager object No This rule detects the use of the TransactionManager object and flags it for manual migration. 1.1 Do not use WebLogic Transaction object No This rule detects the use of the Transaction object and flags it for manual migration. 1.1 Do not use WebLogic No TransactionSynchronizationRegistry object This rule detects the use of the TransactionSynchronizationRegistry object and flags it for manual migration. 1.1 Do not use WebLogic RollbackException object No This rule detects the use of the weblogic.transaction.RollbackException object and flags it for manual migration. 1.1 Do not use WebLogic WLLevel object Yes This rule detects WLLevel object usage in a setLevel() method. 1.1 The quick fix converts the WLLevel to IBM WsLevel. The level is controlled by the user using rule properties. Do not use WebLogic XPath objects No This rule detects the use of WebLogic proprietary, XML XPath objects and flags them for manual migration. 1.1 Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes | 29 Rule Name Quick Fix Action Taken Release Use compliant UserTransaction lookup name Yes This rule looks for references to ctx.lookup("javax.transaction. UserTransaction"). 1.0 Within bean managed transaction (BMT) beans, the quick fix converts the flagged line to ctx.getUserTransaction(). Within servlets, Web applications and client code, the flagged line is converted to the JNDI lookup: ctx.lookup("java:comp/UserTransaction") Use matching throws clause in EJB bean class Yes This rule looks for mismatches between the enterprise bean implementation and the method definitions in the home and remote interfaces. 1.0 The quick fix adds any missing exceptions and removes any additional exceptions. The interfaces are not changed. Use OpenJPA property names instead of Kodospecific property names when equivalent Yes Use portable JNDI names No This rule detects the usage of the constructor, javax.naming.InitialContext(Hashtable), specifying not to put any proprietary WebLogic JNDI name values into the hash table. 1.0 Use unitName attribute for Injected JPA Elements Yes This rule detects injected JPA PersistenceContext or PersistenceUnit elements without unitName or name attributes. 1.1 This rule detects the presence of known JPA properties with a name starting with kodo.* in Java files. 1.1 The quick fix renames these properties to openjpa.*. The quick fix adds the missing values to offer similar behavior to WebLogic automated deployment. Do not use non-mapping weblogic.apache packages No This rule flags import and code references to classes where the class package starts with weblogic.apache and the class does not map to an open source Apache class. 1.0 You must modify the code to use different classes. See the rule help for more information. Do not use weblogic.apache packages Yes This rule flags import and code references to classes where the class package starts with weblogic.apache and the class maps directly to an org.apache class. 1.0 The quick fix changes the code to org.apache. Download the appropriate Apache open source .jar file, and include it with your application. Do not use WebLogic-specific packages No This rule flags imported classes that begin with weblogic but not including the weblogic.apache classes. The flagged server-specific APIs must be migrated. 1.0 30 | Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes WebLogic JSP code review rules Under the JSP code review set, the JSP Conversions category has rules described in the following table. For more information, press F1 when viewing the rule in the results viewer. Rule Name Quick Fix Action Taken Release Avoid using a .jsp extension for JSP fragments Yes This rule looks for JSP fragments included in another JSP. If the JSP fragment file has the .jsp extension rather than .jspf extension, it is flagged. 1.0 The quick fix takes you to the refactor dialog to change the file name and all of its references. Use correct case for tag attribute names Yes JSP taglib attributes are case-sensitive in WebSphere Application Server. This rule flags any taglib attribute that is not case correct. 1.0 The quick fix changes the case as it is defined in the tag library. WebLogic XML file review rules The XML file review provides a number of rules to detect deployment descriptors, Web services and other XML file issues. Rule Name Quick Fix Action Taken Release Do not use local JNDI names Yes This rule detects <local-jndi-name> tags in weblogic-ejbjar.xml files. 1.0 rule 1.1 fix The quick fix scans all the projects associated with the application where the local JNDI name is found. If Java code is found that references the local JNDI name, a <ejb-localref> is added to that project. The Web or EJB bindings are also updated. Do not use WebLogic servlet filter for XML parsing Yes This rule detects the use of an internal WebLogic servlet filter in web.xml files. 1.1 The quick fix removes the servlet filter entry along with its filter mapping entry. Do not use WebLogic specific EJB Query Language constructs No This rule detects query language elements, weblogic-ql, in weblogic-cmp-rdbms-jar.xml files for manual migration. 1.1 Use WebSphere bindings to define EJB JNDI names Yes This rule detects the <jndi-name> tag in weblogic-ejbjar.xml files for EJB definitions. 1.0 rule 1.1 fix Previously named: Use WebSphere bindings to define JNDI names The quick fix migrates the value found to the EJB bindings file. Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes | 31 Rule Name Quick Fix Action Taken Release Use WebSphere bindings to define EJB reference names Yes This rule detects <ejb-ref-name> in weblogic.xml or weblogic-ejb-jar.xml files. 1.0 rule 1.1 fix Previously named: Use standard deployment descriptors for EJB reference names Use WebSphere bindings to define Message-Driven Bean JNDI names The quick fix adds the EJB reference JNDI name to the EJB bindings file. Yes Yes This rule detects <res-ref-name> elements in weblogic.xml or weblogic-ejb-jar.xml files. 1.0 rule 1.1 fix The quick fix adds the resource reference JNDI name to the EJB bindings file. Previously called: Use standard deployment descriptors for resource reference names Use WebSphere extensions to define CMP mappings 1.0 rule 1.1 fix The quick fix sets the destination JNDI name in the EJB bindings file. Previously named: Use WebSphere bindings to define message driven descriptor Use WebSphere bindings to define resource reference names This rule detects <destination-jndi-name> for message-driven beans. Yes This rule detects <weblogic-rdbms-jar> elements in weblogic-cmp-rdbms-jar.xml files. 1.1 The quick fix uses the weblogic-cmp-rdbms-jar.xml file to generate the EJB to RDB mapping files used by WebSphere Application Server for CMP. Use WebSphere extensions to define concurrency strategy Yes This rule detects the <concurrency-strategy> element in weblogic-ejb-jar.xml files. 1.0 rule 1.1 fix The quick fix moves the Exclusive, ReadOnly, Database, and Optimistic options to the EJB extensions file. Use WebSphere extensions to define transaction timeout seconds Yes Use WebSphere extensions to define Web module context root Yes This rule detect the <trans-timeout-seconds> in weblogicejb-jar.xml files. 1.0 rule 1.1 fix The quick fix defines the timeout value to the EJB extensions file. This rule detects the <context-root> element in weblogic.xml files. The quick fix defines the context root value to the Web extensions file. The following rules handle WebLogic JPA persistence XML migration: 1.1 32 | Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes Rule Name Quick Fix Action Taken Release Do not use kodo PersistenceServerServlet in web.xml Yes This rule detects the presence of servlet, kodo.remote.PersistenceServerServlet, in web.xml files. 1.1 The quick fix removes the servlet along with its servlet mapping elements. Do not use kodo properties that have no openJPA equivalent Yes Do not use kodo specific values for kodo properties and use openJPA equivalent values Yes Use openJPA properties instead of kodo properties when equivalent Yes This rule detects the use of kodo.* properties that do not have openjpa equivalent. 1.1 The quick fix deletes the kodo property from persistence.xml files. This rule detects the JPA properties with kodo-specific values in persistence.xml files. 1.1 The quick fix changes these values to valid openJPA values. This rule detects the presence of known JPA properties with a name starting with kodo.* in persistence.xml files. 1.1 The quick fix renames these properties to openjpa.*. The following rules flag any WebLogic unhandled or partially handled XML file: Rule Name Quick Fix Action Taken Release Do not use weblogic.xml file No This rule flags the weblogic.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 Do not use weblogicapplication.xml file No This rule flags the weblogic-application.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 Do not use weblogic-cmpjar.xml file No This rule flags the weblogic-cmp-jar.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 Do not use weblogic-cmprdbms-jar.xml file No This rule flags the weblogic-cmp-rdbms-jar.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 Do not use weblogicdiagnostics.xml file No This rule flags the weblogic-diagnostics.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 Do not use weblogic-ejbjar.xml file No This rule flags the weblogic-ejb-jar.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 Application Migration Tool | WebLogic to WebSphere Application Server rules and quick fixes | 33 Rule Name Quick Fix Action Taken Release Do not use weblogic-ra.xml file No This rule flags the weblogic-ra.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.0 The following rule migrates Web services within your application: Rule Name Quick Fix Action Taken Release Do not use WebLogic Web services deployment descriptor Yes This rule flags webservices.xml J2EE deployment descriptor files. 1.0 The quick fix generates an ANT script that uses IBM WebSphere ANT tasks which generate the appropriate artifacts for the list of Web services based on the information collected from the deployment descriptors. Depending on the deployment descriptor, the fix might also generate the Service Endpoint Interface (SEI) for the service and add it to the project class path. The user can then run the ANT script, copy the generated artifacts to the project, and possibly add additional targets such as the endpoint enabler, for example. WebLogic class path review rules The class path review provider verifies that the MANIFEST.MF class path is set up correctly. Rule Name Quick Fix Action Taken Release Use MANIFEST.MF for application class path Yes This rule looks for any classes or libraries contained within an APP-INF directory of an EAR file. 1.0 The quick fix adds an entry to the class path of each affected Web module by updating the class path entry of the MANIFEST.MF file of the module. 34 | Application Migration Tool | JBoss to WebSphere Application Server rules and quick fixes JBoss to WebSphere Application Server rules and quick fixes JBoss support is new for this release. The following rules and quick fixes are available to help migrate JBoss applications. JBoss Java code review rules Under the Java code review set of rules, the JBoss to WebSphere code migration category contains multiple rules. For more information, press F1 when viewing the rule in the configuration dialog or in the results viewer. Rule Name Quick Fix Action Taken Release Do not use JBoss-specific JNDI name values Yes This rule detects the usage of these JNDI name values: 1.1 • • java.naming.factory.initial = org.jnp.interfaces. NamingContextFactory java.naming.provider.url = jnp://localhost:1099 If found, users are given the option to change the JNDI names to default portable JNDI name values: • • java.naming.factory.initial = com.ibm.websphere.naming. WsnInitialContextFactory java.naming.provider.url= corbaloc:iiop:localhost:2809 Restriction: The JNDI name values must be in the same Java source file where the context is initialized with the javax.naming. InitialContext(Hashtable) constructor. Do not use JBoss-specific packages No This rule flags imported classes that begin with org.jboss that must be manually migrated. 1.1 Do not use MBeans for JBoss application startup or shutdown logic Yes This rule detects the classes implementing the MBean registration interface to run application startup and shutdown logic. 1.1 The quick fix that is provided for this rule converts the class to implement the SessionContextListener interface to perform startup and shutdown logic. Important: If your code provides MBeans and it implements MBeanRegistration for its intended purpose, you should turn off this rule. Use portable JNDI names No This rule detects the usage of the constructor, javax.naming.InitialContext(Hashtable), specifying not to put any proprietary JBoss JNDI name values into the hash table. 1.1 Application Migration Tool | JBoss to WebSphere Application Server rules and quick fixes | 35 JBoss XML file review rules The XML file review provides a number of rules to detect deployment descriptors, Web services, and other XML file issues. Rule Name Quick Fix Action Taken Release Do not use local JNDI names Yes This rule detects <local-jndi-name> tags in jboss.xml files. 1.1 The quick fix scans all the projects associated with the application where the local JNDI name is found. If Java code is found that references the local JNDI name, an <ejb-localref> is added to that project. The Web or EJB bindings are also updated. Manually migrate resource references for URLs and resource managers No This rule detects <res-ref-name> elements in jbossweb.xml or jboss.xml files that define URL resources or resource manager resources. These resource references must be manually migrated. 1.1 Use WebSphere bindings to define EJB JNDI names Yes This rule detects the <jndi-name> tag in jboss.xml files for EJB definitions. 1.1 The quick fix migrates the value found to the EJB bindings file. Use WebSphere bindings to define EJB reference names Yes This rule detects <ejb-ref-name> in jboss-web.xml or jboss.xml files. 1.1 The quick fix adds the JNDI name of the EJB reference to the EJB bindings file. Use WebSphere bindings to define Message-Driven Bean JNDI names Yes Use WebSphere bindings to define resource reference names Yes Use WebSphere extensions to define CMP mappings Yes This rule detects <destination-jndi-name> for message-driven beans. 1.2 The quick fix sets the destination JNDI name in the EJB bindings file. This rule detects <res-ref-name> elements in jbossweb.xml or jboss.xml files. 1.1 The quick fix adds JNDI name of the resource reference to the EJB bindings file. This rule detects <jbosscmp-jdbc> elements in jbosscmpjdbc.xml files. 1.2 The quick fix uses the jbosscmp-jdbc.xml file to generate the EJB to RDB mapping files used by WebSphere Application Server for CMP. Use WebSphere extensions to define Web module context root Yes This rule detects the <context-root> element in jbossweb.xml files. The quick fix defines the context root value in the Web extensions file. 1.1 The following rule flags any JBoss unhandled or partially handled XML file: Rule Name Quick Fix Action Taken Release Do not use jboss.xml file No This rule flags the jboss.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.1 Do not use jboss-app.xml file No This rule flags the jboss-app file so that you can look for any non-migrated elements at the end of the application migration. 1.1 Do not use jboss-client.xml file No This rule flags the jboss-client.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.1 Do not use jbosscmp-jdbc.xml file No This rule flags the jbosscmp-jdbc.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.1 Do not use jboss-web.xml file No This rule flags the jboss-web.xml file so that you can look for any non-migrated elements at the end of the application migration. 1.1 The following rule migrates Web services within your application: Rule Name Quick Fix Action Taken Release Do not use JBoss Web services deployment descriptor Yes This rule flags webservices.xml J2EE deployment descriptor files. 1.1 The quick fix generates an ANT script that uses IBM WebSphere ANT tasks which generate the appropriate artifacts for the list of Web services based on the information collected from the deployment descriptors. Depending on the deployment descriptor, the fix might also generate the Service Endpoint Interface (SEI) for the service and add it to the project class path. The user can then run the ANT script, copy the generated artifacts to the project, and possibly add additional targets such as the endpoint enabler, for example. JBoss class path review rules The class path review provider verifies the MANIFEST.MF class path is set up correctly. Rule Name Quick Fix Action Taken Release Use MANIFEST.MF for application class path Yes This rule detects jars and classes in the EAR project root folder. 1.1 The quick fix adds the jars and the classes to the MANIFEST.MF file so that they are detected by WebSphere Application Server. Application Migration Tool | Troubleshooting | 37 Troubleshooting Software Analyzer options not shown After the Application Migration Tool is installed, you have new Software Analyzer menu and toolbar options in the Java, Debug, C++, and Plug-in Development perspectives. When using other perspectives, enable these options manually. To customize other perspectives, complete the following steps: 1. From your perspective, select Window > Customize Perspective from the IDE menu. 2. In the Customize Perspective window, click the Commands tab and select the Software Analyzer check box. If you are running Rational Application Developer, then the Rational Software Analyzer check box might be displayed. 3. Click OK Figure 20: Software Analyzer availability Java EE constructs or JSP not read correctly For the tooling to read project files correctly, the projects must be set up with their appropriate project facets. For example, projects that contain enterprise beans must have the EJB Module facet. You can see facets for a project by right-clicking on the project in the project explorer and selecting Properties. Select the Project Facets property. Projects containing Web modules must be dynamic Web projects. See Importing applications on page 11 for more information. Logging and trace The Application Migration Tool writes error information to two log files: • The workspace log (workspace/.metadata/.log) contains our severe error logs as well as Rational Software Analyzer logs. • The Application Migration Tool service logs are located in the workspace/.metadata/.plugins/ com.ibm.ws.appconversion.base directory. This log contains all error information as well as detailed trace information if trace is enabled. Enable the migration tool's trace by setting the appconversion.trace system variable on the command line to launch the IDE or in the eclipse.ini property file. For example: 38 | Application Migration Tool | Troubleshooting • Command line option. Add the system variable to the command line that starts Eclipse. • eclipse.exe -vmargs -Dappconversion.trace=true eclipse.ini option. Add the following line to the eclipse.ini file found in the same directory as the eclipse.exe file: -Dappconversion.trace=true Reports and history In the Software Analyzer Results view, the analysis provider tabs have buttons used to export selected analysis history to file and to generate reports. Java Code Review is the only results view that has support for reports. For exported history, you can specify the location for the generated result. For generated reports, the report is displayed when the report is finished. An HTML report is displayed in a Web browser. You can configure the Web browser under the Eclipse properties for General > Web Browser. PDF reports are displayed in the system's default PDF viewer. The generated files are put in the workspace/.metadata/.plugins/com.ibm.xtools.analysis.reporting/reports directory. Markers Markers appear in the left-hand margin of Eclipse editors and provide information about the content of the editor on the line where the marker appears. Editors for different file types can have different behaviors for the markers, some of which are described here. Figure 21: Markers in Java Editor No popup window displays when clicking on the marker This issue affects non-Java based rules. For a Java rule, clicking on the marker allows the quickfix to be performed. However, clicking on the marker for the XML rule has no action, and hovering over the marker only displays the help text. Use the Software Analyzer Results view to select the Quick Fix action in non-Java files Double-clicking on a marker in a manifest file removes the marker Double-clicking on the marker on the first line removes the marker without applying the quickfix. If this happens, run the class path rule again to display the marker again. Cannot select multiple markers on the same line When there are multiple markers on the same line of text, you cannot toggle between the different markers. You must carry out the action of the first marker in order to select successive markers. To apply a quickfix in such a case, use the Software Analyzer Results view to select the Quick Fix action you want rather than relying on the marker. Known issues Run Quick Fix All Category for one provider at a time. When you use the Quick Fix All Category option, let it run to completion before running it on another rule provider (category). Also, do not run Quick Fix All Category again on the same provider where it is already running. Wait until it completes. Application Migration Tool | Troubleshooting | 39 Process all rules of a category before running analysis again. Some rules are interrelated and you might improve results if you run related quick fixes before running analysis again. For example, the trigger for the WebLogic logging rules are related, and you will need to apply all quick fixes related to logging to make sure that the changes can compile successfully. Multiple rules on the same node When multiple rules are flagged on the same node, only the first quick fix applied will run correctly. You may need to run the analysis a few times to make sure that all code is fixed and processed correctly. 40 | Application Migration Tool | Copyright and trademarks Copyright and trademarks © Copyright IBM Corporation 2009, 2010. The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM's current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software. References in this publication to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM's sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth, savings or other results. Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here. IBM, the IBM logo, developerWorks, Passport Advantage, Rational, and WebSphere are trademarks of International Business Machines Corporation in the United States, other countries or both. Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries or both. Other company, product and service names may be trademarks or service marks of others.