Oracle® Fusion Middleware SmartUpgrade User's Guide 11g Release 1 (11.1.1) Part Number E15878-01 |
|
|
View PDF |
In addition to using SmartUpgrade as an integrated Oracle JDeveloper extension, you can also use the SmartUpgrade command-line interface.
The command line interface can be run using the Java command line or as an Apache Ant task.
With the SmartUpgrade command-line, you can consider automating the analysis and generation of artifacts for multiple applications using scripts.
For more information, see the following sections:
The following sections describe how to use the command-line interface for SmartUpgrade:
Verifying Prerequisites and Locating the smartupgrade.jar File
Summary of the SmartUpgrade Command-Line Options Specific to Web Services Artifact Generation
Before you can run the SmartUpgrade command-line interface:
Verify that you have installed the required Java software, as described in Section 1.6.4, "Installing the SmartUpgrade Command-Line Interface".
Note that you should also make sure that the Java bin directory is defined as part of the current PATH variable, so you can run the java
command from any location on your system. Otherwise, you must include the path to the java
command every time you run the SmartUpgrade software.
Locate the smartupgrade.jar
file, which you installed using the instructions in Section 1.6, "Downloading and Installing SmartUpgrade".
Note that the instructions and examples in this chapter assume you are running SmartUpgrade from the directory where the smartupgrade.jar
resides.
To use the SmartUpgrade command-line interface, simply navigate to the directory where you unpacked the contents of the downloaded smartupgrade.zip file and use the following syntax:
java -jar smartupgrade.jar options
For more information, see Section 3.1.4, "Summary of the SmartUpgrade Command-Line Options"
To display a list of the available options, enter one of the following commands:
java -jar smartupgrade.jar -help java -jar smartupgrade.jar -help locator java -jar smartupgrade.jar -help category java -jar smartupgrade.jar -help option
For detailed information, see Section 3.1.4, "Summary of the SmartUpgrade Command-Line Options".
Refer to the following sections for detailed information about the options you can use when running SmartUpgrade from the command line:
The following example shows the options you can use when running the SmartUpgrade command-line utility:
java -jar smartupgrade.jar --LOCATOR_NAME path_or_list_file_names -category -generate -html -target
All but the LOCATOR_NAME value are optional.
In the previous example, replace LOCATOR_NAME with a valid Locator that SmartUpgrade upgrade can analyze. For more information, see Section 3.1.4.2, "Identifying a SmartUpgrade Locator".
A locator is a general term to identify the object or objects that you want SmartUpgrade to analyze. The locator can be one or more application archives (EAR, WAR, JAR, or RAR files). It can also be a directory path where archives are stored, or the configuration directory of an OC4J server.
Table 3-1 describes the values you can use for the LOCATOR_NAME command-line option.
Table 3-1 Supported Values for the SmartUpgrade LOCATOR_NAME Option
LOCATOR_NAME value | Description | Examples |
---|---|---|
Identifies one or more enterprise archive (EAR) files to analyze. If you are a providing the path to more than one EAR file, then use a space-delimited list after the -ear option. |
java -jar smartupgrade.jar --ears myApp.ear java -jar smartupgrade.jar --ears C:\samples\App3.ear java -jar smartupgrade.jar --ears myApp.ear App3.ear |
|
Identifies one or more Web archive (WAR) files to analyze. If you are a providing the path to more than one WAR file, then use a space-delimited list after the -ear option. |
java -jar smartupgrade.jar --wars payroll.war java -jar smartupgrade.jar --wars C:\samples\Webapp3.war java -jar smartupgrade.jar --wars payroll.war C:\samples\Webapp3.war |
|
Identifies one or more Java archive (JAR) files to analyze. If you are a providing the path to more than one JAR file, then use a space-delimited list after the -ear option. |
java -jar smartupgrade.jar --jars myProj.jar java -jar smartupgrade.jar --jars C:\samples\App3.jar java -jar smartupgrade.jar --jars myApp.jar C:\samples\App3.jar |
|
Identifies one or more RAR archive files to analyze. If you are a providing the path to more than one RAR file, then use a space-delimited list after the -ear option. |
java -jar smartupgrade.jar --rars myApp.rar java -jar smartupgrade.jar --rars C:\samples\App3.rar java -jar smartupgrade.jar --rars myApp.rar C:\samples\App3.rar |
|
Identifies the configuration directory of an existing OC4J server. SmartUpgrade analyzes the configuration of the OC4J server and provide advice and configuring Oracle WebLogic Server in a similar manner. |
java -jar smartupgrade.jar --server-config C:\Oracle\AppServ1\j2ee\home\config java -jar smartupgrade.jar --server-config /dua1/Oracle/AppServ1/j2ee/home/config |
|
Identifies one or more directories that contain archive files (EAR, WAR, RAR, or JAR files) that you want to analyze. SmartUpgrade scans the directory and analyzes all the archives in the directory. |
java -jar smartupgrade.jar --archive-home C:\projects\myEARfiles\ java -jar smartupgrade.jar --archive-home /dua1/projects/myEARfiles/ |
|
Identifies the location of jar files that required or referenced by an application you are analyzing. The specified file is not analyzed by SmartUpgrade. You can use this feature to identify third-party libraries required by the application you are analyzing. |
java -jar smartupgrade.jar --application-jars C:\projects\myApp\lib\ java -jar smartupgrade.jar --application-jars /dua1/projects/myApp/lib/ |
You can specify more than one LOCATOR_NAME on the command line.
For example, to analyze an enterprise archive and the configuration of the OC4J server on Linux where the archive was deployed, use the following command:
java -jar smartupgrade.jar --ears myApp.ear --server-config /dua1/Oracle/AppServ1/j2ee/home/config
In addition to identifying a SmartUpgrade locator, you can also control the behavior of SmartUpgrade by using various optional command-line options.
Table 3-2 describes the optional command-line options you can use.
Table 3-2 Summary of Optional SmartUpgrade Command-Line Options
Options | Description | For More Information |
---|---|---|
Use this option to limit the analysis of the application to specific categories of SmartUpgrade rules. For example, you can limit the report to findings about data-source configurations in the selected application archive. |
||
Use this option to generate specific types of Oracle WebLogic Server artifacts, such as Oracle WebLogic Server deployment descriptors for the application. The artifacts can be used as a starting point for the deploying your OC4J applications on Oracle WebLogic Server. |
||
Use this option to generate output formatted in HTML. You can use this option to redirect the resulting report to an HTML file. |
Section 3.1.6.3, "Using the SmartUpgrade Command-Line Interface to Generate an HTML Report" |
|
Use this option to specify that you are analyzing an Oracle Application Server 10g Release 2 (10.1.2) application. By default, SmartUpgrade assumes you are analyzing an application that was previously deployed on 10g Release 3 (10.1.3) |
Example 3-1 shows the options you can use when running the SmartUpgrade command-line utility to generate Web services artifacts.
For complete information about using the artifacts generated by SmartUpgrade, refer to Chapter 4, "Using SmartUpgrade Generated Artifacts".
For a description of each option, refer to:
When generating Web services artifacts, the LOCATOR_NAME value, -generate
option, and -targetStackHome
option are mandatory.
Replace LOCATOR_NAME with a valid Locator that SmartUpgrade upgrade can analyze. For more information, see Section 3.1.4.2, "Identifying a SmartUpgrade Locator".
Example 3-1 List of Command-Line Options When Generating Web Services Artifacts
java -jar smartupgrade.jar --LOCATOR_NAME path_to_application_archive_or_directory -generate -category web-services -acceptDuplicates -additionalClassPath -archiveType -autoPack -autoWrap -dateFormat -debug -debugControl -debugWrap -debugWrapLength -ejbLookupName -ejbNewWarBase -ejbNewWarContextRoot -evaluate -javaHome -packLIBs -plansOnly -processTimeout -qos -resolveMapAmiguity -skipGlueCode -skipSourcePlan -skipTargetPlan -sourceStack -targetStackHome -wrapperNullAllowed
Table 3-3 Summary of the General Command-Line Options Specific to Generating Web Services Artifacts
Command-Line Option | Equivalent Option in the Java EE Upgrade Wizard | Description |
---|---|---|
The type of archive. The value can be one of the following:
If you do not provide a value for this option, SmartUpgrade determines the archive type automatically, by analyzing the archive and assigning the value as follows:
|
||
An additional classpath containing JAR files and class directories. This option is required when the input application does not contain all the libraries that a Web service depends on. |
||
Enable this option by passing When enabled, SmartUpgrade packages the target upgraded application into a deployable archive. The default value is Note: You can disable this option if the input archive has other JEE artifacts that need to be upgraded. After the wrapper code is generated, and you have upgraded other Java EE artifacts in the application, you can pack the application in a new command by specifying For more information, see Section 4.3.6, "Using Artifacts Generated for an Application with Both Web Services and Other Java EE Elements". |
||
Enable this option by passing When this option is enabled, SmartUpgrade enables parameter wrapping for the internal types that are generated. The existing business methods will not be aware of any of new interfaces and value types generated. When this option is not specified, its value is defined by whether the existing business parameters are wrapped. |
||
The date format to be used by glue code for conversion between |
||
The EJB 2.x lookup name to be used in the POJO-based Web service to which an EJB web service will be upgraded. This option should be used only when there is a single EJB Web service in the application. If multiple EJB Web services are present, edit the upgrade plans generated for each service. For information about locating the upgrade plans, see Section 4.3.4, "About the Content of the Generated Web Services Output Directories". |
||
The base name of the WAR file to be generated. When an EJB-based Web service is upgraded to a POJO-based Web service, SmartUpgrade generates a new WAR file. The value of this property will be the base name of the new WAR file. If there are more than one EJB Web service, edit the source upgrade plan to add this property with different values for each EJB Web service. For information about locating the upgrade plans, see Section 4.3.4, "About the Content of the Generated Web Services Output Directories". |
||
The context path of the WAR file to be generated. When an EJB-based Web service is upgraded to POJO-based Web service, SmartUpgrade generates a new WAR file. The value of this property will be the context root of the new WAR file. If there is more than one EJB Web service, then modify the source upgrade plan to add this property with different values for each EJB Web service. For information about locating the upgrade plans, see Section 4.3.4, "About the Content of the Generated Web Services Output Directories". |
||
Enable this option by passing When you enable this option, the generated wrapper ("glue") code is instrumented for performance analysis. The default value of the option is This option is appropriate only for testing the application, and not for production environments. For more information, see Section 2.2.3.3, "Generating Instrumented Code for Performance Analysis". |
||
The JDK home that SmartUpgrade uses to run the Web Service tools on the target server. The system automatically attempts to locate JDK installed with the target server. You can override this behavior by specifying a JDK home as a value for this option. If this option is not specified and if no JDK home is installed as part of the target server, the system will use the current JDK home used to run this upgrade tool. |
||
A list of JAR files, separated by a path separator. On Windows, the separator is a semicolon (;); on UNIX systems, the separator is colon (:). The identified JAR files are automatically packaged into the final generated archive, if the final archive is an EAR or WAR file. This value is also added into the value of |
||
The number of seconds SmartUpgrade will continue trying to process WSDL documents and generate artifacts. The tasks timeout default is 300 seconds. A different value may be set by using this command-line option, by providing a positive number on the wizard page in Oracle JDeveloper, or by setting the following environment variable prior to starting SmartUpgrade: GENERATION_TASKS_TIMEOUT |
||
This option indicates the types of policies (Quality Of Services) that need to be enabled in the target Web service that is generated. The list of possible tokens is MTOM, WSS_UNT, or STATEFUL. Multiple values can be passed with a comma(,) as the separator. |
||
N/A |
The name and version of the server that hosted the original Web services application. Possible values are: OC4J1013 OC4J1012 By default, SmartUpgrade attempts to determine the server version from the application. When there is an ambiguity, this option is mandatory. |
|
Mandatory property used to specify the target WebLogic Server home. For example: C:\Oracle\Middleware\wlserver_10.3 If you are migrating a large number of applications, you can avoid repeatedly specifying this property by setting the environment variable WL_HOME prior to starting Oracle JDeveloper. The value you set in WL_HOME environment variable will be applied to all applications during the upgrade process. Important Note: The Target Server Home Directory must be for a WebLogic Server home that is installed separately from Oracle JDeveloper. Do not select the WebLogic Server home that is installed with the Oracle JDeveloper installer. |
||
Enable this option by passing When enabled, null values are allowed for wrapper types already present in the application before upgrade. The default value is Note that WebLogic Server JAX-RPC Web Services do not allow null values for wrapper types. |
Table 3-4 Summary of the Advanced Command-Line Options Specific to Generating Web Services Artifacts
Option | Equivalent Option in the Java EE Upgrade Wizard | Description |
---|---|---|
Enable this option by passing This option indicates whether the system should ignore the duplicate class error and continue the glue code generation. You should enable this option only after ensuring that the duplicate classes are identical. |
||
Pring Debug Info |
Enable this option by passing When enabled, indicates that debug level messages should be printed. The debug messages are more detailed than INFO level messages. The default value is false. |
|
Logging Level |
Use this option to set the level of logging output. The value is one of the following: FINE|DEBUG|INFO|WARNING|ERROR|TRACE The default value is INFO. Note: This option is not validated; any invalid value will be ignored. |
|
Margins in Log Output |
Enable this option by passing When enabled, this option causes SmartUpgrade to align the diagnostic output for easy reading. The default value is |
|
Log Line Width |
Use this option to set the maximum length of the text that is logged without breaking the text into multiple lines. Use this option to preserve alignment. This is applicable only when |
|
Enable this option by setting the value to When this option is enabled, SmartUpgrade does not generate Web services glue code. The default value is When this option is enabled, SmartUpgrade exits immediately after the target upgrade plan is generated. You can use this option when you want to edit the target upgrade plan and then generate glue code in a separate step. This option takes priority over options such as |
||
Enable this option by setting the value to Enable this option to allow the system to resolve mapping ambiguities automatically. This option is applicable only when SmartUpgrade does not find mapping information either in mapping file or from annotations. The default value is If you want to rely on SmartUpgrade to resolve ambiguity, then enable this option. |
||
Enable this option by setting the value to When enabled, this option indicates that glue code generation needs to be skipped. When enabled, the target plan generation is also skipped. Use this option when the you have modified the generated glue code and you need to compile and package the application. |
||
Enable this option by setting the value to When enabled, SmartUpgrade does not generate a source migration plan generation and uses an existing plan. |
||
Enable this option by setting the value to When enabled, SmartUpgrade does not generate a target upgrade plan generation and instead uses an existing plan. When this option is enabled, the source upgrade plan generation is also skipped. |
The following sections provide some examples of how you can use the SmartUpgrade command-line options to help you upgrade your applications to Oracle WebLogic Server:
Using the SmartUpgrade Command-Line Interface to analyze an Enterprise Archive (EAR) File
Using the SmartUpgrade Command-Line Interface to Generate Oracle WebLogic Server Artifacts
Using the SmartUpgrade Command-Line Interface to Generate an HTML Report
Limiting the Findings to Specific Rule Categories from the SmartUpgrade Command-Line Interface
Using the SmartUpgrade Command-Line Interface to Analyze 10g Release 2 (10.1.2) Applications
To generate a SmartUpgrade report for a specific enterprise archive (EAR) file, use the following command syntax:
java -jar smartupgrade.jar --ears path_of_ear_file.ear
For example, if you have an EAR file called myApp.ear
and it resides in a directory called my C:\MyApps
, then use the following command:
java -jar smartupgrade.jar --ears C:\MyApps\myApp.ear
SmartUpgrade generates a report that is written to the terminal window. To save the report findings, redirect the output to a file. For example, the following examples show how to redirect the output to a file called report.txt
.
On the Windows operating system:
java -jar smartupgrade.jar --ears C:\MyApps\myApp.ear > account_mgmt_report.txt
On the Linux operating system:
java -jar smartupgrade.jar --ears C:\MyApps\myApp.ear > account_mgmt_report.txt
In addition to generating a report, SmartUpgrade can also generate a limited number of artifacts that can make it easier to update your applications so they can be deployed successfully on Oracle WebLogic Server.
At a minimum, you must:
For example, to generate artifacts in addition to a SmartUpgrade report for an archive called myApp.ear
, use the following command:
java -jar smartupgrade.jar
--ears archive_name
-generate
-category web-services
-targetStackHome c:\middleware\wlserver_10.3
For another example, suppose you want to do the following:
Specify the Oracle WebLogic Server home
Specify the classpath to additional libraries not contained in the application archive but required for the loading of classes
Indicate that you want SmartUpgrade to generate code instrumented for performance analysis
In that case, you would enter the following command:
java -jar smartupgrade.jar --ears archive_name -generate -category web-services -targetStackHome c:\middleware\wlserver_10.3 -additionalClassPath path_to_libraries -evaluate
For information on the results of this analysis, see Section 4.1, "Locating the Artifacts Generated by SmartUpgrade".
By default, the SmartUpgrade command-line interface generates a report in text format and the report is written to the standard output of the current machine. In most cases, this means the output is written to the terminal window.
You can optionally generate a report in HTML format, which includes headings and lists that can make the output easier to read. Further, you can use your operating system commands to redirect the output to a file. The resulting HTML file can be read by any Web browser or other tool that can read HTML.
For example, if you have an EAR file called account_mgmt.ear
and it resides in a directory called my C:\MyApps
, then use the following command to generate an HTML file called account_mgmt_report.html
:
java -jar smartupgrade.jar --ears myApp.ear -html > account_mgmt_report.html
By default, SmartUpgrade generates a report and optionally generates artifacts by applying all rule categories to the selected archive or OC4J server configuration.
However, if you want to limit the size of the report, or if you want to focus on a particular aspect of your application, you can limit the analysis to a specific set of SmartUpgrade rule categories.
For example, to analyze only the data-source configuration of the myApp.ear
application:
java -jar smartupgrade.jar --ears myApp.ear -category data-sources
To apply multiple categories, separate the list of categories with a space. For example:
java -jar smartupgrade.jar --ears myApp.ear -category data-sources web-app
Table 3-5 describes the SmartUpgrade rule categories you can apply when generating your reports and, optionally, your application artifacts.
Table 3-5 List of SmartUpgrade Rule Categories
Rule Category | Use this category to analyze... |
---|---|
Artifacts specific to the Oracle Application Development Framework (Oracle ADF). |
|
Standard application programming interfaces (APIs) used in the application. This category of rules checks for OC4J and third-party APIs that may not be supported in Oracle WebLogic Server. |
|
Client interfaces within the application. |
|
Classloading configurations and shared libraries used by the application. |
|
Cluster-specific configuration settings in the application. |
|
OC4J-specific data source configuration settings. |
|
Enterprise Java Beans being used by the application. |
|
J2EE Connector Architecture (JCA) configuration settings and artifacts. |
|
Java Messaging Server configuration settings and artifacts, including the use of Oracle Enterprise Messaging Service (OEMS). |
|
Java Management Extensions (JMX) used by the application. |
|
Java Naming and Directory Interface (JNDI) configuration settings and artifacts. |
|
Java Transaction API (JTA) configuration settings and artifacts. |
|
Remote Method Invocation (RMI) configuration settings and artifacts. |
|
Security configuration settings and artifacts. |
|
Service-Oriented Architecture (SOA) configuration settings and artifacts. |
|
Web application configuration settings and artifacts. |
|
Web services configuration settings and artifacts. |
|
Oracle Web Cache configuration settings. |
By default, SmartUpgrade assumes the applications you are upgrading were previously deployed on Oracle Application Server 10g Release 3 (10.1.3).
However, you can use the -target option to specify that SmartUpgrade analyze your application for any features, configuration settings, or artifacts that are specific to 10g Release 2 (10.1.2).
If you are upgrading an application that was previously deployed on OC4J as part of an Oracle Application Server 10g Release 2 (10.1.2) installation, use the -target option as follows:
java -jar smartupgrade.jar --LOCATOR_NAME -target 10.1.2
For example:
java -jar smartupgrade.jar --ears C:\myApps\my1012App.ear -target 10.1.2
If you use Apache Ant in your development environment, you can use the custom Ant task shown in Example 3-2 to integrate SmartUpgrade with your existing Ant environment:
Example 3-2 Custom Ant Task for SmartUpgrade
<taskdef name="SmartUpgrade" classname="oracle.smartupgrade.UpgradeTask" classpath="${basedir}/smartupgrade.jar"/>
After you define the taskdef
, as shown in Example 3-2, then you can execute SmartUpgrade from within an Ant script.
Example 3-3 shows a typical example, which recursively locates all EAR files in the demo
directory and executes SmartUpgrade to examine each file. The valid values used for the upgrade locator
element in Example 3-3 are identical to those used for the LOCATOR_NAME on the Java command line.
For more information, see Section 3.1.4.2, "Identifying a SmartUpgrade Locator".