1. Trang chủ
  2. » Công Nghệ Thông Tin

WebSphere Studio Application Developer Version 5 Programming Guide part 64 ppsx

10 191 0
Tài liệu đã được kiểm tra trùng lặp

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 204,98 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

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

Trang 2

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

Trang 4

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

Trang 5

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

Trang 6

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

Trang 7

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

Trang 8

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

Trang 9

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

Trang 10

򐂰 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

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