







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the j2ee framework, focusing on enterprise java beans (ejbs), their component types, and their containers. It also discusses how j2ee technologies map onto tools like jboss, apache tomcat, and ejb container. The roles of various j2ee platform services, including naming, deployment, transaction, and security services.
Typology: Study notes
1 / 13
This page cannot be seen from the preview
Don't miss anything!








Dr Kingsley Sage Room 2R308, Chichester II [email protected] © University of Sussex 2009
Looking at the J2EE framework in more detail Starting to understand Enterprise Java Beans (EJBs)
The J2EE embodies technologies to support multi-tier enterprise applications. These fall into 3 categories:
An application level software unit
JBoss Apache Tomcat EJB Container J2EE Application client container
JavaBeans Applets – Java based client components that execute within the browser Application clients – executes in its own client container. Can directly interact with the EJB tier – thus full access to J2EE platform services such as JNDI lookups, asynchronous messaging and the JDBC API Web components - software entity that provides a response to a request. Typically generates the user interface for a web based application. J2EE specifies two types of web components – servlets and JSPs EJBs …
A server side technology for developing and deploying components containing the business logic of an enterprise application EJB components are:
Session and entity beans have two types of interface: component and home Home interface defines methods to
Created to provide some service on behalf of a client and usually exists only for the duration of a single single client-server session Performs operations such as calculations or accessing a database May be transactional Can be stateless or maintain conversational state across methods and transactions If they do maintain state, EJB container manages the state Session bean object itself must manage its own persistent data // The remote interface import javax.ejb.Remote; @Remote public interface CalculatorRemote{ public int add(int x, iny y); public int subtract(int x, int y); } // Actual stateless session bean class import javax.ejb.*; @Stateless public class CalculatorBean implements CalculatorRemote { public int add(int x, iny y) { return x+y; } publc int subtract(int x, int y) { return x-y; } }
Enables asynchronous clients to access the business logic in the EJB tier Activated by a message received from a JMS queue A client does not directly access a message driven bean – instead a client asynchronously sends a message to a JMS queue Because they have no need to expose their methods to clients, they do no implement component or home interfaces Do not maintain state on behalf of a client
The J2EE platform defines several roles in the application development and deployment lifecycle:
J2EE platform services simplify application programming and allow components and applications to be customised at deployment time to use resources available in the deployment environment:
Java Naming and Directory Interface (JNDI) JNDI naming environment allows a components to be customised without the need to access or change the component’s source code (basically late name binding) JNDI provides a naming environment and provides it to the component as a JNDI naming context The javax.naming.InitialContext object provides a “look up” service for a component under the name java:comp/env Useful for things like database names and paths, and passing Java variables into low level system services (e.g. DLLs)
J2EE deployment services allow components and applications to be customised at the time they are packaged and deployed J2EE applications are deployed as a set of nested units. Each unit contains a deployment descriptor – an XML file that declaratively describes how to assemble and deploy the unit into a specific environment J2EE application consists of one or more J2EE modules and one one J2EE application deployment descriptor J2EE application consists of .jar files plus Resource Archive Files ( .rar ) packaged into an Enterprise Archive File ( .ear ) J2EE module consists of .jar files and web modules packaged as Web Archive files ( .war )
A system that supports transactions ensures that each unit completes without interference from other processes If the unit can be entirely completed it is committed, otherwise the system unrolls whatever work the unit has performed J2EE platform transactions are “flat” I.e. they cannot be nested
Allow applications to access a wide range of services in a uniform manner
Looking at Enterprise Java Beans in more detail with some code examples …