Mã Ví dụ 5,5 cho thấy một hạt đậu thông điệp điều khiển cập nhật đơn đặt hàng dựa trên các thông tin hóa đơn nhận được trong một thông điệp JMS. Đậu thông điệp điều khiển lắng nghe JMS tin nhắn có chứa các dữ liệu hóa đơn. public class InvoiceMDB thực hiện | DEPLOYMENT TOOLS 243 ployment descriptor enforcing the application s security policy on access to the enterprise bean s methods. 3. Set up the transaction environment for the enterprise bean according to its deployment descriptor. This is needed so that the calls to the methods of the enterprise bean happen in the correct transaction context. 4. Register the enterprise bean its environment properties resources references and so on in the JNDI namespace. 5. Create database tables for enterprise beans that use container-managed persistence. For each Web component the J2EE server must perform the following tasks 1. Transfer the contents of the Web component underneath the context root of the server. Since there may be more than one J2EE application installed the server may install each in a specific directory. For example the J2EE SDK installs each application under a context root specified at deployment time. The sample application is installed in the petstore directory. 2. Initialize the security environment of the application. This involves configuring the form-based login mechanism role-to-principal mappings and so on. 3. Register environment properties resource references and EJB references in the JNDI namespace. 4. Set up the environment for the Web application. For example it performs the alias mappings and configures the servlet context parameters. 5. Precompile JSP pages as specified in the deployment descriptor. The tool used to deploy an application client and the mechanism used to install the application client are not specified by the J2EE specification. Very sophisticated J2EE products may allow the application client to be deployed on a J2EE server and automatically made available to some set of usually intranet clients. Other J2EE products may require the J2EE application bundle containing the application client to be manually deployed and installed on each client machine. Another approach would be for the deployment tool on the J2EE server to produce