J2EE Archives


ColdFusion is a certified J2EE application capable of being deployed as an EAR or WAR file on J2EE application servers. Deploying earlier versions of ColdFusion on J2EE application servers required multiple administration steps, including creating the ColdFusion application server instance, configuring data sources, deploying application code, and more. ColdFusion MX 7 introduces the capability to package the ColdFusion server and application code into a single J2EE archive for deployment from within the ColdFusion Administrator.

This J2EE archive feature is different from the J2EE configuration option of the ColdFusion MX 7 installer. The installer's J2EE configuration option will only create a base ColdFusion MX 7 application server as an EAR or WAR file. The J2EE archive feature, in contrast, allows you to package your ColdFusion application code (CFM, CFC, and CFR files) in an archive file with a configured ColdFusion MX 7 application server. In this way, it combines parts of the installer's J2EE configuration with the ColdFusion archive feature. However, unlike the ColdFusion archive feature, you can create J2EE archives in all ColdFusion MX 7 editions.

Defining J2EE Archives

Following are the steps to define a J2EE archive:

1.

Open the ColdFusion Administrator. Expand the Packaging and Deployment section (if necessary) in the left navigation frame, and click the J2EE Archives (.ear/.war) link.

2.

In the J2EE Archives (.ear/.war) window, enter the name for your archive in the Archive Name text field in the Add New Archive section (Figure 6.7). Archive names must be alphanumeric. You cannot use any nonalphanumeric characters such as punctuation, currency symbols, etc. When you're done, click Add.

Figure 6.7. The J2EE Archives (.ear/.war) window.


NOTE

Avoid using cfusion as an archive name. When choosing the EAR/WAR configuration during installation, the installer creates a cfusion.ear or cfusion.war file. If you name your J2EE archive cfusion, the J2EE archive feature will create the same filenames and this may cause confusion.

3.

In the Add/Edit J2EE Archive window that appears (Figure 6.8), specify settings for your archive. These include the application code directory, a destination directory for the compiled archive file, the archive type, a context root (if necessary), ColdFusion data sources to include, and so on. Table 6.2 describes the available options.

Figure 6.8. Use the J2EE Archives Add/Edit window to create or modify the archive definition.


Table 6.2. J2EE Archive (.ear/.war) Options

OPTION

DESCRIPTION

REQUIRED?

Archive Name

The name for the J2EE archive definition. This is also the name for the EAR or WAR file.

Yes

Application Directory

The location of the application code (CFM, CFC, CFR, etc.) to be included beneath the web root.

Yes

Distribution Directory

The directory where ColdFusion saves the compiled EAR or WAR files.

Yes

Archive Type

Indicate whether to create an Enterprise Application Archive (EAR) file or a Web Application Archive (WAR) file.

Yes

Context Root (EAR only)

For EAR archives, an optional context root for the ColdFusion web application. The default is an empty context root (or /)

No

Serial Number

A valid ColdFusion Enterprise Edition serial number. If this number is omitted or invalid when creating the archive, the 30-day Trial Edition is deployed.

No

Include COM Support

Indicate whether you want to include the J-Integra libraries for COM support. COM support adds approximately 12 MB to the archive size.

No

Disable Debugging

Indicate whether debugging is currently enabled in the ColdFusion Server and you want to disable it in the archived ColdFusion application.

No

Include CFML Source

Indicate whether you want to deploy Java bytecode instead of CFML source code. See the information on sourceless deployment in the "ColdFusion Compiler" section later in this chapter.

No

Include CF Admin

Indicate whether you want to include the ColdFusion Administrator (the CFIDE directory). Including ColdFusion Administrator adds approximately 2 MB to the archive size and increases security risks. See the section "Securing the CFIDE Directory" Chapter 10, "Security in Shared and Hosted Environments," for details on securing the ColdFusion Administrator.

No

Configure Data Sources to Be Included in Archive

The ColdFusion data sources to include in the J2EE archive. ODBC Socket data sources are not available.

No


4.

Click Submit. ColdFusion will compile an EAR or WAR file using the options you have selected and save it in the distribution directory. The J2EE Archives (.ear/.war) window reappears with the new archive definition listed under Configured Archives (Figure 6.9).

Figure 6.9. The created archive appears in the Configured Archives list.


TIP

The default distribution directory for the compiled J2EE archive is a cfroot/packages/{archive_name} for ColdFusion server configurations, and cfroot/WEB-INF/cfusion/packages/{archive_name} for ColdFusion J2EE configurations. Consider saving your archive files outside of the ColdFusion directory structure and web root, in another partition. Secure your archive files with standard operating system security.


Modifying the Definition

1.

Open the ColdFusion Administrator, expand Packaging and Deployment (if necessary), and open the J2EE Archives (.ear/.war) window.

2.

Under Configured Archives, click the Edit icon (the left one) in the Actions column, or click the name in the Archive Name column for the definition you want to edit.

3.

On the Add/Edit J2EE Archive screen, make changes to the options you want to modify.

4.

Click Submit. ColdFusion will recompile the archive, save it in the Distribution Directory, and return to the J2EE Archives (.ear/.war) window.

Deleting the Definition

1.

Open the ColdFusion Administrator, expand Packaging and Deployment (if necessary) , and open the J2EE Archives (.ear/.war) window.

2.

In the J2EE Archives (.ear/.war) window, click the Delete icon (the right one) in the Actions column, or click the name in the Archive Name column for the definition you want to delete.

3.

A message window appears asking you to confirm the delete operation. Click OK to confirm that you want to delete the archive. The J2EE Archives (.ear/.war) screen refreshes, and the archive is removed from the Configured Archives list. Or, click Cancel to cancel the operation. The archive name will remain in the Configured Archives list.

J2EE Archive Definition Considerations

Keep the following in mind as you create your J2EE archive definition:

  • Archive File Size. The typical archive file size is approximately 50 MB. Ensure that the partition containing the destination directory has enough space to accommodate this size requirement. The total archive file size is ultimately affected by the size of the application directory and the selected options; for example, including COM support, ColdFusion Administrator, or ColdFusion source.

  • Archive File Type. Not all J2EE application servers require the same archive file type. It's important to consider the archive file deployment requirements of your J2EE application server when defining and deploying the archive file. For example, IBM WebSphere will require that you deploy your ColdFusion application as an EAR, but servers such as BEA's WebLogic and the SunOne Application Server will let you deploy the same application as a WAR.

  • Application Code. All files (CFM, CFC, CFR, HTM, JPG, and so on) in the specified application directory will be included in the archive. If you do not specify the Include CFM Source Option, then all ColdFusion files (files with .cfm, .cfc, and .cfr extensions) will be compiled to Java bytecode.

    Although you can specify any local partition for the application directory, the files in this directory will be deployed beneath the ColdFusion application root directory (such as /cfusion.war/myTemplate.cfm). This could cause application errors after deployment if the code contains links to external directories or depends on Web server mappings.

  • CF Custom Tags. All templates in the global custom tags directory (cfroot\CustomTags) are automatically included in the archive file. This is a potential security risk and also adds to the archive file size. Consider removing tags from the global custom tags directory (including subdirectories) before defining the archive if you do not want them deployed on a new system.

  • Serial Number. J2EE deployment is a ColdFusion Enterprise feature. If a serial number is omitted or invalid in the archive definition, then the deployed ColdFusion Application will revert to a Trial Edition. You can upgrade to the Enterprise Edition after deployment by entering a valid Enterprise serial number, using the ColdFusion Administrator or the Administrator API. See Chapter 11, "Using the Administrator API," for details.

  • COM Support. COM support is only available for Windows systems. If there is a possibility that the archive will be deployed on a non-Windows system, do not include COM support.

  • ColdFusion Administrator. Even if you choose not to include the ColdFusion Administrator in your archive definition, parts of the CFIDE directory structure are still included to enable other functionality, such as CFFORM and the Administrator API. See Chapter 11 for details on the Administrator API.

Deploying the Archive

The created J2EE archive contains a ColdFusion Server Enterprise edition in J2EE configuration. Use your J2EE application server's deployment features to deploy your archive. For example, the ColdFusion MX 7 multiserver configuration allows you to create and manage multiple servers using the Enterprise Manager feature in the ColdFusion Administrator. You can combine the Instance Manager feature with the J2EE archive feature to deploy customized ColdFusion applications from within the ColdFusion Administrator. See the "Instance Manager" section in Chapter 4, "Scaling with J2EE," for details.

TIP

The ColdFusion Instance Manager automatically deploys a copy of the currently running ColdFusion application server (administrator settings, CF mappings, data sources, verity collections, and so on). If you want to deploy a customized ColdFusion application instance, use the J2EE archive feature to package a ColdFusion application as an EAR file. Create a new ColdFusion instance, and enter your EAR file in the Create From EAR/WAR option.


J2EE Archive Deployment Considerations

Keep the following in mind when deploying your J2EE archive:

  • Mappings. The ColdFusion mappings in the archived application point to directories on the computer used to create the archive. You must use the ColdFusion Administrator or Administrator API to modify the ColdFusion mappings on your newly deployed server if those directories do not exist on that server.

  • CFX Tags. ColdFusion CFX tag support may not be enabled on the deployed system. You need to ensure that the cfroot/WEB-INF/cfusion/lib directory is added to the JVM's native library path (java.library.path) to enable CFX support.

  • Verity. The Verity mappings of the original ColdFusion server that created the archive will also be in the EAR/WAR. You must ensure that Verity is enabled on the deployment computer and that the archived settings are suitable for it.

TIP

If Verity is not enabled on your system, run the platform-specific Verity search server installer. See "Installing the Verity Search Server Separately" section of the Installing and Using ColdFusion help manual at http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000014.htm#1202283.


Use the ColdFusion Administrator or the Administrator API to modify the Verity settings once Verity is deployed. See Chapter 11 for details on the Administrator API.



Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net