This chapter explains how to test and deploy JSR 168 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:
Section 33.1, "Introduction to Portlet Deployment Testing in a Development Environment"
Section 33.2, "Testing a Portlet Application on Integrated WebLogic Server"
Section 33.3, "Deploying a Portlet Application to an Oracle WebLogic Managed Server Instance"
For information about testing and deploying other custom WebCenter applications, see Chapter 38, "Testing and Deploying Your WebCenter Application".
For information about creating portlets, see Chapter 30, "Creating Portlets with the Oracle JSF Portlet Bridge" and Chapter 31, "Creating Portlets with the Portlet Wizard".
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, choose the menu option Build > Clean Runtime MDS Customizations.
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.
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 33-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 33-1 IntegratedWLSConnection in IDE Connections
For more information about Integrated WLS Server, see Integrated WebLogic Server.
This section includes the following subsections:
Section 33.2.1, "How to Test JSR 168 Portlets on Integrated WebLogic Server"
Section 33.2.2, "What Happens When You Test JSR 168 Portlets on Integrated WebLogic Server"
Section 33.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 JSR 168 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 33.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.
In the Select deployment type dialog, select Yes and then click OK.
See the DefaultServer Log window to monitor the deployment progress. The DefaultServer - 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 33-2 displays in a browser window.
Note:
This procedure is for testing purposes only. After this procedure, you are required to register your producer as described in Section 33.4, "Registering and Viewing Your Portlet".When you run JSR 168 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 168 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 168 portlets are added to the weblogic.xml
file, for example, oracle.portlet-producer.wsrp
.
These configurations vary depending upon the portlet requirements.
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 33.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 33-3. The format of the URL is http://
host:port/application_name
-Portlets-context-root/index.jsp
.
The PDK-Java Application Test page displays in a browser window, as shown in Figure 33-4.
Figure 33-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 33-5. The URL of this page is the one required to register the producer with another application.
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 33-5.
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
.
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 thetest-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:
Section 33.3.2, "How to Create and Provision a WebLogic Managed Server Instance"
Section 33.3.3, "How to Create and Register the Metadata Service Repository"
Section 33.3.4, "How to Create a WebLogic Managed Server Connection"
Section 33.3.5, "How to Deploy a Portlet Application to an Oracle WebLogic Managed Server Instance"
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 38.3.1.2, "Creating Deployment Profiles" in Chapter 38, "Testing and Deploying Your WebCenter Application".This section includes the following subsections:
To create a WAR deployment profile:
In the Application Navigator, expand Web Content and WEB-INF.
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.
In the Create Deployment Profile -- WAR File dialog, enter a name for your deployment profile and click OK.
In the Edit WAR Deployment Profile Properties dialog, select the Specify Java EE Web Context Root option and enter a context root. You can also enter the name of the deployment profile. Then click OK.
In the Project Properties dialog, under Deployment Profiles, select the WAR File you just created and click OK.
To create a deployment descriptor:
From the main menu, choose File and then New.
In the New Gallery, expand General, select Deployment Descriptors and then Java EE Deployment Descriptor, and click OK.
In the Create Java EE Deployment Descriptor dialog, on steps 1 to 4, accept the default values and click Finish.
To deploy a portlet producer application to a WebLogic Managed Server instance, you must first create a server instance and provision it with a required set of shared libraries. For more information, see the section "Creating and Provisioning a WebLogic Managed Server Instance" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.
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 (MDS) Repository" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.
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 create a connection to the managed server, ensure that the server instance is up and running.
To create a WebLogic Managed Server connection:
From the main menu, select File and then New.
In the New Gallery, expand General, select Connections and then Application Server Connection, and click OK.
In the Create Application Server Connection wizard, on Step 1, enter a name for the new connection, for example, PortletServer
. Then click Next.
On Step 2, specify the user name and password for authentication and click Next.
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
.
In the WLS Domain, specify the name of the domain in which the WebLogic Server instance is created, for example, wc_domain
. Click Next.
On Step 4, click Test Connection. If the test is successful, the connection is set up.
Click Finish.
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:
In the Application Navigator, open the application to be deployed.
Right-click the project folder, choose Deploy, deployment profile name, to, and then choose the connection name.
Note:
If your portlet application contains JSR 168 portlets, then the Select deployment type dialog displays. Click OK to add the configuration required to expose this application as a WSRP service.In the Select Deployment Target dialog, select the managed server name, for example, WLS_Portlet
, and click OK.
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.
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.
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.
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.
If you are deploying JSR 168 portlets, the configuration settings described in Section 33.2.2, "What Happens When You Test JSR 168 Portlets on Integrated WebLogic Server" are added to the EAR file.
If you are deploying PDK-Java portlets, the configuration settings described in Section 33.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.
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 168 portlets, follow the instructions provided in Section 34.2.1, "How to Register a WSRP Portlet Producer".
To register producers for your PDK-Java portlets, follow the instructions provided in Section 34.2.3, "How to Register an Oracle PDK-Java Portlet Producer".
To add your portlets to a page, follow the instructions provided in Section 34.3, "Adding Portlets to a Page".