27
1 Java 2 Enterprise Edition (J2EE) Presented By: Mohamed Mansour

J2EE

  • Upload
    aamir97

  • View
    594

  • Download
    3

Embed Size (px)

Citation preview

Page 1: J2EE

1

Java 2 Enterprise Edition(J2EE)

Presented By: Mohamed Mansour

Page 2: J2EE

2

Notes

• WebSphere lab– Thursday (3/17) 3:00-5:00 PM– Room 153 CCB– www.cc.gatech.edu/~mansour/6210.html

• Extra credit project– Due Friday, April 1, at midnight– Contact mansour@cc for details

Page 3: J2EE

3

Outline

• Introduction & Motivation

• Enterprise Applications

• J2EE Architecture

• Server Side Components

• Q&A

Page 4: J2EE

4

Enterprise Applications

• Inter-company integration

• Intra-company integration

• Legacy applications

Page 5: J2EE

5

Enterprise ApplicationsEnd-User View

eBay.com

hotmail.com

my.SAP.com

Page 6: J2EE

6

Enterprise ApplicationsIntra-Enterprise

Page 7: J2EE

7

Enterprise ApplicationsInter-Enterprise

Page 8: J2EE

8

Challenges

• Interoperability

• Interface Complexity

• System Evolution

• Scalability

• Reliability

• Cost

Page 9: J2EE

9

Current Solutions

• Hide complexity in standard application server architectures– .NET, J2EE, other…

• Technology independent interfaces– XML and Web Services

Page 10: J2EE

10

J2EE Architecture

Page 11: J2EE

11

Request Dispatcher

Large Scale Deployment

Page 12: J2EE

12

Multi-Application Hosting

J2EE Server

App B

App C

App D

App A

App A

• Multiple applications on same server

• Statistical multiplexing over different request types

• Can we provide performance isolation guarantees between different applications?

Page 13: J2EE

13

J2EE ServerJ2EE Server

App B

App C

App D

App A

App AApp C

App B

Request Dispatcher

Multi-Application Hosting

Page 14: J2EE

14

EJB Container Services

• Persistence

• Transactions

• Caching

• Clustering

• Security

Page 15: J2EE

15

EJB Types

• Entity Beans– Persistent objects with primary keys– Container Managed Persistence (CMP)– Bean Managed Persistence (BMP)

• Session Beans– Stateless– Stateful

• Message Driven Beans (MDB)

Page 16: J2EE

16

EJBObject

Interface

RMI-IIOP

JVM 1 JVM 2

Calling Methods on EJBs

ClientServer

Page 17: J2EE

17

EJB

JVM 1 JVM 2

Calling Methods on EJBs

ClientServer

JNDI

Home“ejbs/ejb/MyEjbHome”

1. Lookup the home interface

Page 18: J2EE

18

EJB

JVM 1 JVM 2

Calling Methods on EJBs contd

ClientServer

JNDI

2. Use Home interface to obtain object interfacefrom server

Home

Home“ejbs/ejb/MyEjbHome”

Page 19: J2EE

19

EJB

JVM 1 JVM 2

Calling Methods on EJBs contd

ClientServer

JNDI

3. Use object interface to invoke server methods

Home

Home“ejbs/ejb/MyEjbHome”

Object Interface

Page 20: J2EE

20

Code SampleInitialContext ic = new InitialContext();

MyBeanHome home = (MyBeanHome) ic.lookup("java:comp/env/ejb/MyBeanHome")

MyBean b = (MyBean) home.create();

b.foobar();

Page 21: J2EE

21

EJB

Home

Object Interface

Local View

HomeObject

Interface

Remote View

Direct calls

RMI-IIOP

JVM 1

JVM 2Local Interfaces in J2EE 2.0

Server

Client

Page 22: J2EE

22

EJB ref name: “myEjbRef”JNDI name: “ejbs/ejb/MyEjbHome”EJB

JVM 1 JVM 2

EJB References

ClientServer

JNDI

Home“ejbs/ejb/MyEjbHome”

ic.lookup(“myEjbRef”)

XML configuration file

Page 23: J2EE

23

Using Remote Interfaces

Entity Bean

Entity Bean

Entity Bean

Entity BeanClient

RMI-IIOP

EJB Container

Page 24: J2EE

24

Using Remote Interfaces

• Network overhead for each call

• Separate transaction for each call– Entity beans have inconsistent state– Recovery must be performed at client side– Extra database statements (even for simple

set methods)

Page 25: J2EE

25

Using Local Interfaces

SessionBean

Entity Bean

Entity Bean

Entity Bean

Entity BeanClientRMI-IIOP

EJB Container

Page 26: J2EE

26

Q&A

Page 27: J2EE

27

References

• http://java.sun.com/products/ejb/

• http://java.sun.com/products/jdk/rmi/

• http://wwws.sun.com/software/jini/

• http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

• http://www.w3.org/2002/ws/

• http://www.onjava.com/pub/a/onjava/2004/11/03/localremote.html