230 likes | 592 Views
10/12/2012. 2. Note. WebSphere may not be suitable for the EJB programming assignment. A team in Fall of 2005 found that the current version that they required for their project needed 1.2 GB of disk space. Since AFS space is allocated to students in 250 MB chunks, a different EJB container may be
E N D
1. Develop and Deploy J2EE Application on Websphere 5.0 Presented by
Nishi Singh
2. 10/12/2012 2 Note WebSphere may not be suitable for the EJB programming assignment. A team in Fall of 2005 found that the current version that they required for their project needed 1.2 GB of disk space. Since AFS space is allocated to students in 250 MB chunks, a different EJB container may be more practical if you are using AFS.
3. 10/12/2012 3 Objectives Learn to develop J2EE applications using WebSphere Studio 5.0 IDE (Interactive Development Environment), also known as WSAD 5.0
Deploy and run J2EE applications on WebSphere 5.0 application server, also known as WAS 5.0
4. 10/12/2012 4 Prerequisites Knowledge of Java programming language and J2EE concepts, namely:
Servlets/ JSPs
EJBs
Knowledge of database concepts and some understanding of transactions
An understanding of Struts framework can be helpful but is not required.
5. 10/12/2012 5 What is J2EE? The Java 2 Platform, Enterprise Edition (J2EE) defines standards for developing multi-tier enterprise applications using J2SE (Java 2 Standard Edition) technologies such as:
Enterprise JavaBeans
Java Servlets
JDBC to access data tables from Java programs.
JSP (Java Server Pages)
JMS (Java Messaging Service)
Transactions, etc.
6. 10/12/2012 6 What is WebSphere? WebSphere (WAS 5.0) is a Java 2 Enterprise Edition (J2EE) application server built by IBM
WebSphere has in-built web-container to serve Servlets, JSP and HTML requests
WebSphere has in-built EJB-container which supports EJB 2.0 specifications
Websphere Studio 5.0 (WSAD 5.0) is an eclipse-based Java IDE supporting Java 1.4
7. 10/12/2012 7 J2EE highlights - 1. EJB EJB is a server component architecture to develop distributed, transactional, secure and portable Java applications. Three types of EJBs:
Entity Beans Each entity bean object represents a unique row in its related table. For example: Student is an entity bean in a grading system application.
Session Beans Session beans use entity beans to perform transactions. For example: AssignGradesToStudent session bean
MDB (Message driven beans) MDBs support EJB integration with outside enterprise applications
8. 10/12/2012 8 J2EE highlights - 2. Servlets/ JSPs Java Servlets allow a mechanism to extending the Web server functionality:
Servlets entry point is its service() method
service() method accepts two arguments HTTP request and HTTP response.
HTTP request is the request from web-browser
HTTP response is servlets response to browser
JSP simplifies creating dynamic HTML pages by allowing developers to embed Java code inside an HTML document.
9. 10/12/2012 9 What is Struts? Struts is an Apaches open source MVC (Model-View-Controller) framework.
Struts consists of a primary Servlets controller class called ActionServlet: this controller servlet is the primary recipient of all HTTP requests.
Struts provides the concept of Action classes: Customized Classes that can be developed to handle different types of requests and render appropriate HTML/ JSP pages.
10. 10/12/2012 10 WSAD 5.0 Basic Features Developed on Eclipse-based Workbench
Provides APIs, models, and frameworks to develop and test J2EE applications
Provides unique perspectives for J2EE, Java, Web, Server, Data, XML related development tasks.
Provides common services for resource management:
Debugging/ Websphere 5.0 Test Server
Team programming (basic support for CVS etc.)
Easy deployment of application to Websphere 5.0
Tools to create EAR, WAR, JAR files
11. 10/12/2012 11 WSAD 5.0 Eclipse Platform
12. 10/12/2012 12 WSAD 5.0 Basics of J2EE perspective Projects and folders
Enterprise Application project
To create EAR file, which can be deployed on Websphere 5.0
Contains combination of Web modules, EJB modules, application client modules, and JAR files.
Application Client project
Contains resources needed for application client modules
Web project
Contains both static and dynamic content JSP, Servlets, and HTML
EJB project
Contains resource for EJB applications
13. 10/12/2012 13 WSAD 5.0 - Building J2EE Applications Developing Web applications
Create a web project using Web project wizard
Create classes using Class wizard in the Web Content Directory.
Deployment descriptors, Meta-inf, theme, web-inf are automatically created.
Web Project Directory Structure
Web Deployment Descriptor
Java Source Java source code
Web Content holds content of WAR files(Java classes and servlets, HTML files, JSPs, and graphics)
META-INF contains manifest files
THEME CSS files
WEB-INF Classes, Lib, ibm-web-bnd.xmi, ibm-web-ext.xmi, web,xml
14. 10/12/2012 14 WSAD 5.0 - Building J2EE Applications (contd..) Creating a Server for testing
Automatic Server Creation( select the web project and run on server from context menu)
Manual Server Creation (Open Server Perspective, select New-> Server and Server Configuration )
Select the Page or WebProject and click on run on server from the Context menu.
15. 10/12/2012 15 WSAD 5.0 - Building J2EE Applications (contd. ..EJBs) Create an EJB Project using the wizard
Create entity and session beans and add attributes to beans using the wizard.
LocalHome, Local, Bean , PrimaryKey is created
Create entity relationship one-to-many, many-to-many, if required.
Generate EJB to RDB mapping to create a schema with bean to table mappings.
Generate Deployment code using the generate deploy and RMIC code under context menu
16. 10/12/2012 16 WSAD 5.0 - Building J2EE Applications EJB-RDB Map
17. 10/12/2012 17 WSAD 5.0 - Building J2EE Applications EJB contd.. Update EJB deployment Descriptor select the JNDI name and Backend ID(DataSource)
Test the EJB
Start the Test Server in debug mode - Application Developer automatically publishes your projects to the server.
In the console view you should find which data source, Web and EJB modules are loaded
18. 10/12/2012 18 WSAD 5.0 Debugging J2EE Applications EJB test page
19. 10/12/2012 19 WSAD 5.0 Using EJBs in Web Project/ WAR file Include the EJB Jar in the Web Project under Jar dependencies.
Add the EJB in the Web deployment descriptor (web.xml) under EJB Reference
Restart the server to test the EJB calls in the Application.
20. 10/12/2012 20 WAS 5.0 - Basics Application server:
Primary component of WebSphere
Runs in a Java virtual machine (JVM)
Has three containers:
Web container
EJB container
J2C container
Node
Logical grouping of WAS managed server processes
Cell
Grouping of nodes into single administrative domain.
21. 10/12/2012 21 WAS 5.0 Deploying J2EE application overview Create an application server to host the application.
Define the necessary resources, such as JDBC provider, data source and virtual hosts.
Configure J2C Authentication data
Export EAR file from WSAD Enterprise project or from Application Assembly Tool (AAT) that comes with WAS 5.0
22. 10/12/2012 22 WAS 5.0 Deploying J2EE application steps involved Select Applications -> Install New Application from the administrative console navigation bar.
Click Install. Installable EAR files can be picked up either locally or remotely
Click Next, the next window lets you specify default bindings for the application you are deploying.
Verify the summary page on installation wizard for correct EAR file information.
Start the Enterprise application that was just added.
The application is now deployed and running.
23. 10/12/2012 23 References http://java.sun.com/j2ee/1.4/docs/
http://www.redbooks.ibm.com
WebSphere Studio Application Developer Version 5 Programming Guide: IBM Redbook # SG24-6957-00
IBM WebSphere Application Server V5.0 System Management and Configuration : IBM Redbook # SG24-6195-00