Skip Headers
Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework
11g Release 2 (11.1.2.3.0)

Part Number E16182-04
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

I Deploying ADF Applications to GlassFish

This appendix describes how to deploy Oracle ADF applications to a GlassFish application server. It describes how to create deployment profiles, how to create deployment descriptors, and how to deploy the application.

This chapter includes the following sections:

I.1 About Deploying ADF Applications to GlassFish Server

Deployment is the process of packaging application files as an archive file and transferring that file to a target GlassFish application server. You can use JDeveloper to deploy Oracle ADF applications directly to the GlassFish Server, or indirectly to an archive file as the deployment target, and then install this archive file to the target GlassFish Server. For application development, you can also use JDeveloper to run an application in Integrated WebLogic Server.

You can use JDeveloper to:

I.1.1 Developing Applications with Integrated WebLogic Server

If you are developing an application in JDeveloper and you want to run the application in Integrated WebLogic Server, you do not need to perform the tasks required for deploying directly to Oracle WebLogic Server or to an archive file. JDeveloper has a default connection to Integrated WebLogic Server and does not require any deployment profiles or descriptors. Integrated WebLogic Server has a preconfigured domain that includes the ADF libraries, as well as the -Djps.app.credential.overwrite.allowed=true setting, that are required to run Oracle ADF applications. You can run an application by choosing Run from the JDeveloper main menu.

You debug the application using the features described in Chapter 36, "Testing and Debugging ADF Components."

I.1.2 Developing Applications to Deploy to Standalone GlassFish Server

Typically, for deployment to standalone application servers, you test and develop your application by running it in Integrated WebLogic Server. You can then test the application further by deploying it to standalone GlassFish Server.

In general, you use JDeveloper to prepare the application or project for deployment by:

  • Creating a connection to the target GlassFish Server

  • Creating deployment profiles (if necessary)

  • Creating deployment descriptors that are specific to GlassFish

  • Updating application.xml and web.xml to be compatible with the GlassFish Server (if required)

You must already have an installed GlassFish Server. For instructions on obtaining and installing GlassFish, see http://glassfish.java.net/downloads/3.1.2-final.html

You must also prepare the GlassFish Server for ADF application deployment. For more information, see the "Configuring GlassFish Server" appendix in the Oracle Fusion Middleware Administrator's Guide for Oracle Application Development Framework.

  • Installing the ADF runtime into the GlassFish Server installation:

  • Setting JVM cache size and simple option

  • Enabling Secure Admin on the GlassFish Server to allow for remote logins and remote connections in order for JDeveloper to run on a different machine than GlassFish.

  • Creating a global JDBC data source for applications that require a connection to a data source

After the application and the GlassFish Server have been prepared, you can:

  • Use JDeveloper to:

    • Directly deploy to the GlassFish Server using the deployment profile and the application server connection.

    • Deploy to an EAR file using the deployment profile. For Oracle ADF applications, WAR files can be deployed only as part of an EAR file.

  • Use the GlassFish Server's administration tools to deploy the EAR file created in JDeveloper. For more information, see the Oracle Fusion Middleware Administrator's Guide for Oracle Application Development Framework.

I.2 Running an ADF Application in Integrated WebLogic Server

JDeveloper is installed with Integrated WebLogic Server which you can use to test and develop your application. For most development purposes, Integrated WebLogic Server will suffice. When your application is ready to be tested, you can select the run target and then choose the Run command from the main menu.

Note:

The first time you run an application in Integrated WebLogic Server, the Configure Default Domain dialog appears for you to define an administrative password for the new domain.

When you run the application target, JDeveloper detects the type of Java EE module to deploy based on artifacts in the projects and workspace. JDeveloper then creates an in-memory deployment profile for deploying the application to Integrated WebLogic Server. JDeveloper copies project and application workspace files to an "exploded EAR" directory structure. This file structure closely resembles the EAR file structure that you would have if you were to deploy the application to an EAR file. JDeveloper then follows the standard deployment procedures to register and deploy the "exploded EAR" files into Integrated WebLogic Server. The "exploded EAR" strategy reduces the performance overhead of packaging and unpackaging an actual EAR file.

In summary, when you select the run target and run the application in Integrated WebLogic Server, JDeveloper:

Note:

JDeveloper ignores the deployment profiles that were created for the application when you run the application in Integrated WebLogic Server.

The application will run in the base domain in Integrated WebLogic Server. This base domain has the same configuration as a base domain in a standalone WebLogic Server instance. In other words, this base domain will be the same as if you had used the Oracle Fusion Middleware Configuration Wizard to create a base domain with the default options in a standalone WebLogic Server instance.

JDeveloper will extend this base domain with the necessary domain extension templates, based on the JDeveloper technology extensions. For example, if you have installed JDeveloper Studio, JDeveloper will automatically configure the Integrated WebLogic Server environment with the ADF runtime template (JRF Fusion Middleware runtime domain extension template).

You can explicitly create a default domain for Integrated WebLogic Server. You can use the default domains to run and test your applications. Open the Application Server Navigator, right-click IntegratedWebLogicServer and choose Create Default Domain.

I.2.1 How to Run an Application in Integrated WebLogic Server

You can test an application by running it in Integrated WebLogic Server. You can also set breakpoints and then run the application within the ADF Declarative Debugger.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you run an application in Integrated WebLogic Server. For more information, see Section I.2, "Running an ADF Application in Integrated WebLogic Server."

To run an application in Integrated WebLogic Server:

  1. In the Application Navigator, select the project, unbounded task flow, JSF page, or file as the run target.

  2. Right-click the run target and choose Run or Debug.

    The Configure Default Domain dialog displays the first time you run your application and start a new domain in Integrated WebLogic Server. Use the dialog to define an administrator password for the new domain. Passwords you enter can be eight characters or more and must have a numeric character.

I.3 Preparing the Application

Before you deploy an ADF application to a standalone GlassFish Server, you must perform prerequisite tasks within JDeveloper to prepare the application for deployment.

The tasks are:

I.3.1 How to Create a Connection to the Target Application Server

You can deploy applications to the application server via JDeveloper application server connections.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you create an application server connection. For more information, see Section I.3, "Preparing the Application."

You will need to complete this task:

Install the GlassFish Server.

To create a connection to an application server:

  1. Launch the Application Server Connection wizard.

    You can:

    • In the Application Server Navigator, right-click Application Servers and choose New Application Server Connection.

    • In the New Gallery, expand General, select Connections and then Application Server Connection, and click OK.

    • In the Resource Palette, choose New > New Connections > Application Server.

  2. In the Create AppServer Connection dialog, on the Usage page, select Standalone Server.

  3. On the Name and Type page, enter a connection name.

  4. In the Connection Type dropdown list, choose:

    • GlassFish 3.1 to create a connection to the GlassFish Server

  5. Click Next.

  6. On the Authentication page, enter a user name and password for the administrative user authorized to access the GlassFish Server.

  7. Click Next.

  8. On the Configuration page, enter the information for the GlassFish Server:

    • Host Name: Enter the name of the machine where the GlassFish Server is running. If no name is entered, the name defaults to localhost.

    • RMI Port: If necessary, change to the RMI port number for the server. The default is 8686.

    • HTTP Port: By default, GlassFish listens to port 8080 for HTTP requests. If necessary, you can change the port number here. .

    • Admin HTTP Port: By default, GlassFish uses port 4848 for administration. If necessary, you can change the port number here.

  9. Click Next.

  10. On the Test page, click Test Connection to test the connection.

    JDeveloper performs several types of connections tests. The JSR-88 test must pass for the application to be deployable. If the test fails, return to the previous pages of the wizard to fix the configuration.

    Note:

    If you are using GlassFish 3.1.2 and you are running JDeveloper on a different machine than GlassFish, you need to enable Secure Admin in GlassFish to allow remote logins using the asadmin enable-secure-admin command. You do not need to enable Secure Admin if both JDeveloper and GlassFish are on the same machine.

  11. Click Finish.

I.3.2 How to Create Deployment Profiles

A deployment profile defines the way the application is packaged into the archive that will be deployed to the target environment. The deployment profile:

  • Specifies the format and contents of the archive file that will be created

  • Lists the source files, deployment descriptors, and other auxiliary files that will be packaged

  • Describes the type and name of the archive file to be created

  • Highlights dependency information, platform-specific instructions, and other information

You need a WAR deployment profile for each web user interface project that you want to deploy in your application. You need an application-level EAR deployment profile and you must select the projects (such as WAR profiles) to include from a list. When the application is deployed, the EAR file will include all the projects that were selected in the deployment profile.

Note:

If you create your project or application using the Fusion Web Application (ADF) template, JDeveloper automatically creates default WAR and EAR deployment profiles. Typically, you would not need to edit or create deployment profiles manually.

For Oracle ADF applications, you can deploy the application only as an EAR file. The WAR files that are part of the application should be included in the EAR file when you create the deployment profile.

I.3.2.1 Creating a WAR Deployment Profile

You will need to create a WAR deployment profile for each web-based project you want to package into the application. Typically, the WAR profile will include the dependent data model projects it requires.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you create a WAR deployment profile. For more information, see Section I.3, "Preparing the Application."

You will need to complete this task:

Create web-based projects. If you used the Fusion Web Application (ADF) template, you should already have a default WAR deployment profile.

To create WAR deployment profiles for an application:

  1. In the Application Navigator, right-click the web project that you want to deploy and choose New.

    You will create a WAR profile for each web project.

  2. In the New Gallery, expand General, select Deployment Profiles and then WAR File, and click OK.

    If you don't see Deployment Profiles in the Categories tree, click the All Features tab.

  3. In the Create Deployment Profile -- WAR File dialog, enter a name for the project deployment profile and click OK.

  4. In the Edit WAR Deployment Profile Properties dialog, choose items in the left pane to open dialog pages in the right pane. Configure the profile by setting property values in the pages of the dialog. Note that some items list below may not be in your particular application.

    • Ensure that ADF Faces Runtime 11, JSTL 1.2, and the ADFm, ADFc, and ADFv libraries are marked deployed in the WEB-INF/lib/contributors panel.

    • Select File Groups > Web Files > Filters > WEB-INF and deselect weblogic.xml.

    • Select File Groups > Web Files/Classes > Filters > META-INF and deselect ejb-jar.xml.

    • Select File Groups > Web Files/Classes > Filters > path and deselect serviceinterface.

    • Select File Groups > Web Files/Classes > Filters > path and deselect server.

    • You might also want to change the Java EE web context root setting. To do so, choose General in the left pane.

      By default, when Use Project's Java EE Web Context Root is selected, the associated value is set to the project name, for example, Application1-Project1-context-root. You need to change this if you want users to use a different name to access the application.

    • Select Glassfish 3.1 as the Platform

  5. Click OK to exit the Deployment Profile Properties dialog.

  6. Click OK again to exit the Project Properties dialog.

  7. Repeat Steps 1 through 6 for all web projects that you want to deploy.

I.3.2.2 Creating an Application-Level EAR Deployment Profile

The EAR file contains all the necessary application artifacts for the application to run in the application server. If you used the Fusion Web Application (ADF) template, you should already have a default EAR deployment profile. For more information about the EAR file, see Section I.4.5, "What You May Need to Know About EAR Files and Packaging."

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you create an application-level EAR deployment profile. For more information, see Section I.3, "Preparing the Application."

You will need to complete this task:

Create the WAR deployment profiles, as described in Section I.3.2.1, "Creating a WAR Deployment Profile."

To create an EAR deployment profile for an application:

  1. In the Application Navigator, right-click the application and choose New.

    You will create an EAR profile for the application.

  2. In the New Gallery, expand General, select Deployment Profiles and then EAR File, and click OK.

    If you don't see Deployment Profiles in the Categories tree, click the All Features tab.

  3. In the Create Deployment Profile -- EAR File dialog, enter a name for the application deployment profile and click OK.

  4. In the Edit EAR Deployment Profile Properties dialog, choose items in the left pane to open dialog pages in the right pane. Configure the profile by setting property values in the pages of the dialog.

    • Select File Groups > Application Descriptors > Filters and deselect weblogic-application.xml.

    • Select Application Assembly and then in the Java EE Modules list, select all the project profiles that you want to include in the deployment, including any WAR profiles.

    • Select Platform, select the application server you are deploying to, and then select the target application connection from the Target Connection dropdown list. For GlassFish, select GlassFish 3.1.

  5. Click OK again to exit the Edit EAR Deployment Profile Properties dialog.

  6. Click OK again to exit the Application Properties dialog.

Note:

To verify that your customization classes are put correctly in the EAR class path, you can deploy the EAR profile to file system. Then you can examine the EAR to make sure that the customization class JAR is available in the EAR class path (the EAR/lib directory) and not available in the WAR class path (the WEB-INF/lib and WEB-INF/classes directories).

I.3.2.3 Viewing and Changing Deployment Profile Properties

After you have created a deployment profile, you can view and change its properties.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you view and change deployment profile properties. For more information, see Section I.3, "Preparing the Application."

To view, edit, or delete a project's deployment profile:

  1. In the Application Navigator, right-click the project and choose Project Properties.

  2. In the Project Properties dialog, click Deployment.

    The Deployment Profiles list displays all profiles currently defined for the project.

  3. In the list, select a deployment profile.

  4. To edit or delete a deployment profile, click Edit or Delete.

I.3.3 How to Create and Edit Deployment Descriptors

Deployment descriptors are server configuration files that define the configuration of an application for deployment and that are deployed with the Java EE application as needed. The deployment descriptors that a project requires depend on the technologies the project uses and on the type of the target application server. Deployment descriptors are XML files that can be created and edited as source files, but for most descriptor types, JDeveloper provides dialogs or an overview editor that you can use to view and set properties. If you cannot edit these files declaratively, JDeveloper opens the XML file in the source editor for you to edit its contents.

In addition to the standard Java EE deployment descriptors (for example, application.xml and web.xml), you can also have deployment descriptors that are specific to your target application server.

I.3.3.1 Creating Deployment Descriptors

JDeveloper automatically creates many of the required deployment descriptors for you. If they are not present, or if you need to create additional descriptors, you can use JDeveloper to create them.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you create deployment descriptors. For more information, see Section I.3, "Preparing the Application."

You will need to complete this task:

Check to see whether JDeveloper has already generated deployment descriptors.

To create a deployment descriptor:

  1. In the Application Navigator, expand the ViewController project, select WEB-INF and click New.

  2. In the New Gallery, expand General, select XML Documents and click OK.

    For instance, you may want to create a glassfish-web.xml to define GlassFish-specific information.

  3. In the Create XML File dialog, enter a name for your descriptor and click OK.

  4. In the overview editor, add entries for GlassFish.

    Example I-1 show a sample glassfish-web.xml descriptor.

    Example I-1 Sample glassfish-web.xml

    <glassfish-web-app> 
        <context-root>DeptApp-ViewController-context-root</context-root>
        <resource-ref> 
            <res-ref-name>jdbc/Connection1DS</res-ref-name> 
            <jndi-name>jdbc/Connection1DS</jndi-name> 
        </resource-ref> 
        <class-loader delegate="false"/> 
        <property value="true" name="useBundledJsf"/> 
    </glassfish-web-app>
    

Note:

For EAR files, do not create more than one deployment descriptor file of the same type per application or workspace. These files can be assigned to projects, but have application workspace scope. If multiple projects in an application have the same deployment descriptor, the one belonging to the launched project will supersede the others. This restriction applies to application.xml.

The best place to create an application-level descriptor is in the Descriptors node of the Application Resources panel in the Application Navigator. This ensures that the application is created with the correct descriptors.

Application-level descriptors created in the project will be ignored at runtime. Only the application resources descriptors or descriptors generated at the EAR level will be used by the runtime.

I.3.3.2 Viewing or Modifying Deployment Descriptor Properties

After you have created a deployment descriptor, you can change its properties by using JDeveloper dialogs or by editing the file in the source editor. The deployment descriptor is an XML file (for example, application.xml) typically located under the Application Sources node.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you view or modify deployment descriptors. For more information, see Section I.3, "Preparing the Application."

To view or change deployment descriptor properties:

  1. In the Application Navigator or in the Application Resources panel, double-click the deployment descriptor.

  2. In the overview editor, select either the Overview tab or the Source tab, and configure the descriptor by setting property values.

    If the overview editor is not available, JDeveloper opens the file in the source editor.

I.3.3.3 Configuring the application.xml File for Application Server Compatibility

You may need to configure your application.xml file to be compliant with Java EE 1.5.

Note:

Typically, your project has an application.xml file that is compatible and you would not need to perform this procedure.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you configure the application.xml file. For more information, see Section I.3, "Preparing the Application."

To configure the application.xml file:

  1. In the Application Navigator, right-click the application and choose New.

  2. In the New Gallery, expand General, select Deployment Descriptors and then Java EE Deployment Descriptor Wizard, and click OK.

  3. In the Create Java EE Deployment Descriptor dialog, on the Select Descriptor page, select application.xml and click Next.

  4. On the Select Version page, select 5.0 and click Next.

  5. On the Summary page, click Finish.

  6. Edit the application.xml file with the appropriate values.

I.3.3.4 Configuring the web.xml File for GlassFish Server Compatibility

You may need to configure your web.xml file to be compliant with Java EE 1.5 (which corresponds to servlet 2.5 and JSP 1.2). For more information, see Section A.13, "web.xml."

Note:

Typically, your project has a web.xml file that is compatible and you would not need to perform this procedure. JDeveloper creates a starter web.xml file when you create a project.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you configure the web.xml file. For more information, see Section I.3, "Preparing the Application."

To configure the web.xml file:

  1. In the Application Navigator, right-click the project and choose New.

  2. In the New Gallery, expand General, select Deployment Descriptors and then Java EE Deployment Descriptor, and click OK.

  3. In the Create Java EE Deployment Descriptor dialog, on the Select Descriptor page, select web.xml and click Next.

  4. On the Select Version page, select 2.5 and click Next.

  5. On the Summary page, click Finish.

  6. Open the web.xml file in the overview editor.

  7. Select the Filters tab and remove JpsFilter.

I.3.4 How to Enable JDBC Data Source for GlassFish

If you are using ADF Business Components in your application, you may need to check that the data source defined for the ADF Business Components as part of the application matches the data source defined in the GlassFish container.

You can configure the ADF application to use a JDBC Data Source in the application by editing the application's bc4j.xfcg file.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you configure JDBC. For more information, see Section I.3, "Preparing the Application."

To configure the bc4jxfcg file to enable JDBC data source:

  1. In the Application Navigator, expand the model project and click the application module.

  2. In the overview editor for the application module, choose Configurations and click bc4j.xcfg.

  3. In the overview editor for bc4j.xcfg, select the Source tab.

  4. Check that the Custom JDBCDataSource entry defined in the file matches the JDBC data source defined for the GlassFish Server as described in the "Configuring GlassFish Server" appendix in the Oracle Fusion Middleware Administrator's Guide for Oracle Application Development Framework.

    For instance, the following example shows the JDBCDataSource property defined in the bc4j.xcfg file:

    <BC4JConfig version="11.1" xmlns="http://xmlns.oracle.com/bc4j/configuration">
       <AppModuleConfigBag ApplicationName="model.AppModule">
          <AppModuleConfig name="AppModuleLocal" jbo.project="model.Model"
             ApplicationName="model.AppModule" DeployPlatform="LOCAL">
             <Database jbo.TypeMapEntries="SampleApps"/>
             <Security AppModuleJndiName="model.AppModule"/>
             <Custom ns0:JDBCDataSource="jdbc/OracleDS"
               xmlns:ns0="http://xmlns.oracle.com/bc4j/configuration"/>
          </AppModuleConfig>
          <AppModuleConfig name="AppModuleShared" jbo.project="model.Model"
             ApplicationName="model.AppModule" DeployPlatform="LOCAL">
             <AM-Pooling jbo.ampool.maxpoolsize="1"
              jbo.ampool.isuseexclusive="false"/>
             <Database jbo.TypeMapEntries="SampleApps"/>
             <Security AppModuleJndiName="model.AppModule"/>
             <Custom ns0:JDBCDataSource="jdbc/OracleDS"
               xmlns:ns0="http://xmlns.oracle.com/bc4j/configuration"/>
          </AppModuleConfig>
       </AppModuleConfigBag>
    </BC4JConfig>
    

I.4 Deploying the Application

You can use JDeveloper to deploy ADF applications directly to the standalone application server or you can create an archive file and use other tools to deploy to the application server.

Note:

Before you begin to deploy applications that use Oracle ADF to the standalone application server, you need to prepare the application server environment by performing tasks such as installing the ADF runtime and setting configuration values. For more information, see the "Configuring GlassFish Server" appendix in the Oracle Fusion Middleware Administrator's Guide for Oracle Application Development Framework.

Table I-1 describes some common deployment techniques that you can use during the application development and deployment cycle. The deployment techniques are listed in order from deploying on development environments to deploying on production environments. It is likely that in the production environment, the system administrators deploy applications by using the GlassFish administration console or scripts.

Table I-1 Deployment Techniques for Development or Production Environments

Deployment Technique Environment When to Use

Run directly from JDeveloper

Test or Development

When you are developing your application. You want deployment to be quick because you will be repeating the editing and deploying process many times.

JDeveloper contains Integrated WebLogic Server, on which you can run and test your application.

Note that you are testing your application in an integrated WebLogic Server and not in an integrated GlassFish Server. After testing on the Integrated WebLogic Server, you can perform further tests by deploying to the standalone GlassFish Server.

Use JDeveloper to directly deploy to the target GlassFish Server

Test or Development

When you are ready to deploy and test your application on an application server in a test environment.

You can also use the test environment to develop your deployment scripts, for example, using Ant.

Use JDeveloper to deploy to an EAR file, then use the GlassFish Server's tools for deployment

Test or Development

When you are ready to deploy and test your application on an application server in a test environment. As an alternative to deploying directly from JDeveloper, you can deploy to an EAR file and then use other tools to deploy to the application server.

You can also use the test environment to develop your deployment scripts, for example, using Ant.

Use GlassFish asadmin commands or GlassFish Administration Consoles

Production

When your application is in a test and production environment. In production environments, system administrators usually use GlassFish asadmin commands or the GlassFish Administration Console.


I.4.1 How to Deploy to the Application Server from JDeveloper

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you deploy to the application server from JDeveloper. For more information, see Section I.3, "Preparing the Application."

You will need to complete this task:

Create an application-level deployment profile that deploys to an EAR file.

To deploy to the target application server from JDeveloper:

  1. In the Application Navigator, right-click the application and choose Deploy > deployment profile.

    Make sure you choose a GlassFish deployment profile.

  2. In the Deploy wizard, on the Deployment Action page, select Deploy to Application Server and click Next.

  3. On the Select Server page, select the application server connection, and click Next.

  4. Click Finish.

    During deployment, you can see the process steps displayed in the deployment Log window. You can inspect the contents of the modules (archives or exploded EAR) being created by clicking on the links that are provided in the log window. The archive or exploded EAR file will open in the appropriate editor or directory window for inspection.

    Note:

    If you are deploying a Java EE application, click the application menu next to the Java EE application in the Application Navigator.

    For more information on creating application server connections, see Section I.3.1, "How to Create a Connection to the Target Application Server."

I.4.2 What You May Need to Know About Deploying from JDeveloper

When you deploy an application using the EAR deployment profile created for GlassFish, JDeveloper:

  • Inserts the required ADF Model, ADF Controller, and ADF View library JARs into the EAR file.

  • Inserts adf-share-glassfish.jar into the WAR.

  • Inserts an entry for the GlassFish application lifecycle listener ADFGlassFishAppLifeCycleListener into the web.xml file.

  • Removes the other listener entries, ADFConnectionLifeCycleCallBack, ADFConfigLifeCycleCallBack, and BC4JConfigLifeCycleCallBack, from the web.xml files.

I.4.3 How to Create an EAR File for Deployment

You can also use the deployment profile to create an archive file (EAR file). You can then deploy the archive file using GlassFish Administration Console.

Although an ADF application is encapsulated in an EAR file (which usually includes WAR components), it may have parts that are not deployed with the EAR.

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you create an EAR file for deployment. For more information, see Section I.3, "Preparing the Application."

You will need to complete this task:

Create an application-level deployment profile that deploys to an EAR file.

To create an EAR archive file:

  • In the Application Navigator, right-click the application containing the deployment profile, and choose Deploy > deployment profile > to EAR file.

    If an EAR file is deployed at the application level, and it has dependencies on a JAR file in the data model project and dependencies on a WAR file in the user interface project, then the files will be located in the following directories by default:

    • ApplicationDirectory/deploy/EARdeploymentprofile.EAR

    • ApplicationDirectory/ModelProject/deploy/JARdeploymentprofile.JAR

    • ApplicationDirectory/ViewControllerProject/deploy/WARdeploymentprofile.WAR

Tip:

Choose View >Log to see messages generated during creation of the archive file.

I.4.4 What You May Need to Know About ADF Libraries

An ADF Library is a JAR file that contains JAR services registered for ADF components such as ADF task flows, pages, or application modules. If you want the ADF components in a project to be reusable, you create an ADF Library deployment profile for the project and then create an ADF Library JAR based on that profile.

An application or project can consume the ADF Library JAR when you add it using the Resource Palette or manually by adding it to the library classpath. When the ADF Library JAR is added to a project, it will be included in the project's WAR file if the Deployed by Default option is selected.

For more information, see Chapter 38, "Reusing Application Components."

I.4.5 What You May Need to Know About EAR Files and Packaging

When you package an ADF application into an EAR file, it can contain the following:

  • WAR files: Each web-based view controller project should be packaged into a WAR file.

  • ADF Library JAR files: If the application consumes ADF Library JARs, these JAR files may be packaged within the EAR.

  • Other JAR files: The application may have other dependent JAR files that are required. They can be packaged within the EAR.

I.4.6 How to Deploy to the Application Server using asadmin Commands

Before you begin:

It may be helpful to have an understanding of the options that are available to you when you deploy to the application server from JDeveloper. For more information, see Section I.3, "Preparing the Application."

To deploy to the target application server using asadmin command:

  1. Start an asadmin shell for GlassFish Server.

  2. Invoke the deploy command.

    For instance, the following command deploys application1.ear to the GlassFish Server.

    deploy \--target=server \--force /path/application1.ear
    

I.4.7 How to Deploy the Application Using Scripts and Ant

You can deploy the application using commands and automate the process by putting those commands in scripts. The ojdeploy command can be used to deploy an application without JDeveloper. You can also use Ant scripts to deploy the application. JDeveloper has a feature to help you build Ant scripts. Depending on your requirements, you may be able to integrate regular scripts with Ant scripts.

For more information about commands, scripts, and Ant, see the Oracle Fusion Middleware Administrator's Guide for Oracle Application Development Framework.

I.5 Testing the Application and Verifying Deployment

After you deploy the application, you can test it from the application server. To test-run your ADF application, open a browser window and enter a URL:

Tip:

The context root for an application is specified in the user interface project settings by default as ApplicationName/ProjectName/context-root. You can shorten this name by specifying a name that is unique across the target application server. Right-click the user interface project, and choose Project Properties. In the Project Properties dialog, select Java EE Application and enter a unique name for the context root.

Note:

/faces has to be in the URL for pages with ADF Faces components. This is because JDeveloper configures your web.xml file to use the URL pattern of /faces in order to be associated with the Faces Servlet. The Faces Servlet does its per-request processing, strips out /faces part in the URL, then forwards the URL to the JSP. If you do not include the /faces in the URL, then the Faces Servlet is not engaged (since the URL pattern doesn't match). Your JSP is run without the necessary JSF per-request processing.