Implementing EJB 3.x applications

Use this task when you are implementing Enterprise JavaBeans (EJB) 3.x applications.

About this task

Based on the Enterprise JavaBeans (EJB) specification, enterprise beans are Java™ components that typically implement the business logic of Java Platform, Enterprise Edition (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. You 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. You 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. You 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 Developing 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 you have cached the EJB reference in an instance variable by using either @EJB injection or JNDI lookup, then you can catch this exception and refresh the EJB reference by performing a non-cached lookup.

Complete the following procedure if you want to implement EJB 3.x application in WebSphere Application Server, including tuning and troubleshooting tips.

Procedure

  1. Migrate enterprise bean code.
    1. There are no migration issues associated with using EJB 3.x beans. Existing applications continue to run as-is and compile without error. The EJB 3.0 and 3.1 specifications have deprecated the use of EJB 1.1 style entity beans. You are encouraged to start migrating to Java™ Persistence API (JPA) or JDBC as a replacement for entity beans.
  2. Develop EJB 3.x applications.
    1. Design a Java EE application and the enterprise beans that it needs. Before developing entity beans with CMP, read the topic, Concurrency control. Keep in mind that EJB 3.x modules do not support entity beans. You must continue to place entity beans in your EJB 2.x-level modules.
  3. Assemble EJB 3.x applications.
    1. Assemble an EJB 3.x module to contain enterprise beans and related code artifacts. Group web components, client code, and resource adapter code in separate modules. After the EJB module is assembled, install it as a stand-alone application or combine it with other modules into an enterprise application.
  4. Deploy the EJB 3.x applications.
    1. When you deploy an EJB module, you install that module on a server that has been configured to support deployed modules. Assemble one or more EJB modules, assemble one or more web modules, and assemble them into a Java EE application.
  5. Administer EJB 3.x applications.
    1. Manage EJB containers, administer session beans and entity beans.
  6. Secure EJB 3.x applications.
    1. You can protect enterprise bean methods by assigning security roles to them. Before you assign security roles, you need to know which EJB methods need protecting and how to protect them.
  7. Tune EJB 3.x applications.
    1. If you use applications that affect the size of the EJB container cache, it is possible that the performance of your applications can be impacted by an incorrect size setting. It is important to know that entity beans are not supported in an EJB 3.x module. One of the steps in tuning your EJB container to optimum performance levels is to fine-tune the EJB cache.
  8. Troubleshoot EJB 3.x applications.
    1. Use these troubleshooting tips for problems related to accessing enterprise beans.

Results

You have implemented EJB 3.x applications on WebSphere Application Server.

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:10
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tejb_implement_ejb3x_apps
파일 이름:tejb_implement_ejb3x_apps.html