WebSphere Studio Application Developer Version 5 Programming Guide part 64 ppsx

10 190 0
WebSphere Studio Application Developer Version 5 Programming Guide part 64 ppsx

Đang tải... (xem toàn văn)

Thông tin tài liệu

604 WebSphere Studio Application Developer Version 5 Programming Guide © Copyright IBM Corp. 2003. All rights reserved. 605 Part 4 Deploying and profiling applications Part 4 discusses the deployment of enterprise applications, how to build applications with Ant, and how to initiate a performance analysis by using the profiling feature of Application Developer. Part 4 606 WebSphere Studio Application Developer Version 5 Programming Guide © Copyright IBM Corp. 2003. All rights reserved. 607 Chapter 18. Deploying enterprise applications This chapter explains how to deploy an enterprise application to a WebSphere Application Server Version 5.0. In this chapter, we tell you how to:  Export an enterprise application to an EAR file  Set up a J2C authentication alias  Create a data source using the authentication alias  Deploy the application to the default server and start it  Test the deployed Web applications For detailed information about WebSphere Application Server, see the IBM Redbook, IBM WebSphere Application Server Version 5.0 Handbook , SG24-6195. For detailed information about EJB development and deployment, see the IBM Redbook, EJB 2.0 Development with WebSphere Studio Application Developer , SG24-6819. 18 608 WebSphere Studio Application Developer Version 5 Programming Guide Enterprise application deployment Deployment is an important topic that should be considered by every development project. Unfortunately, this is not always the case. Developers often develop applications without thinking too much about the environment in which they will be deployed. Once handed over to the IT Department, the applications may not perform optimally or may, due to poor packaging, become a maintenance nightmare with interdependencies between modules, version incompatibility, and classpath problems. Although Application Developer 5.0 has excellent support for testing applications in its built-in test environment, it is always good practice to export your application and deploy and test it on the target environment as early as possible in the development cycle. More than one project has had unpleasant surprises when developing large applications by only using the built-in test environment for testing, and then attempted to deploy it to the target environment—only to find out, too late, that it failed there. Importing the enterprise application In this example we use the ItsoProGuide enterprise application that we developed so far in the previous chapters. This enterprise application has an EJB module, several Web modules, and a utility JAR (a Java project). You can use your own ItsoProGuide project, or import the EAR file from the sample code associated with this redbook (see Appendix C, “Additional material” on page 809). To import the enterprise application follow the instructions in “Installing the ItsoProGuide.ear file” on page 812. Make sure that the classpath is fixed for the projects that show errors. Working with deployment descriptors Application Developer provides editors to customize the deployment descriptors for both EJB modules and Web modules. This more or less makes the WebSphere Application Assembly Tool (AAT) that ships with WebSphere Application Server redundant. However, if you were to package applications for deployment to WebSphere Application Server and you did not use Application Developer, you would need the AAT to customize the deployment descriptors. Chapter 18. Deploying enterprise applications 609 EJB deployment descriptor EJB modules are contained in EJB JAR files. The important deployment information for a WebSphere Application Server that you have to configure is contained in the WebSphere Bindings sections of the deployment descriptor editor. The other information should have been provided by the application developers. Before exporting the EAR file, we verify that the database mapping deployment information for the EJBs in our project is correct:  Open the deployment descriptor editor for the ItsoProGuideEJB project by expanding the EJB Modules in the J2EE Perspective, J2EE Hierarchy view and double-clicking the ItsoProGuideEJB module. This brings up the window shown in Figure 18-1. Figure 18-1 EJB Deployment Descriptor editor Note: At the time of writing, IBM has released a preview of a tool called the Assembly Toolkit for WebSphere Application Server. This tool is based on the Eclipse platform and provides the functionality of the Application Assembly Tool (application packaging and deployment descriptor editing) but also adds functionality like database meet-in-the-middle mapping. We do not describe this tool here because we can do the same with Application Developer. 610 WebSphere Studio Application Developer Version 5 Programming Guide The editor has the following tabs (only the most important tabs that have to do with deployment information are listed):  Overview—Backend ID and JNDI - CMP Factory Connection Binding  Beans—JNDI name for each bean and possible WebSphere extensions such as caching  Assembly Descriptor—Definition of security roles, method permissions, and container transactions  References—JNDI name for each of the references  Access—WebSphere extensions for security, access intent, and isolation level Select the Overview tab and scroll to the bottom of the page as shown in Figure 18-2. Figure 18-2 Specifying database mapping information  Verify that DB2UDBNT_V72_1 is selected as the Backend ID.  Verify that the JNDI name for the data source is jdbc/ejbbank and that Per_Connection_Factory is used as Container authorization type. Per_Connection_Factory uses authentication per module. The other choice, Container , uses authentication by the EJB container.  Save the deployment description information by pressing Ctrl-S. We will not use any of the EJB security functions in our examples. Note: There is a graphical bug in Application Developer 5.0 that sometimes truncates the first character(s) of the drop-down fields in this editor. Chapter 18. Deploying enterprise applications 611 Web deployment descriptor Web modules are contained in WAR files and are described by Web deployment descriptors. Just as for the case with the EJB deployment descriptors, the application developers should have provided most of the information necessary. Before exporting the EAR file, we verify that the deployment information is suitable for a production system.  Open the Web deployment descriptor editor by expanding the Web Modules in the J2EE Hierarchy view and double-clicking the ItsoProGuideBasicWeb module (Figure 18-3). Figure 18-3 Web Deployment Descriptor editor 612 WebSphere Studio Application Developer Version 5 Programming Guide The editor has the following tabs (only the most important tabs are listed):  Overview—This page is a summary of the information on the other pages. You can see the servlets and JSPs, filters, listeners, pages, and references. The only WebSphere deployment information is the virtual host name (default_host) at the bottom of the dialog (not visible in Figure 18-3).  Servlets—These are servlet mappings and load-on-startup settings.  References—These are the JNDI names for each of the references (our application references the BankEJB session bean).  Pages—These are welcome pages when the Web application is invoked without specifying a specific Web page.  Extensions—These are WebSphere extensions such as reloading, JSP precompile, file serving, and caching (Figure 18-4). Figure 18-4 Specifying WebSphere extensions  Deselect the Reloading enabled option. If selected, this causes WebSphere Application Server to scan the classpath for the application at regular intervals to check for modified classes and reload them. This may be fine for a development test system, but should be avoided in production, as it consumes unnecessary CPU cycles and may be a potential security risk if someone manages to introduce incorrect classes in the file system. Deployment of new versions must be done in a controlled manner. Chapter 18. Deploying enterprise applications 613  Verify that the File serving enabled option is selected. This tells WebSphere Application Server that it should not only serve dynamic content, such as servlets and JSPs, but also static content like HTML pages and images. In our simple environment we want to use this feature as it makes deployment a little easier. However, in a production environment you may want a separate HTTP server (perhaps on a remote machine) to serve the static content and this option should then be deselected.  Deselect the Serve servlets by classname option. If selected it means that a user can invoke servlets using their class name (for example itso.basocweb.control.ListAccounts). This can be a potential security risk if users manage to find out the class names and access servlets that were not meant to be accessed directly. If this option is deselected only servlets that are explicitly named on the Servlets tab and mapped to a URL are accessible.  Select the Precompile JSPs option to have all JSPs compiled during application startup.  Save the deployment description information by pressing Ctrl-S. Application client module deployment descriptor An application client module is contained in a client JAR file. The WebSphere specific options in the deployment descriptor are:  References—JNDI name for each of the references (Figure 18-5) Figure 18-5 Application client deployment descriptor We provide an application client module called ItsoProGuideJavaClient. . 604 WebSphere Studio Application Developer Version 5 Programming Guide © Copyright IBM Corp. 2003. All rights reserved. 6 05 Part 4 Deploying and profiling applications Part 4 discusses. describe this tool here because we can do the same with Application Developer. 610 WebSphere Studio Application Developer Version 5 Programming Guide The editor has the following tabs (only the most. WebSphere Studio Application Developer , SG24-6819. 18 608 WebSphere Studio Application Developer Version 5 Programming Guide Enterprise application deployment Deployment is an important topic that

Ngày đăng: 03/07/2014, 20:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan