36
Deploying a J2EE Application from JDeveloper 10g Purpose This tutorial shows you how to use JDeveloper to archive and deploy J2EE applications (either ADF or non-ADF applications) to Oracle Application Server 10g. Deployment is the process of packaging the files that make up an application as an archive file, and transferring the archive to the server where the application will run. This tutorial shows you how to use JDeveloper to deploy applications to the OracleAS through application server connections. The basic steps are: 1. Create the application as a JDeveloper project. 2. Package the project components into a deployment profile and specify deployment resources. 3. Create an application server connection to the Oracle Application Server. 4. Deploy the packaged application to the Oracle Application Server. Topics The tutorial discusses the following: Overview Prerequisites Compile and Run the Application from JDeveloper Create a Connection to the Application Server Deploy a J2EE Application Deploy an ADF-based J2EE Application Summary Time to complete This tutorial should take about an hour to complete. Viewing Screenshots Move your mouse over this icon to show all screenshots. You can also move your mouse over each individual icon to see only the screenshot associated with it. Overview This tutorial shows you how to use JDeveloper to package and deploy the model and view components of both J2EE and ADF applications. The J2EE application is composed of an EJB as the model component and a JSP as the view component. The model is deployed to an EJB JAR file with the JSP deployed to a WAR file. Once each component has been deployed to the appropriate archive, both are included in an EAR file, then deployed to the Oracle Application Server 10g. The ADF application view component is archived to a WAR file and then deployed to the Oracle Application Server 10g. In both the J2EE and ADF deployments, the application can then be accessed using a browser. Back to Topic List Scenario Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo... 1 of 36 1/30/2011 13:27

Deploying a J2EE Application from JDeveloper 10g

Embed Size (px)

Citation preview

Page 1: Deploying a J2EE Application from JDeveloper 10g

Deploying a J2EE Application from JDeveloper 10g

Purpose

This tutorial shows you how to use JDeveloper to archive and deploy J2EE applications (either ADF or non-ADF applications) toOracle Application Server 10g.

Deployment is the process of packaging the files that make up an application as an archive file, and transferring the archive to theserver where the application will run. This tutorial shows you how to use JDeveloper to deploy applications to the OracleAS through

application server connections. The basic steps are:

1. Create the application as a JDeveloper project.

2. Package the project components into a deployment profile and specify deployment resources.3. Create an application server connection to the Oracle Application Server.

4. Deploy the packaged application to the Oracle Application Server.

Topics

The tutorial discusses the following:

Overview

Prerequisites

Compile and Run the Application from JDeveloper

Create a Connection to the Application Server

Deploy a J2EE Application

Deploy an ADF-based J2EE Application

Summary

Time to complete

This tutorial should take about an hour to complete.

Viewing Screenshots

Move your mouse over this icon to show all screenshots. You can also move your mouse over each individual icon to see onlythe screenshot associated with it.

Overview

This tutorial shows you how to use JDeveloper to package and deploy the model and view components of both J2EE and ADF

applications.

The J2EE application is composed of an EJB as the model component and a JSP as the view component. The model

is deployed to an EJB JAR file with the JSP deployed to a WAR file. Once each component has been deployed to theappropriate archive, both are included in an EAR file, then deployed to the Oracle Application Server 10g.

The ADF application view component is archived to a WAR file and then deployed to the Oracle Application Server10g. In both the J2EE and ADF deployments, the application can then be accessed using a browser.

Back to Topic List

Scenario

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

1 of 36 1/30/2011 13:27

Page 2: Deploying a J2EE Application from JDeveloper 10g

To complete this OBE, you must download and install two JDeveloper workspaces. Each contains a sample application for you todeploy. These applications access the Sample Schema Human Resources database objects. It is very important to create and name

the JDeveloper Database Connections according to the specifications found in the second step of the prerequisites.

Prerequisites

Back to Topic List

In order for this lesson to work successfully, you need to have performed the following:

1. Install Oracle JDeveloper 10g.

2. Install the Oracle Application Server 10g. You will need the administrator Username and Password to start and

stop it.

3. Install the sample schema and create a connection to the HR or HR8 schema to use in this tutorial. See Installingthe Sample Schemas and Establishing a Database Connection tutorial. Ensure the name of the connection is

tutorial_jdbc_connection.

4.Download the deploySamples.zip file to your machine. It contains the sample JDeveloper workspaces for use inthis OBE.

Compile and Run the Applications from JDeveloper

Back to Topic List

In this step, you will load two application workspaces in JDeveloper and test the applications using the embedded OC4J server. One

workspace contains a J2EE application with a JSP as the view and an EJB defining the business rules. The second workspacecontains an ADF application.

1. Download and unzip the deploySamples.zip file onto your machine in the <JDEVELOPER_HOME>\jdev

\mywork\ directory. You should have two directories: deployment_j2ee and deployment_adf . The

deployment_j2ee directory contains a J2EE application and the deployment_adf contains an ADF application.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

2 of 36 1/30/2011 13:27

Page 3: Deploying a J2EE Application from JDeveloper 10g

2 . Invoke JDeveloper and independently open each of the two workspaces. Select Open from the File menu, and

navigate to the <JDEVELOPER_HOME>\jdev\mywork\deployment_j2ee directory. Select the

J2EEApplication.jws file and click OK to load the J2EE workspace. Repeat the Open operation and select

the ADFApplication.jws file in the <JDEVELOPER_HOME>\jdev\mywork\deployment_adf directory.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

3 of 36 1/30/2011 13:27

Page 4: Deploying a J2EE Application from JDeveloper 10g

3. Compile the J2EE application by selecting the J2EEApplication workspace in the Application Navigator and

selecting the Make option from the context menu.

4. Run the J2EE application. Expand the View and Application Sources nodes. Right click login.java and

select Run.

5. When the application is invoked, login using 100 as the Employee Id and King as the Employee Name.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

4 of 36 1/30/2011 13:27

Page 5: Deploying a J2EE Application from JDeveloper 10g

6. Three employees belonging to the same department as King are displayed.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

5 of 36 1/30/2011 13:27

Page 6: Deploying a J2EE Application from JDeveloper 10g

7. Compile the ADF application by selecting the ADFApplication workspace in the Application Navigator and

selecting the Make option from the context menu.

8. Run the ADF application. Expand the ViewController and Web Content nodes and select Login.jsp. From

the context menu, select Run.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

6 of 36 1/30/2011 13:27

Page 7: Deploying a J2EE Application from JDeveloper 10g

9. When the application is invoked, login using 100 as the Employee Id and King as the Employee Name.

10. Three employees belonging to the Executive department are displayed.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

7 of 36 1/30/2011 13:27

Page 8: Deploying a J2EE Application from JDeveloper 10g

Create a Connection to the Application Server

Back to Topic List

JDeveloper supports deploying your applications to a variety of production application servers, via application sever connections.

You must create a connection to deploy applications directly to Oracle Application Server 10g from JDeveloper.

1. Click the Connections tab in the Navigator. Right-click Application Server and select New Application ServerConnection.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

8 of 36 1/30/2011 13:27

Page 9: Deploying a J2EE Application from JDeveloper 10g

2. Review the welcome page and click Next. Name the connection OracleAS10g and specify Oracle Application

Server 10g as the connection type. Click Next.

3. Provide the password for the ias_admin user, for example, welcome1, and click Next.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

9 of 36 1/30/2011 13:27

Page 10: Deploying a J2EE Application from JDeveloper 10g

4. Accept the default host name and port and specify the ORACLE_HOME directory for the Oracle Application Server

10g install, for example, D:\Oracle\OraAS10g, and click Next.

5. Accept the default values for the EJB Client Connection and click Next.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

10 of 36 1/30/2011 13:27

Page 11: Deploying a J2EE Application from JDeveloper 10g

6. Click Test Connection. When the status message indicates success, click Finish.

Deploy a J2EE Application

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

11 of 36 1/30/2011 13:27

Page 12: Deploying a J2EE Application from JDeveloper 10g

In this step you create an archive for the J2EE components, deploy it to the Oracle Application Server 10g, and test it from a browser.

Back to Topic List

Create and Deploy a JAR file for the J2EE EJB Model Project

Create and Deploy a WAR file for the J2EE View Project

Create and Deploy an EAR file for the Complete J2EE Application

Test the J2EE Application Deployment

Create and Deploy a JAR file for the J2EE EJB Model ProjectBack to List

1. With the J2EEApplication node expanded in the Application Navigator, right-click Model node, and select

New.

2. From the Deployment Profiles category, select EJB JAR File and click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

12 of 36 1/30/2011 13:27

Page 13: Deploying a J2EE Application from JDeveloper 10g

3 . Accept the default deployment profile name (ejb1). Click OK.

4 . In the EJB JAR Deployment Profile Properties pane, specify the enterprise application name as hrejb. Click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

13 of 36 1/30/2011 13:27

Page 14: Deploying a J2EE Application from JDeveloper 10g

5 . In the Resources node of the Application Navigator, right-click the deployment profile (ejb1.deploy) and select

Deploy to JAR file.

6 . In the Deployment window, ensure the EJB JAR file was created and there were no errors.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

14 of 36 1/30/2011 13:27

Page 15: Deploying a J2EE Application from JDeveloper 10g

Create and Deploy a WAR file for the J2EE View ProjectBack to List

1. Expand the J2EEApplication node in the Application Navigator, right-click View node, and select New.

2. From the Deployment Profiles category, select WAR File and click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

15 of 36 1/30/2011 13:27

Page 16: Deploying a J2EE Application from JDeveloper 10g

3 . Accept the default Deployment Profile Name (webapp1). Click OK.

4 . Select Specify J2EE Context Root and enter hrapp as the context root. Click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

16 of 36 1/30/2011 13:27

Page 17: Deploying a J2EE Application from JDeveloper 10g

5 . In the Resources node, right-click the deployment profile (webapp1.deploy) and select Deploy to WAR file.

6 . In the Deployment window, ensure the .war file was created.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

17 of 36 1/30/2011 13:27

Page 18: Deploying a J2EE Application from JDeveloper 10g

Create and Deploy an EAR file for the Complete J2EE Application

Back to List

1. With the J2EEApplication node expanded in the Application Navigator, right-click View node and select

New.

2. From the Deployment Profiles category, select EAR File and click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

18 of 36 1/30/2011 13:27

Page 19: Deploying a J2EE Application from JDeveloper 10g

3 . Accept the default Deployment Profile Name (application1). Click OK.

4 . In the General category of the EAR Deployment Properties pane, name the application hr.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

19 of 36 1/30/2011 13:27

Page 20: Deploying a J2EE Application from JDeveloper 10g

5 . In the Application Assembly node, select the check boxes for the ejb1.deploy and webapp1.deploy to

include them as part of the EAR deployment. Click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

20 of 36 1/30/2011 13:27

Page 21: Deploying a J2EE Application from JDeveloper 10g

6 . In the Resources node, right-click the deployment profile (application1.deploy) and select Deploy to ->

and select the name of your application server connection, (OracleAS10g).

7 . When you see the text Deployment Finished in the message window, the application has deployed. It may

take up to 5 minutes for this step to complete, depending on your hardware specifications.

Test the J2EE Application Deployment

Back to List

1. Access the application by using the following URL: http://localhost/hrapp/login (the application has

the "starter" Login.java servlet mapped to /login).

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

21 of 36 1/30/2011 13:27

Page 22: Deploying a J2EE Application from JDeveloper 10g

2. Test the application and login using 100 as the Employee Id and King as the Employee Name.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

22 of 36 1/30/2011 13:27

Page 23: Deploying a J2EE Application from JDeveloper 10g

3. Three employees belonging to the same department as King are displayed.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

23 of 36 1/30/2011 13:27

Page 24: Deploying a J2EE Application from JDeveloper 10g

Deploy an ADF Application

In this step you create an archive for the J2EE components, deploy it to the Oracle Application Server 10g, and test it from a browser.

.

Back to Topic List

Install the ADF Runtime Libraries

Create and Deploy a WAR file for the ADF ViewController Project

Test the ADF Application Deployment

Install the ADF Runtime Libraries

Back to List

1. Navigate to the Application Server Control located by default at: http://localhost:1810. Provide the

username and password for the administrator. Select Stop All to stop all of the running components.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

24 of 36 1/30/2011 13:27

Page 25: Deploying a J2EE Application from JDeveloper 10g

Click Yes to confirm the shutdown.

2. Shut down the OracleASControl and OracleProcessManager Application Server services from the operating

system. The services may be named differently according to your installation.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

25 of 36 1/30/2011 13:27

Page 26: Deploying a J2EE Application from JDeveloper 10g

3. In JDeveloper, select Tools -> ADF Runtime Installer -> Oracle Application Server (this installs thenecessary runtime files for either Oracle9iAS or Oracle Application Server 10g).

4. Review the welcome page and click Next.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

26 of 36 1/30/2011 13:27

Page 27: Deploying a J2EE Application from JDeveloper 10g

5. Specify the Application Server home directory and click Next.

6. In the Installation Options page, ensure Install a new version of the ADF runtime is selected and

click Next.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

27 of 36 1/30/2011 13:27

Page 28: Deploying a J2EE Application from JDeveloper 10g

7. On the Summary page, confirm your settings are correct and click Finish.

8. When the installation is finished, view ias.html and confirm the installation was successful.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

28 of 36 1/30/2011 13:27

Page 29: Deploying a J2EE Application from JDeveloper 10g

9. Restart the Application Server services in Windows.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

29 of 36 1/30/2011 13:27

Page 30: Deploying a J2EE Application from JDeveloper 10g

10. Access http://localhost:1810 and select Start All to start the application server components.

Create and Deploy a WAR file for the ADF ViewController Project

Back to List

1. Expand the ADFApplication node in the Application Navigator, right-click ViewController node and select

New.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

30 of 36 1/30/2011 13:27

Page 31: Deploying a J2EE Application from JDeveloper 10g

2. From the Deployment Profiles category, select WAR File and click OK.

3 . Accept the default Deployment Profile Name (webapp1). Click OK.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

31 of 36 1/30/2011 13:27

Page 32: Deploying a J2EE Application from JDeveloper 10g

4 . Select Specify J2EE Context Root and enter adfapp. Click OK.

5 . In the Resources node, right-click the deployment profile (webapp1.deploy). Select Deploy to -> and select

the name of your application server connection, (OracleAS10g).

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

32 of 36 1/30/2011 13:27

Page 33: Deploying a J2EE Application from JDeveloper 10g

6 . When you see the text Deployment Finished in the message window, the application has deployed. It may

take up to 5 minutes for this step to complete, depending on your hardware specifications.

Test the ADF Application Deployment

Back to List

1. Access the application by using the following URL: http://localhost/adfapp/Login.jsp (the application

has Login.jsp as its "starter" page).

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

33 of 36 1/30/2011 13:27

Page 34: Deploying a J2EE Application from JDeveloper 10g

2. Test the application and login using 100 as the Employee Id and King as the Employee Name.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

34 of 36 1/30/2011 13:27

Page 35: Deploying a J2EE Application from JDeveloper 10g

3. Three employees belonging to the Executive department are displayed.

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

35 of 36 1/30/2011 13:27

Page 36: Deploying a J2EE Application from JDeveloper 10g

Summary

In this tutorial you archived and deployed a J2EE application and an ADF application to Oracle Application Server 10g.

Back to Topic List

- Creating a JAR archive for the model components of a J2EE application- Creating a WAR archive for the view components of a J2EE application

- Creating an EAR archive for the entire application- Deploying the J2EE application to Oracle Application Server

- Testing the J2EE application deployment- Installing the ADF runtime libraries

- Creating a WAR archive for the view components of an ADF application- Deploying the ADF application to Oracle Application Server

- Testing the ADF application deployment

Related topics

Installing the Sample Schemas and Establishing a Database Connection

Move your mouse over this icon to hide all screenshots

Deploying a J2EE Application from JDeveloper 10g http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deplo...

36 of 36 1/30/2011 13:27