EJB • EJB is a server side component architecture that enables building enterprise-class distributed applications in Java. • The client of an enterprise bean could be anything- servlet ,applet or another enterprise bean.
Types of Beans o Session Beans o Stateless Session Beans o Stateful Session Beans
o Entity Beans o Bean managed Persistent Entity Beans o Container managed Persistent Entity Beans
o Message Driven Beans
EJB Container Features • • • • • •
Resource Management State Management Transaction Security Persistence Location Transparency
EJB Component Contents • • • • • • •
Enterprise Bean Class Remote Interface EJB Object Home Interface Home Object Deployment Descriptor EJB-Jar File
• Enterprise Bean Class – Contains Business method Implementation – Hidden from the client – Accessed through EJB Object
• Remote Interface – Enumerates the methods exposed by enterprise bean
• EJB Object – Container generated remote interface for handling middleware
• Home Interface – It is a factory for generating EJB Objects – It is network aware.
• Home Object – Container generated implementation of Home Interface
• Deployment Descriptor – Specifies the middleware requirements of the bean.
• EJB-Jar File – Contains all the bean’s classes
Developing Web Services in J2EE • Web Services are developed using JAXRPC in the following steps – Develop the Service Definition Interface – Develop the Implementation Class – Build the Service – Deploy the Service – Access the service through a Client