Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle WebCenter
11g Release 1 (11.1.1.4.0)

Part Number E10148-12
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

57 Testing and Deploying Your Portlets

This chapter explains how to test and deploy JSR 286 and Oracle PDK-Java portlets. In a development environment, you can test your portlets on Integrated WebLogic Server (WLS), which comes packaged with Oracle JDeveloper, and also deploy portlet applications to an Oracle WebLogic Managed Server instance residing outside JDeveloper.

This chapter includes the following sections:

For information about testing and deploying other WebCenter Portal applications, see Chapter 64, "Deploying and Testing Your WebCenter Portal Application".

For information about creating portlets, see Chapter 54, "Creating Portlets with the Oracle JSF Portlet Bridge" and Chapter 55, "Creating Portlets with the Portlet Wizard".

57.1 Introduction to Portlet Deployment Testing in a Development Environment

Before you deploy your portlet application, you are advised to test it in a development environment. Integrated WLS in JDeveloper enables you to test your portlets in a single step, without creating a deployment profile. To learn the benefits of testing applications on Integrated WLS, see Integrated WebLogic Server. An additional benefit is that portlet customizations that you perform at design time are maintained in your application workspace and become an integral part of the application source definition. These changes are packaged with the EAR file when the application is deployed to a WebLogic Managed Server instance (managed servers). This eliminates the requirement to export and import portlet customizations.

If, while testing your application with Integrated WebLogic Server, you make changes at runtime, these customizations are also retained. If you do not want to keep these runtime customizations when you deploy your application to a managed server, you must clear them. You can do this manually by deleting them from the configured directory. Alternatively, during the development of your application, you can clear out these runtime customizations each time the application is run. To do this:

  1. In the Application Navigator, click the Application Menu icon next to your application's name and choose Application Properties.

  2. In the Application Properties dialog, expand the Run node in the left pane, then select MDS.

  3. In the right pane, select Delete customizations before each run. Doing so clears the MDS of any runtime customizations every time the application is run.

  4. Click OK.

To test your portlet application on an Oracle WebLogic Managed Server instance, or to deploy for production, you must configure a connection to the managed server, create deployment plans, and then deploy to the server instance as described in this chapter. For information about deploying portlet applications using Oracle Enterprise Manager Fusion Middleware Control, WLS Administration Control, or WLST commands, see the chapter, "Managing Portlet Producers" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

57.2 Testing a Portlet Application on Integrated WebLogic Server

The connection to Integrated WLS (Default Server) connection is preconfigured and shows as IntegratedWLSConnection under the Application Server node in the IDE Connections panel of the Resource Palette, as shown in Figure 57-1. You can run multiple applications simultaneously and watch the progress of each application in the Run Manager panel. The Run Manager panel also lets you stop Default Server instances.

Figure 57-1 IntegratedWLSConnection in IDE Connections

Description of Figure 57-1 follows
Description of "Figure 57-1 IntegratedWLSConnection in IDE Connections"

For more information about Integrated WLS Server, see Integrated WebLogic Server.

This section includes the following subsections:

57.2.1 How to Test JSR 286 Portlets on Integrated WebLogic Server

To test a JSR 286 portlet application, right-click the portlet.xml page in the project folder and select Run. Running portlet.xml triggers packaging and deployment of your portlet application on an instance of Integrated WLS named after the application.

Note:

When the Integrated WLS instance stops, the application is undeployed, and therefore, becomes unavailable.

For a more persistent testing scenario, you can deploy your portlet application to Integrated WLS by right-clicking the application and then selecting Deploy. This deploys your application to the Default Server instance so that it is always available when the Default Server is running. Thus, the application remains accessible for multiple consumer applications. If you choose this method, then you must first create deployment profiles, as described in Section 57.3.1, "How to Create Deployment Profiles". If you deploy your application to Integrated WLS, then the Deployment Configuration dialog displays to let you configure and customize deployment settings. The file system MDS repository pre-created by JDeveloper displays in the Repository Name field.

See the IntegratedWebLogicServer - Log window to monitor the deployment progress. The log shows the URL of the application page. The WSRP producer URL uses the following syntax:

http://host:port/applicationname-Portlets-context-root/info

where:

  • host is the server to which your producer has been deployed.

  • port is the HTTP Listener port. Typically, it is 7101. When the server is started, the port is displayed in the console.

  • context-root is the Web application's context root.

A test page similar to Figure 57-2 displays in a browser window.

Figure 57-2 WSRP Producer Test Page

Description of Figure 57-2 follows
Description of "Figure 57-2 WSRP Producer Test Page"

Note:

This procedure is for testing purposes only. After this procedure, you are required to register your producer as described in Section 57.4, "Registering and Viewing Your Portlet".

57.2.2 What Happens When You Test JSR 286 Portlets on Integrated WebLogic Server

When you run JSR 286 portlets on Integrated WLS, the following happens:

  • wsdls and other configuration files are added to the WEB-INF directory to configure the portlets as a Web service.

  • The web.xml file is updated with listener and server classes, filters, parameters, and other configurations that are required to run the JSR 286 portlet application successfully.

    For example, the oracle.portlet.server.adapter.web.ServerContextListener class, WSRP_v2_PortletManagement_Service and WSRPBaseService filters, and so on.

  • Libraries required for JSR 286 portlets are added to the weblogic.xml file, for example, oracle.portlet-producer.wsrp.

These configurations vary depending upon the portlet requirements.

57.2.3 How to Test PDK-Java Portlet Applications on Integrated WebLogic Server

When you run your portlet application on Integrated WLS, an instance of Default Server starts.

To test a portlet application, right-click a JSP page, for example, index.jsp in the project folder and select Run. Running index.jsp triggers packaging and deployment of your portlet application on an instance of Integrated WLS named after the application.

Note:

When the Integrated WLS instance stops, the application is undeployed, and therefore, becomes unavailable.

For a more persistent testing scenario, you can deploy your portlet application to Integrated WLS by right-clicking the application and then selecting Deploy. This deploys your application to the Default Server instance so that it is always available when the default server is running. Thus, the application remains accessible for multiple consumer applications. If you choose this method, then you must first create deployment profiles, as described in Section 57.3.1, "How to Create Deployment Profiles". If you deploy your application to Integrated WLS, then the Deployment Configuration dialog displays to let you configure and customize deployment settings. The file system MDS repository pre-created by JDeveloper displays in the Repository Name field.

See the DefaultServer Log window to monitor the deployment progress. The DefaultServer - Log shows the URL of the application test page, as shown in Figure 57-3. The format of the URL is http://host:port/application_name-Portlets-context-root/index.jsp.

Figure 57-3 DefaultServer - Log

Description of Figure 57-3 follows
Description of "Figure 57-3 DefaultServer - Log"

The PDK-Java Application Test page displays in a browser window, as shown in Figure 57-4.

Figure 57-4 Portlet Application Test Page

Description of Figure 57-4 follows
Description of "Figure 57-4 Portlet Application Test Page"

Click the link underneath Service Name. Your browser should open with a page similar to the one shown in Figure 57-5. The URL of this page is the one required to register the producer with another application.

Figure 57-5 Producer Test Page

Shows provider test page.
Description of "Figure 57-5 Producer Test Page"

Alternatively, you can construct the URL yourself as follows:

http://host:port/context-root/providers/producer_name

where:

host is the server to which your producer has been deployed.

port is the HTTP Listener port. Typically, it is 7101. When the server is started, the port is displayed in the console.

context-root is the Web Application's Context Root, which you specified earlier and can be found in the WAR Deployment Profile Properties under General.

producer_name is the name of the portlet's producer. A WAR file may contain multiple producers, hence you should always include the name of the producer for clarity. Otherwise, you get the default producer, which is the first producer created. The default producer is defined by the _default.properties file. This is created with the first producer in a project.

If you enter this URL in your browser, you should see a page similar to the one in Figure 57-5.

57.2.4 What Happens When You Test PDK-Java Portlet Applications on Integrated WebLogic Server

When you run PDK-Java portlets on Integrated WLS the following happens:

  • Configuration files for PDK-Java portlets are added to the WEB-INF directory.

  • The web.xml file is updated with listener and server classes, filters, parameters, and other configurations that are required to run the portlet application successfully.

    For example, the ResourceServlet pdkresource, the oracle.portlet.server.service.ContextFilter filter, and so on. These configurations vary depending upon the portlet requirements.

  • Libraries required for PDK-Java portlets are added to the weblogic.xml file, for example, oracle.portlet-producer.jpdk.

57.3 Deploying a Portlet Application to an Oracle WebLogic Managed Server Instance

To test your portlet application on an Oracle WebLogic Managed Server instance, or to deploy it for production, you must first create an application WAR deployment profile, a deployment descriptor, and a connection to the Oracle WebLogic Managed Server instance. Before you deploy or test your portlet application to a managed server, ensure that the managed server is created using the correct template and it contains all the required shared libraries as described in the section "Creating and Provisioning a WebLogic Managed Server Instance" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

Note:

Before you deploy the application, you must remove the test-all application role if you enabled the automatic grants feature in the Configure ADF Security wizard. Because the test-all role makes all ADF resources public, its presence increases the risk that your application may leave some resources unprotected. You must therefore remove the role before you migrate the application-level policy store.

For more information, see the section "How to Remove the test-all Role from the Application Policy Store" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

For information about deploying portlet applications using Oracle Enterprise Manager Fusion Middleware Control, Oracle WebLogic Administration Console, or WLST commands, see the chapter, "Managing Portlet Producers" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

This section includes the following subsections:

57.3.1 How to Create Deployment Profiles

The project-level deployment profile is packaged as a Web Application Archive (WAR) file. Deployment descriptors are server configuration files that define the configuration of an application for deployment and are deployed with the portlet 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.

Note:

You can deploy PDK-Java portlets only as EAR files. Therefore, while creating deployment profiles, ensure that the WAR file is included in the application's EAR file. For information about how to create an EAR file, see Section 64.3.2.2, "Creating Deployment Profiles" in Chapter 64, "Deploying and Testing Your WebCenter Portal Application".

This section includes the following subsections:

57.3.1.1 Creating a WAR Deployment Profile

To create a WAR deployment profile:

  1. In the Application Navigator, expand Web Content and WEB-INF.

  2. Right-click web.xml and choose Create WAR Deployment Profile.

    Alternatively, from the main menu, choose File and then New. In the New Gallery, expand General, select Deployment Profiles and then WAR File, and click OK.

  3. In the Create Deployment Profile -- WAR File dialog (Figure 57-6), enter a name for your deployment profile and click OK.

    Figure 57-6 The Create Deployment Profile -- WAR File Dialog

    Description of Figure 57-6 follows
    Description of "Figure 57-6 The Create Deployment Profile -- WAR File Dialog"

  4. In the Edit WAR Deployment Profile Properties dialog (Figure 57-7), select the Specify Java EE Web Context Root option and enter a context root. Then click OK.

    Figure 57-7 The Edit WAR Deployment Profile Properties Dialog

    Description of Figure 57-7 follows
    Description of "Figure 57-7 The Edit WAR Deployment Profile Properties Dialog"

  5. In the Project Properties dialog (Figure 57-8), under Deployment Profiles, select the WAR File you just created and click OK.

    Figure 57-8 The Project Properties Dialog

    Description of Figure 57-8 follows
    Description of "Figure 57-8 The Project Properties Dialog"

57.3.1.2 Creating a Deployment Descriptor

To create a deployment descriptor:

  1. From the main menu, choose File and then 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 steps 1 to 4, accept the default values and click Finish.

57.3.2 How to Create and Provision a WebLogic Managed Server Instance

To deploy a portlet producer application to a WebLogic Managed Server instance, you must first create a server instance that contains all the required shared libraries. For more information, see the section "Creating a Managed Server" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

57.3.3 How to Create and Register the Metadata Service Repository

After creating the WebLogic Managed Server instance, you must create and register a Metadata Service Repository (MDS) schema for the application on the WebLogic Domain's Administration Server instance. For more information, see the section "Creating and Registering the Metadata Service Repository" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

57.3.4 How to Create a WebLogic Managed Server Connection

In JDeveloper, you can deploy your portlet applications to Oracle WebLogic Managed Server instances that reside outside JDeveloper. You must first create a connection to the server instance.

Before You Begin

Before you create a connection to the managed server, ensure that the server instance is up and running.

To create a WebLogic Managed Server connection:

  1. From the main menu, select File and then New.

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

  3. In the Create Application Server Connection wizard, on Step 1, enter a name for the new connection, for example, PortletServer. Then click Next.

  4. On Step 2, specify the user name and password for authentication and click Next.

  5. On Step 3, enter the host name of the WebLogic Server instance, for example, webcenter.portletserver.example.com and the port number, for example, 7001.

  6. In the WLS Domain, specify the name of the domain in which the WebLogic Server instance is created, for example, wc_domain. Click Next.

  7. On Step 4, click Test Connection. If the test is successful, the connection is set up.

  8. Click Finish.

57.3.5 How to Deploy a Portlet Application to an Oracle WebLogic Managed Server Instance

After you have created the deployment profiles and a connection to the managed server for portlet deployment, you can deploy your portlet application to this server instance.

To deploy a portlet application:

  1. In the Application Navigator, open the application to be deployed.

  2. Right-click the project folder, choose Deploy, and then the deployment profile.

  3. In the Deploy dialog, in the Deployment Action page, select Deploy to Application Server, and then click Next.

  4. In the Select Server page, select the connection to the managed server, and then click Next.

  5. In the WebLogic Options page, select the managed server, for example, WLS_Portlet, and click Finish.

    Note:

    If your portlet application contains JSR 286 portlets, then the Select deployment type dialog displays. Click Yes to add the configuration required to expose this application as a WSRP service.
  6. In the Deployment Configuration dialog, under the MDS tab, in the Repository Name dropdown list, select the metadata repository to be used by the application you are deploying.

  7. In the Partition Name field, specify the application's partition name. Each application is recommended to have its own partition. The application name can be used as the partition name.

  8. Under the Connections tab, modify the connections packaged with the portlet producer application being deployed.

    Note:

    Consider the following about producer connections:
    • In the Connections tab, you cannot change secure properties of the connections. You can modify these connections post-deployment using Fusion Middleware Control. For information, see the chapter "Managing Services" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

    • To edit a WSRP connection, you must also edit the associated Web service connection, which follows the naming convention connectionname-wsconn, for example, myWSRPproducer-wsconn.

    • To edit PDK-Java producers, you must also edit the underlying URL connection, which follows the naming convention connectionname-urlconn, for example, myPDKproducer-urlconn.

    • WSRP 1.0 standard does not support export and import capabilities. Therefore, customizations made to WSRP 1.0 producers are not migrated during deployment.

  9. Click Deploy. The Deployment - Log displays the deployment status.

    The message Deployment started displays in the Deployment - Log window. If the application is successfully deployed to the targeted server instance, the message Deployment finished displays in the log.

57.3.6 What Happens When You Deploy a Portlet Application to an Oracle WebLogic-Managed Portlet Server

If you are deploying JSR 286 portlets, the configuration settings described in Section 57.2.2, "What Happens When You Test JSR 286 Portlets on Integrated WebLogic Server" are added to the EAR file.

If you are deploying PDK-Java portlets, the configuration settings described in Section 57.2.4, "What Happens When You Test PDK-Java Portlet Applications on Integrated WebLogic Server" are added to the application EAR file at design time.

If you are deploying your portlet application in a cluster environment, you will receive the following warning:

WARNING: oracle.webcenter.lifecycle.exception.LifecycleLockedException: A lock exists that prevents the export set import.

This is expected behavior. When you deploy your application, the producer metadata exported into the EAR file (as a MAR file) needs to be imported into an MDS schema for use in the production environment. Importing the metadata occurs automatically during deployment. This import only needs to happen with one node in the cluster, so a lock is created to prevent other nodes in the cluster trying to perform the same operation.

57.4 Registering and Viewing Your Portlet

After you have created and deployed the producer and its portlets, you should register the producer with an application and add one or more portlets to a page to check that it is working correctly. Registering a producer gives applications the information they require to locate and communicate with that producer. After you register a producer, it is exposed as a connection, and the producer and its portlets become available in the Application Resources panel under the Connections node, or in the Resource Palette.

To register producers for your JSR 286 portlets, follow the instructions provided in Section 59.2.1, "How to Register a WSRP Portlet Producer".

To register producers for your PDK-Java portlets, follow the instructions provided in Section 59.2.3, "How to Register an Oracle PDK-Java Portlet Producer".

To add your portlets to a page, follow the instructions provided in Section 59.3, "Adding Portlets to a Page".