Sun Java System Application Server Platform Edition 8 Migrating and Redeploying Server Applications Guide |
Chapter 4
Migrating a Sample Application - an OverviewThis chapter describes the process for migrating the main components of a typical J2EE application from Sun ONE Application Server 6.x to Sun Java System Application Server Platform Edition 8. This chapter highlights some of the problems posed during the migration of each type of component and suggests practical solutions to overcome such problems.
For this migration process, the J2EE application presented is called iBank and is based on the actual migration of the iBank application from Sun ONE Application Server 6.x to the Application Server. iBank simulates an online banking service and covers all of the aspects traditionally associated with a J2EE application.
The sensitive points of the J2EE specification covered by the iBank application are summarized below:
- Servlets, especially with redirection to JSP pages (model-view-controller architecture)
- JSP pages, especially with static and dynamic inclusion of pages
- JSP custom tag libraries
- Creation and management of HTTP sessions
- Database access through the JDBC API
- Enterprise JavaBeans: Stateful and Stateless session beans, CMP and BMP entity beans
- Assembly and deployment in line with the standard packaging methods of the J2EE application
The iBank application is presented in detail in Appendix A, "iBank Application Specification."
Preparing for Migrating the iBank ApplicationBefore you start with the migration process learn about the differences in the deployment descriptors. For detailed information, see "Migrating Deployment Descriptors".
Choosing the Target
You must choose the migration target server as Sun Java System Application Server Platform Edition 8. After choosing the target server, install the server on your migration environment. For step-by-step instructions to install the software, see the Sun Java System Application Server Platform Edition 8 Installation Guide.
If you are using Migration Tool for Sun Java System Application Server Platform Edition 8 to migrate the components, you must install the tool. The Migration Tool can be downloaded from the following location:
http://java.sun.com/j2ee/tools/migration
For information on how to use the Migration Tool for Sun Java System Application Server Platform Edition 8, see the Migration Tool online help. The iBank application is bundled with the tool.
Identifying the Components of the iBank Application
The iBank application has the following directory structure:
- /docroot contains HTML, JSP’s and Image files in its root. It also contains the source files for servlets and EJBs in the sub-folder WEB-INF\classes following the package structure com.sun.bank.*. A war file is generated through the contents of this directory.
- /session contains the source code for the session beans following the package structure com.sun.bank.ejb.session. This directory forms the EJB module for the session beans.
- /entity contains the entity beans following the package structure com.sun.bank.ejb.entity. This directory would form the EJB module for entity beans.
- /misc contain the sql scripts for the database setup.
Manual Steps in the iBank Application MigrationMost of the migration is done by the Migration Tool. There are some aspects of migration that must be done manually. These steps are documented in the Migration Tool’s user’s guide and the documentation for the iBank sample application, which is included in the bundle.
Assembling Application for Deployment
Application Server primarily supports the J2EE model wherein applications are packaged in the form of an enterprise archive (EAR) file (extension .ear). The application is further subdivided into a collection of J2EE modules, packaged into Java archives (JAR, extension .jar) for EJBs and web archives (WAR, extension .war) for servlets and JSPs.
All the JSPs and Servlets should be packaged into WAR file, all EJBs into the JAR file and finally the WAR and the JAR file together with the deployment descriptors in to the EAR file. This EAR file is a deployable component.
Using the asadmin Utility to Deploy the iBank Application on Sun Java System Application Server Platform Edition 8
The last stage is to deploy the application on Sun Java System Application Server Platform Edition 8. The process for deploying an application is described below:
The Sun Java System Application Server Platform Edition 8 asadmin command includes a help section on deployment that is accessible from the Help menu.
The command line utility asadmin can be invoked by executing asadmin.bat file in Windows and asadmin file in Solaris Operating Environment that is stored in Application Server’s installation's bin directory.
At asadmin prompt, the command for deployment would be:
asadmin> deploy -u username -w password -H hostname -p adminport absolute_path_to_application
After you restart the Application Server, open a browser and go to the following URL to test the application:
http://<machine_name>:<port_number>/IBank
When prompted, enter one of the available user names and passwords. The main menu page of the iBank application should display.