Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Upgrade and Migration Guide

- Previous: Application Components

# Potential Migration Issues

While many of application design choices made are certainly debatable especially in the “real-world” context, care was taken to ensure that these choices enable the sample application to encompass as many potential issues as possible as one would face in the process of migrating a typical J2EE application.

This section will go through the potential issues that you might face when migrating a J2EE application, and the corresponding component of iBank that was included to check for this issue during the migration process.

With respect to the selected migration areas to address, this section specifically looks at the following technologies:

## Servlets

The iBank application includes a number of servlets, that enable us to detect potential issues with:

- The use of generic functionality of the Servlet API

- Storage/retrieval of attributes in the HTTP session and HTTP request

- Retrieval of servlet context initialization parameters

- Page redirection

## JavaServer Pages

With respect to the JSP specification, the following aspects have been addressed:

- Use of JSP declarations, scriptlets, expressions, and comments

- Static includes (`<%@ include file="…" %>`): notably tested with the inclusion of the `CheckSession.jsp` file in every page)

- Dynamic includes (`<jsp:include page=… />`): this is catered for by the dynamic inclusion of `Header.jsp` in every page

- Use of custom tag libraries: a custom tag library is used in the file `ShowTransactionHistory.jsp`

- Error pages for JSP exception handling: the `Error.jsp` page is the application error redirection page

## JDBC

The iBank application accesses a database via a connection pool and the data source, both programmatically (BMP entity bean, BankTeller session bean, custom tag library) and declaratively (with the CMP entity beans).

## Enterprise Java Beans

The iBank application uses a variety of Enterprise Java Beans.

### Entity Beans

Bean-managed persistence (`Customer` bean): allows us to test the following:

- JNDI lookup of initial context

- Pooled data source access via JDBC

- Definition of a BMP custom finder (`findByCustUsername()`)

Container-managed persistence (`Account` and `Branch` beans): allow us to test the following:

- Object/Relational mapping with the development tool and within the deployment descriptor

- Use of composite primary keys (`Account`)

- Definition of custom CMP finders (with the `Account` bean, and its `findOrderedAccountsForCustomer()` method). This is the occasion to look at differences in declaring the query logic in the deployment descriptor, and also to have a complex example returning a collection of objects.

### Session Beans

Stateless session beans: `InterestCalculator` allows us to test the following:

- Using and deploying a stateless session bean

- Calling a business method for calculations

Stateful session beans: `BankTeller` allows us to test the following:

- Looking up various interfaces using JNDI and initial contexts

- Using JDBC to perform database queries

- Using various transactional attributes on bean methods

- Using container-demarcated transactions

- Maintaining conversational state between calls

- Business methods acting as front-ends to entity beans (e.g., the “`getAccountSummary()`” method)

## Application Assembly

The iBank application is assembled by following the J2EE standard procedures. It contains the following components:

- A Web application archive file for the Web application module, and EJB-JAR archives for the EJBs

- An enterprise application archive file (EAR file) for the final packaging of the Web application and EJB modules

- Previous: Application Components

- © 2010, Oracle Corporation and/or its affiliates