![]() |
SimpleBank EJB Subclassing Sample Application |
SimpleBank EJB Subclassing Sample Application
This document describes how to utilize the SimpleBank EJB Subclassing sample application in conjunction with Sun Java (tm) System Application Server 7.This sample application document contains the following sections:
Overview
Compiling and Assembling the Application
Deploying the Sample Application
Overview
This sample demonstrates the subclassing beans as a way to simplify related bean classes. In this SimpleBank example, the parent bean contains methods that are unique or can be overridden by the methods in the child bean. In this example, notice that there are no properties defined for the parent bean in the sun-ejb-jar.xml only the children have the properties defined.Setting up the environment
In order to successfully deploy and run the JDBC SIMPLE sample application, Database resources (PointBase) needs to be setup with the Application Server.
If you want to run this sample on Oracle Database, please refer to (How to run sample applications with Oracle ) .
Compiling and Assembling the Application
This section contains instructions to build and assemble the SimpleBank EJB Subclassing sample application using a Command Line Interface (CLI). Please refer to the Sample Application Build Facility document for details on using a build facility.To rebuild the entire application from scratch, follow these steps:
Compile and Assemble the application.
Deploy the application.
- Execute the asant command under <install_dir>/samples/ejb/subclassing/src.
- The default target core is executed to rebuild the .ear file.
Clean the application project area.
- After you have re-created the sample application from scratch, proceed to Deploying the Sample Application.
Undeploy the application.
- Execute the command asant clean to clean the application area.
Build Javadocs.
- Execute the command asant undeploy to undeploy the application.
- Execute the command asant javadocs to create Javadocs.
- The Javadocs are created under <install_dir>/samples/ejb/subclassing/javadocs.
Deploying the Sample Application
In this section, you will learn how to deploy the SimpleBank EJB Subclassing sample application.A pre-built subclassing .ear file is supplied with the application server installation. The pre-built subclassing .ear file is the Enterprise Archive (.ear) file of the application, which contain the ejb jar and war files. Within the ejb jar and war files reside the .xml deployment descriptor files, application class files, and other content required by the application. You can use the pre-built .ear file to deploy the application. If you want to compile and assemble the application from scratch, follow the instructions under Compiling and Assembling the Application.
To deploy the application, the administrative server needs to be running.
To start the administrative server if it is not already started:
For UNIX:
Select one of the following approaches to deploying the application:
For Windows:
- Execute <install_dir>/domains/domain1/admin-server/startserv
- Start->Programs->Sun Java (tm) System Application Server 7->Start Application Server
Command Line-based Deployment describes how to manually register the application in Sun Java (tm) System Application Server using a Command Line Interface (CLI). This is the fastest means of deploying the sample application.
GUI-based Deployment describes how to use the Sun Java (tm) System Application Server Deployment Tool to import and deploy the sample application.
Command Line-based Deployment
The deployment process includes deploying the application .war file to the Sun Java (tm) System application server. CLI deployment of the application can be performed using either the asant script or the asadmin command.To deploy the application using the asant command:
>cd <install_dir>/samples/ejb/subclassing/src
To deploy the application file using the asadmin command:Execute the asant deploy command.
- It is an interactive command that might prompt you to provide the admin-server host, admin-server port, admin user name, admin password and appserv instance.
>cd <install_dir>/samples/ejb/subclassing
The deployment process involves the following operations:Execute the following command:
- asadmin deploy -u <user-name> -w <password> -H <hostname> -p <admin server port> --instance <instance name> subclassing.ear.
It authenticates against the local application server's administrative server
You are now ready to exercise the application by Running the Sample Application.The .ear file is transferred to the administrative server.
The administrative server begins the registration process:
Log in to the web-based administration tool from the browser.
You may now proceed to Running the Sample Application.
Click Deploy.
- Application Server Instances --> <server instance> --> Applications --> Enterprise Apps
Click Browse to locate the sublassing.ear file.
Click OK.
- The file is located under <install_dir>/samples/ejb/subclassing.
Enter subclassing in the Application Name field.
Click the subclassing link to verify that the application is deployed.
Running the Sample Application
Perform the following steps to run the sample application:
Go to http://<hostname>:<port>/subclassing/index.html
You may verify all the operations by opening a SQL connection in a new window and running queries against the customer2 table.Enter 123456789 as Customer Social Security Number.
Enter data filling in the customer details.
- Click Create.
Return to the main page.
- Click add customer.
Edit the amounts.
- Enter the SSN of the previously created customer.
- Press edit.
Return to the main page.
- Press Update customer to update the required fields.
- Enter the same SSN.
- Press delete to delete the customer records.
Generating javadocs
To better understand sample application source code, you may refer to the related javadocs.To generate javadocs, run one of the following commands:
After javadocs are generated, you may access them at <install_dir>/samples/ejb/subclassing/javadocs/index.html.
Troubleshooting
If you encounter problems when running the application, review the log files at <install-dir>/domains/domain1/<server-instance>/logs/server.log to learn what exactly went wrong.Before redeploying the application again, please delete the jdbc resources from Administration tool as follows:
Some Known Issues:
- While running the sample, entering decimal amounts against Savings Account and Checking Account may result in 500 internal error.
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated August 12, 2002