This appendix includes the following sections:
In order to run an ADF application, it must be first deployed on an application server such as GlassFish Server. Deployment in the context of web applications is the act of installing the application on a server that allows requests to be handled and so on.
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 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:
Run applications in Integrated WebLogic Server
You can run and debug applications using Integrated WebLogic Server and then deploy to standalone GlassFish Server.
Deploy directly to the standalone GlassFish Server
You can deploy applications directly to the standalone GlassFish Server by creating a connection to the server and choosing the name of that server as the deployment target.
Deploy to an archive file
You can deploy applications indirectly by choosing an EAR file as the deployment target. The archive file can subsequently be installed on the target GlassFish 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 ADF applications. You can run an application by choosing Run from the JDeveloper main menu.
You debug the application using the features described in Testing and Debugging ADF Components.
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 https://javaee.github.io/glassfish/download
.
Note:
For information about the GlassFish Server version supported by JDeveloper and ADF, see the Certification Information link for your JDeveloper release on OTN at http://www.oracle.com/technetwork/developer-tools/jdev/documentation/index.html
.
You must also prepare the GlassFish Server for ADF application deployment. For more information, see Configuring GlassFish Server in Administering Oracle ADF Applications.
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 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.
In order to test run an ADF application during development, you can use JDeveloper to run an application in Integrated WebLogic Server. You do not have to manually complete many of the steps that are necessary for deployment to a standalone 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 Create 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:
Detects the type of Java EE module to deploy based on the artifacts in the project and application
Creates a deployment profile in memory
Copies project and application files into a working directory with a file structure that would simulate the "exploded EAR" file of the application.
Performs the deployment tasks to register and deploy the simulated EAR into Integrated WebLogic Server
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 Servers window, right-click IntegratedWebLogicServer and choose Create Default Domain.
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 Running an ADF Application in Integrated WebLogic Server.
To run an application in Integrated WebLogic Server:
Once your application is developed, you must perform some essential tasks to deploy the ADF application to a standalone GlassFish Server. You also need to configure GlassFish-specific security within the ADF 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:
Note:
ADF Security is not supported on ADF Essentials for GlassFish. You should configure GlassFish-specific security within the ADF application. For information about configuring GlassFish security, see http://docs.oracle.com/cd/E18930_01/html/821-2418/beabg.html#scrolltoc
.
You can deploy applications to the GlassFish 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 Preparing the Application.
You will need to complete this task:
To create a connection to an application server:
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 ADF Fusion Web Application template, JDeveloper automatically creates default WAR and EAR deployment profiles. Typically, you would not need to edit or create deployment profiles manually.
For 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.
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 Preparing the Application.
You will need to complete this task:
To create WAR deployment profiles for an application:
The EAR file contains all the necessary application artifacts for the application to run in the application server. If you used the ADF Fusion Web Application template, you should already have a default EAR deployment profile. For more information about the EAR file, see 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 Preparing the Application.
You will need to complete this task:
To create an EAR deployment profile for an application:
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).
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 Preparing the Application.
To view, edit, or delete a project's deployment profile:
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.
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 Preparing the Application.
You will need to complete this task:
To create a deployment descriptor:
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 Applications window. 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.
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 Preparing the Application.
To view or change deployment descriptor properties:
You may need to configure your application.xml
file to be compliant with your 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 Preparing the Application.
To configure the application.xml file:
application.xml
file with the appropriate values.You may need to configure your web.xml
file to be compliant with your Java EE version).
The following example shows a web.xml
file with a setting for a JDBC connection. For more information and other settings that are required, see web.xml.
<resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/Connection1DS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
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 Preparing the Application.
To configure the web.xml file:
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.xcfg
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 Preparing the Application.
To configure the bc4j.xcfg file to enable JDBC data source:
If your application requires JNDI lookup, such as in EJB-based applications, you need to change the initial context factory class name to the GlassFish context factory.
To change the initial context factory:
initial-context-factory
entry to be initial-context-factory="com.sun.enterprise.naming.SerialInitContextFactory"
Once the target environment is set up and the ADF application is prepared for deployment, the final step is to deploy the application to the target environment.
You can use JDeveloper to deploy ADF applications directly to the GlassFish 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 GlassFish Server environment by performing tasks such as installing the ADF runtime libraries and setting configuration values. See Configuring GlassFish Server in Administering Oracle ADF Applications.
Table H-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 H-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 test further 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 target 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 |
Production |
When your application is in a test and production environment. In production environments, system administrators usually use GlassFish |
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 Preparing the Application.
You will need to complete this task:
To deploy to the target application server 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.
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 Preparing the Application.
You will need to complete this task:
To create an EAR archive file:
In the Applications window, 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.
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 Resources window 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 Reusing Application Components.
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.
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 Preparing the Application.
To deploy to the target application server using asadmin command:
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 Deploying Using Scripting Commands and Deploying Using Scripts and Ant in Administering Oracle ADF Applications.
In order to ensure the deployment of the ADF application has been successful, you should test-run the application.
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:
For non-Faces pages: http://<host>:port/<context root>/<page>
For Faces pages: http://<host>:port/<context root>/faces/<view_id
>
where <view_id>
is the view ID of the ADF task flow view activity.
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 Faces pages. 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.