Testing and deploying portlets that reference J2EE modules
When portlets contain references to other J2EE modules, such as enterprise beans or utility JAR files, there are special considerations for testing and deploying the portlets to remote WebSphere® Portal servers.
The Rational® Software Delivery Platform has very comprehensive J2EE application deployment tooling. When a dynamic web project contains references to other J2EE modules, such as enterprise beans or utility JAR files, during testing and deploying to WAS, the referenced modules are packaged into the same EAR file, which contains the dynamic web module. Thus, the referenced modules are automatically deployed with the web module.
But when portlets containing references to J2EE modules are deployed to remote servers, the portlet project is assembled in a WAR file and deployed to the server using XMLAccess, the WebSphere Portal specific deployment protocol. A consequence of this is that the referenced J2EE modules are not automatically deployed to the server. For this reason, these modules and any utility jars referenced by the portlet WAR have to be manually deployed to the remote server separate from the portlet deployment.
Testing on a remote WebSphere Portal server
To make the portlet's EJB project and its utility JAR files available on a remote WebSphere Portal server, manually deploy the portlet EAR that contains the dependent utility JAR files from your development machine to the remote server's
shared/app directory.
- Identify all J2EE modules referenced from your portlets and manually deploy them to the remote WebSphere Portal server before testing/deploying the portlets. For more information, refer to Adding modules to an enterprise application
- Add the necessary classes to the portlet project:
- When referencing EJBs, create an EJB client jar from the EJB project, then add it to the portlet project.
- When referencing utility JAR's, export the referenced utility JAVA project to a JAR and include it in the portlet project
This procedure is similar to those for deploying an EJB project EAR to a WAS. For further information on how to deploy J2EE-based modules, dependent utility JAR files, or data sources to a remote server, refer to the WAS Infocenter.
Testing on a local WebSphere Portal test environment
To configure your local WebSphere Portal test environment to use utility JAR files
- In the Servers view, open the server instance that is defined for the local WebSphere Portal V6.0, or later, test environment
- In the Server configuration editor, select the
Portal tab.
- In the
Shared Library section, click the
Add External folder button.
- In the Select Folder dialog, find the folder that contains the compiled classes of the utility project (For example,
<rad_root>\runtimes\base_v60_stub\lib).
Note: If you know the specific location of the compiled class you are looking for, you can select the
Add External JARs button
- Save your changes and close the Server configuration editor.
For more information on working with J2EE modules and portlets in your local test environment, refer to Referring to other projects
Related tasks
Defining servers for publishing portlets
Exporting and installing portlet projects
Testing and debugging portlets
Related information