The EJB container is an interface b/w enterprise bean which provides the business logic in the Java EE server or a Java EE application. EJB container is run at the Java EE server & it manages the application's enterprise beans execution. EJB Container
When to Use EJB Distributed transactions are needed.Component security needed.Persistence needed.Integration along with the legacy applications are needed.Scalability is needed.
When not use EJB When one doesn’t require application integration, transactions or other infrastructure like facilities in their application.
EJB Advantages To access EJB free security is provided.Declarative transactions are provided.EJBs are cached & pooled. Containers manage the EJB life cycles.Remote access capabilities are present & are clustered for sake of scalability.OO concepts are supported for example inheritance.Usage of attributes or annotation based programming is possible.Free usage & access of complex resources
EJB Disadvantages Complicated and large specificationIncreased
Architecture of EJB is given below. 3 kinds of interfaces are exposed by the help of EJB which are as following:
1. Home interface
2. Remote interface
3. JMS Message Listener Interface EJB Architecture
EJB is multi tier system that is distributed & remote. It supports the protocols for example, HTTP, IIOP and JRMP etc. Rapid development of the versatile, reusable and portable business components takes place across the scalable, middle ware and transactional applications. For J2EE servers, EJB is considered as a specification. System level programming and business logic are present in EJB components for example security, threading, transactions, instance pooling, persistence etc which are managed
Updated 01-15-2012 at 08:50 AM by EJB
In the post, I will write about how to accessing a bean in EJB.
Accessing deployed beans is simple. First write the the client code and set up JNDI environment settings for the client. It can be done via a JNDI properties file. Now you have to set the class path for the client and add the following file locations to it:
jboss-client.jar, jnp-client.jar, EJB interfaces, and the directory where the JNDI properties file is stored
Remember, two JNDI settings
Talking about J2EE application servers, JBOSS is a popular choice. The reason is that JBOSS is open-source EJB solution with lot of impressive features that are missing in Weblogic, WebSphere, and the other big players.
Some of the interesting features provided by JBOSS are:
- enterprise-class security
- transaction support
- resource management
- load balancing
- database connection pooling
- JavaMail support