Implement EJB 3.x applications
Use this task when we are implementing EJB 3.x applications.
Based on the EJB specification, enterprise beans are Java components that typically implement the business logic of JEE (JEE) applications as well as access data. IBM WebSphere Application Server provides broad support for enterprise beans, including the EJB 2.x and EJB 3.x specifications. The EJB 3 specification simplifies the development of business logic and data handling for enterprise applications. We can assemble the beans into one or more EJB 3.x modules using one of the assembly tools.
The EJB 3.0 specification has justifiably been called the most important upgrade to the Java™ Platform, Enterprise Edition 5 (Java EE 5) programming model. The EJB 3.0 specification represents simplification and streamlining of the business logic and persistence programming models used in Java EE. While the Java Persistence API (JPA) replacement is called an entity class, it should not be confused with entity enterprise beans. A JPA entity is not an enterprise bean and is not required to run in an EJB container.
The EJB specification only requires local client views to be supported for EJBs packaged within the same application. This includes local homes, local business interfaces, and the no-interface view. WebSphere Application Server permits access to local client views to EJBs packaged within a separate application with some restrictions:
- The local interface and all parameter, return, and exception types used by the local interface must be visible to the class loader of both the calling application and the target EJB application. We can ensure this by either using a shared library associated with a server class loader or by using an isolated shared library associated with both applications. Read the Creating shared libraries topic for more information.
- When the target EJB application is stopped, any cached references to the EJB must be refreshed. We can either:
- Restart the calling application. The simplest solution is to restart the calling application whenever you restart a target EJB application on which it relies.
- Obtain a new reference from JNDI. By default, JNDI lookups from the java namespace are cached, and the cache must either be disabled or cleared to obtain a new reference. Read the Develop applications that use JNDI topic for more information.
EJB method invocations throw com.ibm.websphere.ejbcontainer.EJBStoppedException when the target EJB application has been stopped. If we have cached the EJB reference in an instance variable by using either @EJB injection or JNDI lookup, then we can catch this exception and refresh the EJB reference by performing a non-cached lookup.
Complete the following procedure if to implement EJB 3.x application in WebSphere Application Server, including tuning and troubleshooting tips.
- Migrate enterprise bean code.
- Develop EJB 3.x applications.
- Assemble EJB 3.x applications.
- Deploy the EJB 3.x applications.
- Administer EJB 3.x applications.
- Secure EJB 3.x applications.
- Tune EJB 3.x applications.
- Troubleshoot EJB 3.x applications.
Results
You have implemented EJB 3.x applications on WebSphere Application Server.
Subtopics
- Migrate enterprise bean code.
- Develop EJB 3.x applications.
- Assemble EJB 3.x applications.
- Deploy the EJB 3.x applications.
- Administer EJB 3.x applications.
- Secure EJB 3.x applications.
- Tune EJB 3.x applications.
- Troubleshoot EJB 3.x applications.
Related tasks
Change applications to WebSphere version specific setRollbackOnly behavior