524 WebSphere Studio Application Developer Version 5 Programming Guide Click Next . On the page shown in Figure 15-8, you can define a new remote file transfer instance or reuse an existing one, if one exists. A remote file transfer instance contains information on how to transfer the Enterprise application and server configuration to the remote server when publishing. Select Copy file transfer mechanism and then click Next. Figure 15-8 Selecting a file transfer mechanism Notes: If you select Use default WebSphere deployment directory , the WebSphere Application Server configuration on the remote machine is replaced by the published version. Before publishing, Application Developer creates a backup copy of the configuration. In the target WebSphere Deployment Directory, it creates a config/wasTools_bkup directory and a properties/wasTools_bkup directory. In these directories, it creates backup directories and files. Only one backup directory per day is created, however. The paths on this page refers to the remote machine. Therefore C: means C: on the remote machine, not the machine where Application Developer is running. If you are using DB2: In the DB2 driver location field, type the DB2 location where the DB2 classes reside on the remote machine. If a default value has been set in the Window -> Preferences -> WebSphere dialog, this field is pre-filled with the DB2 location. Chapter 15. Servers and server configurations 525 Copy file transfer On the page shown in Figure 15-9, you specify the settings for the new file transfer mechanism to be created. This page shows the settings for a copy file transfer mechanism. Figure 15-9 Creating a new copy file transfer mechanism In the Project folder field, enter the name of the project folder in your workspace where the remote file transfer instance should be created. In our example we place it in the ItsoProGuideServer project folder. In the Remote file transfer name field, enter a name for the remote file transfer instance. We choose the name vertex-copy. In the Remote target directory field, type the name of the directory on the remote machine where you want your Enterprise application and server configuration to be published. The remote target directory is the one as seen by the local machine (where Application Developer is running). In our case we have mapped our W: drive to C:\ of the remote machine, so we enter W:/WebSphere/AppServer. If setting up a local server, the remote target directory would have been the same as the WebSphere deployment directory in Figure 15-7. Click Finish . Note: Make sure you have both read and write permissions on the remote resource. 526 WebSphere Studio Application Developer Version 5 Programming Guide FTP file transfer If you select FTP file transfer mechanism in Figure 15-8 on page 524, instead of Copy file transfer mechanism, you would see the dialog in Figure 15-10 instead. Figure 15-10 Creating an FTP file transfer mechanism In the Project folder field, enter the name of the project folder in your workspace where the remote file transfer instance should be created. In our example we place it in the ItsoProGuideServer project folder. In the Remote file transfer name field, enter a name for the remote file transfer instance. We choose the name vertex-ftp. In the Remote target directory field, type the name of the directory on the remote machine where you want your Enterprise application and server configuration to be published. The remote target directory points to the WebSphere deployment directory that is seen from the Application Developer machine, being the FTP client. In our case the WebSphere deployment directory on the remote machine is c:\WebSphere\AppServer and when logging on to the FTP server we are placed in the /c:/ directory, so our remote target is /c:/WebSphere/AppServer. Chapter 15. Servers and server configurations 527 In the Host name field, enter the IP address or hostname of the remote machine. In the User login and User password fields, enter the FTP user ID and password that will be used to access the machine. If you need to use passive FTP mode or need to go through a firewall, select the appropriate check boxes. If you click the Firewall Settings button, you can specify the type of firewall used and the information required to connect through it. Click Finish . Server created without a configuration This creates a new server with the selected file transfer mechanism and it appears in the Server Configuration view, as shown in Figure 15-11. It does not yet have a server configuration assigned to it. We will do that next. Figure 15-11 New server created Creating a server configuration manually A server configuration contains the information required to set up and publish a server. We will first create a new server configuration and then assign this to the server we just created. Notes: To determine whether a beginning slash is required, log on to the FTP server using an FTP client program, and then type the pwd command. If the result containing the default log on directory begins with a slash, then a slash is required prior to typing the remote target directory, otherwise it is not. Make sure you have both read and write permissions on the remote resource. 528 WebSphere Studio Application Developer Version 5 Programming Guide From the Server perspective, Navigator view, select the ItsoProGuideServer project and select New -> Server configuration from its context menu. The New Server Configuration wizard is shown in Figure 15-12. Figure 15-12 Creating a server configuration Enter WebSphere v5.0 ITSO Configuration as the name of the configuration. Select Server Configuration as the configuration type. Click Next . The window in Figure 15-13 allows you to set the port number for the WebSphere Application Server 5.0 built-in HTTP server. You can use the same port number for multiple server configurations as long as they are not run simultaneously. Keep the default value of 9080 and click Finish . Note: Depending on what configuration type you select, the Next button, allowing you to specify the details of the server configuration, may or may not be enabled. In the case of a WebSphere version 5.0 configuration, it is enabled. Chapter 15. Servers and server configurations 529 Figure 15-13 Setting the HTTP server port The new server configuration is added to the Unused Server Configurations in the Server Configuration view (Figure 15-14). Figure 15-14 Server Configuration view Note: To test using the IBM HTTP Server (Apache server) in the remote machine, you must customize the server configuration so that the IBM HTTP Server plug-in configuration is updated in the remote machine. See “Customizing server configurations” on page 544 for information on how to do this. The HTTP port number in Figure 15-13 should still be 9080. Note: Clicking the (Menu) down-arrow in the Server Configuration view allows you to switch it to advanced display mode. In advanced mode, the servers and server configurations are displayed in separate trees, giving you a better overview. 530 WebSphere Studio Application Developer Version 5 Programming Guide Assigning a server configuration to a server To use a server configuration it must be assigned to a server. Select the WebSphere v5.0 on vertex (Copy) server and select Switch Configuration -> WebSphere v5.0 ITSO Configuration from its context menu as shown in Figure 15-15. Figure 15-15 Assigning a server configuration to a server Creating a server and server configuration together You can create both a server and a server configuration at once by performing these steps: In the Server perspective, Server Configuration view, select the server project ItsoProGuideServers and New -> Server and Server Configuration from its context menu. The dialog shown in Figure 15-16 is displayed. Enter a name for the server and in which folder to create it. Also select the type of server and then click Next . Chapter 15. Servers and server configurations 531 Figure 15-16 Creating server In the next dialog (see Figure 15-13 on page 529) enter a port number for the server. Keep the default of 9080 and click Finish . This creates a new server and a default server configuration for you and assigns the server configuration to the server. Assigning a project to a server configuration Once you have assigned a server configuration to a server, you also need to add your project(s) to the server configuration. A project can be assigned to multiple server configurations and a server configuration can be assigned to multiple servers. This means that your application can actually be associated with multiple servers at the same time. If you launch your application by using the Run on Server 532 WebSphere Studio Application Developer Version 5 Programming Guide option from its context menu, you must therefore decide on which of your servers you want to run your application. Application Developer can prompt you for a server to run on every time or you can specify a default server to run on without being prompted. From our first example (see “Creating server and server configuration automatically” on page 516) where we automatically created a server project, a server and a server configuration, we already have the ItsoProGuide Enterprise Application project assigned to the WebSphere v5.0 Test Environment server (which is a built-in test environment). We will now also add this project to the new server configuration we have created. From the Server perspective, Server Configuration view select the WebSphere v5.0 on vertex (Copy) server and select Add -> ItsoProGuide from its context menu as shown in Figure 15-17. Figure 15-17 Adding a project to a server The project is now associated also with the WebSphere v5.0 on vertex (Copy) server. Note: You can only assign enterprise applications to a server. This action assigns all contained modules (for example, Web and EJB) to the server. Chapter 15. Servers and server configurations 533 To be prompted for a server to run on select the ItsoProGuide Enterprise Application Project and then select Properties -> Server preferences from its context menu. This displays the window shown in Figure 15-18. Figure 15-18 Setting the server preference Select Prompt for server before running and click OK . Configuring the data source If your enterprise application accesses a database using JDBC or through EJBs, you have to configure the data sources. Open the configuration editor for the WebSphere v5.0 on vertex (Copy) server in the Server Configuration view. For our sample applications, we require a data source named jdbc/ejbbank. Follow the instructions in “Defining a data source in the server” on page 256 to define the data source for the new WebSphere v5.0 on vertex (Copy) server. Be sure to select Use this data source in container managed persistence for the EJB-based applications to work (see Figure 8-11 on page 257). When running on another server, we have to configure authorization for DB2. On the Security page, for JAAS Authentication Entries, click Add . Enter DB2user as the alias, and define a user ID and password that are authorized for DB2 on the remote server machine (Figure 15-19). . remote resource. 52 6 WebSphere Studio Application Developer Version 5 Programming Guide FTP file transfer If you select FTP file transfer mechanism in Figure 15- 8 on page 52 4, instead of Copy. 52 4 WebSphere Studio Application Developer Version 5 Programming Guide Click Next . On the page shown in Figure 15- 8, you can define a new remote file. permissions on the remote resource. 52 8 WebSphere Studio Application Developer Version 5 Programming Guide From the Server perspective, Navigator view, select the ItsoProGuideServer project and select