Deploying Enterprise Java Web Application To Ibm Websphere
Deploying Enterprise Java Web Application To Ibm Websphere
• Introduction
• Preparing to Deploy to WebSphere
• Deploying Web Application to WebSphere
• Configuring Datasource on WebSphere
• Configuring Datasource Connection on DB-VA
Introduction
This document is based on the Programmer's Guide for Java - Chapter 3 Developing Java Enterprise Web Application example
to demonstrate the deployment step on the WebSphere Server. The Example of Programmer's Guide for java - Chapter 3 is
deployed on the JBoss Server, we need to modify some configuration before deploy on the WebSphere Server. Finally, we will
configure the web application to use the datasource connection provide by WebSphere server to connect to database.
1. From the menu bar, select Tools > Object Relational Mapping (ORM) > Generate Code ... to open Database Code
Generation dialog box.
3-2
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
2. Change Deploy To option from JBoss Application Server to Generic Application Server.
DB-VA helps you to select the corresponding Optional Jar files and set datasource options.
1. Open the command prompt to the schoolsystem.war folder in the JBoss deploy folder.
2. Execute jar to create a war file in command prompt.
3-3
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
3. Startup WebSphere Application Server 6. Start menu > All Program > IBM WebSphere > Application Server v6
> Profiles > AppSrv01 > Start the server.
4. Go to Administration Console (http://localhost:9061/ibm/console) to login (note that the port number for some
WebSphere users may not be 9061, so replace it with the correct one in such case).
5. Select Applications > Install New Application to install the schoolsystem.war file
6. Select the War file and fill in the Context Root (schoolsystem)
3-4
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
8. Click Save to Master Configuration and click Save in this page to apply all changes.
9. Start the new deploy SchoolProject Web Application. Select Applications > Enterprise Application.
10. Select schoolsystem_war and click the Start button to startup the Web Application on the server.
3-5
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
Figure 3.14 -
3-6
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
3-7
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
6. Select the Additional Properties > Data sources on the right hand side.
3-8
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
9. Select the Additional Properties > Custom properties on the right hand side.
3-9
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
11. Add url property and click OK to create the url property
Name url
Value jdbc:mysql://localhost/schoolsystem
12. Click Save to apply all previous JDBC and datasource setting
13. Select the J2EE Connector Architecture (J2C) authentication data entries. It can create the data entries of
username and password to connect to database.
Figure 3.25 - Select J2EE Connector Architecture (J2C) authentication data entries
3-10
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
15. Enter the Alias, User ID and Password and click Apply to save and return to the MySQL Datasource Page.
16. Select the previously created username and password on Container-managed authentication and then click Apply.
3-11
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
1. From the menu bar, select Tools > Object Relational Mapping (ORM) > Generate Code ... to open the Database
Code Generation dialog box.
3-12
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
2. Select the Database tab and select the Connection option from JDBC to Datasource.
Dialect org.hibernate.dialect.MySQLInnoDBDialect
Datasource JNDI Name app/schoolsystem
JNDI Provider URL (empty)
JNDI InitialContextFactory class com.ibm.websphere.naming.WsnInitialContextFactory
User name (connect database user name)
Password (connect database password)
TransactionManagerLookup class org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
TransactionFactory class org.hibernate.transaction.JTATransactionFactory
3-13
Deployment Guide for Java Chapter 3 – Deploying Enterprise Java Web Application to IBM WebSphere
3-14