Modifying the J2EE Application

The Application Server and deploytool support iterative development. Whenever you make a change to a J2EE application, you must redeploy the application.

Modifying a Class File

To modify a class file in an enterprise bean, you change the source code, recompile it, and redeploy the application. For example, if you want to change the exchange rate in the dollarToYen business method of the ConverterBean class, you would follow these steps.

  1. Edit ConverterBean.java.
  2. Recompile ConverterBean.java.
    1. In a terminal window, go to the <INSTALL>/j2eetutorial14/examples/ejb/converter/ subdirectory.
    2. Type asant build.
  3. In deploytool, select ToolsRight ArrowUpdate Module Files.
  4. The Update Files dialog box appears. If the modified files are listed at the top of the dialog, click OK and go to step 6. If the files are listed at the bottom, they have not been found. Select one of those files and click Edit Search Paths.
  5. In the Edit Search Paths dialog box, specify the directories where the Update Files dialog will search for modified files.
    1. In the Search Root field, enter the fully qualified name of the directory from which the search will start.
    2. In the Path Directory list, add a row for each directory that you want searched. Unless fully qualified, these directory names are relative to the Search Root field.
    3. Click OK.
  6. Select ToolsRight ArrowDeploy. Make sure that the checkbox labeled Save Object Before Deploying is checked. If you do not want to deploy at this time, select ToolsRight ArrowSave to save the search paths specified in step 5.

To modify the contents of a WAR file, you follow the preceding steps. The Update Files operation checks to see whether any files have changed, including HTML files and JSP pages. If you change the index.jsp file of ConverterApp, be sure to type asant. This task copies the index.jsp file from the web directory to the build directory.

Adding a File

To add a file to the EJB JAR or WAR of the application, perform these steps.

  1. In deploytool, select the JAR or WAR in the tree.
  2. Select the General tab.
  3. Click Edit Contents.
  4. In the tree of the Available Files field, locate the file and click Add.
  5. Click OK.
  6. From the main toolbar, select ToolsRight ArrowUpdate Module Files.
  7. Select ToolsRight ArrowDeploy.

Modifying a Deployment Setting

To modify a deployment setting of ConverterApp, you edit the appropriate field in a tabbed pane and redeploy the application. For example, to change a JNDI name from ATypo to ConverterBean, you would follow these steps.

  1. In deploytool, select ConverterApp in the tree.
  2. Select the JNDI Names tab.
  3. In the JNDI Name field, enter MyConverter.
  4. From the main toolbar, select FileRight ArrowSave.
  5. Select ToolsRight ArrowUpdate Module Files.
  6. Select ToolsRight ArrowDeploy.