IBM Support

Compiling Maven projects in RAD for WAS 9.0 and later versions

Troubleshooting


Problem

WebSphere Application Server V9.0 and later provide a Maven module with the APIs that are required to compile your projects. If you install this module into your Maven repository, you do not need to manually add the module JAR file to your class path.

Rational Application Developer Portal Tooling Feature (V9.6.1.3 and later) also provide a set of Maven dependencies and artifacts to be used in conjunction with WebSphere Portal Server V9.0 and later.  The following procedure will guide you through the steps required to deploy applications integrated with Maven to a WebSphere Portal Server V9.0 and later server.

Symptom

Unable to deploy from Rational Application Developer to the WebSphere Portal 9.0 server via the Maven Based Deployment feature.

Resolving The Problem

This information assumes that you have WebSphere Portal Server installed on a system that you have access to.

1) From the Rational Application Developer Web Perspective, open the Window Preferences dialog.  Navigate to Window -> Preferences -> Maven. Disable the ‘Do not automatically update dependencies from remote repositories’ preference and enable the ‘Download repository index updates on startup’ preference. Click Apply and then click OK.

2) Open the Window Preferences dialog.  Navigate to Window -> Preferences -> Java EE -> Maven -> Maven Repository Initialization. Select Configure. Select OK.

Notes:

  • The configure button will become disabled after performing this for the first time.
  • Restart Rational Application Developer at this time so that the download that was enabled in step 1 is started.  You may experience an error in future steps if you do not perform the Rational Application Developer restart.

3a) Import WebSphere Application Server dependencies

From the perspective tool bar, Navigate to File -> Import.  The Import Configurations page will be displayed.

Select Run/Debug -> Launch Configurations.  Click Next to launch the Import wizard.  Click Browse to populate the From Directory.

From your Installation Manager shared install directory, select IBMIMShared/plugins/com.ibm.etools.portal.server.tools.common.core_<version>/resources/RunConfigurations

Click OK

The import Launch Configurations page will display.

Enable RunConfigurations. The PortalPlugInsInstaller.launch and WASPluginsInstaller.launch run configuration options will both become enabled. Disable the PortalPluginsInstaller.launch option. It will be added in another step.  Click Finish.

3b) From the perspective tool bar, navigate to Run -> Run Configurations to launch the Run Configuration wizard.  Select Maven Build -> WASPluginsInstaller.

To set the Base Directory, Press the File System button.  From your Installation Manager shared install directory,  select  IBMIMShared/plugins/com.ibm.etools.portal.server.tools.common.core_<version>/resources/scripts/WAS 9 Plugins installer

Next, double click on the serverInstallationFolder parameter name and set the value of the WebSphere Application Server installation location: /opt/IBM/WebSphere/AppServer (for example).

Click OK. Click Apply. Click Run.

4a) Import WebSphere Portal dependencies
From the perspective tool bar, navigate to File -> Import.  The Import Configurations page will be displayed.

Select Run/Debug -> Launch Configurations.  Press Next.  The Import wizard will launch.  Press the Browse button to populate the From Directory.

From your Installation Manager shared install directory,  select  IBMIMShared/plugins/com.ibm.etools.portal.server.tools.common.core_<version>/resources/RunConfigurations

Click OK to display the import Launch Configurations page.

Enable RunConfigurations. The PortalPlugInsInstaller.launch and WASPluginsInstaller.launch run configuration options will both become enabled. Disable the WASPluginsInstaller.launch option. It was just added in a previous step.  Press Finish.

4b) From the perspective tool bar, navigate to Run -> Run Configurations to launch the Run Configuration wizard.  Select Maven Build -> PortalPluginsInstaller.

To set the Base Directory, press the File System button.   From your Installation Manager shared install directory,  select IBMIMShared/plugins/com.ibm.etools.portal.server.tools.common.core_<version>/resources/scripts/Portal 9 Plugins installer.

Next, double click on the serverInstallationFolder parameter name and set the value of the WebSphere Portal Server installation location: /opt/IBM/WebSphere/PortalServer (for example).

Click OK.  Click Apply. Click Run.
 

5) Create a new Maven Portlet project

From the perspective tool bar, Navigate to File -> New -> Maven Project.

Click Next on the initial screen of the project wizard.  Press the Add Archetype button on the subsequent screen.

Set the following:

Group Id:            com.ibm.tools.archetype 
Artifact Id:          portletapp-portlet20 
Version:               1.0.2

Select OK. Select Next. On the Specify Archetype parameters page, populate the Group Id, Artifact Id and version parameters.

Finally, set the portlettitle and portletclass properties as desired.

Click  Finish.

6) Expand the new Maven project and open it's pom.xml file.  Select the pom.xml tab to display the dependencies.           

Verify that the following dependencies are included:

<dependency>

    <groupId>com.ibm.websphere.appserver</groupId>

    <artifactId>was_public</artifactId>

    <version>9.0.0</version>

    <type>jar</type>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>com.ibm.websphere.ws</groupId>

    <artifactId>com.ibm.ws.portletcontainer</artifactId>

    <version>1.0.0</version>

    <type>jar</type>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>com.ibm.websphere.j2ee</groupId>

    <artifactId>j2ee</artifactId>

    <version>1.0.0</version>

    <type>jar</type>

    <scope>provided</scope>

</dependency>

For Maven-based deployment:
1) Add the WebSphere Portal deployment plugin to the project's pom.xml in the <build>/<plugins> section and save it.

<plugin>
    <groupId>com.ibm.tools.plugin</groupId>
    <artifactId>portal-deployment-maven-plugin</artifactId>
    <version>1.0.2</version>
        <executions>
            <execution>
            <phase>integration-test</phase>
            <configuration>
                <username>your-admin-id-here</username>
                <password>your-password-here</password>
                <hostname>localhost</hostname>
                <port>your-port-here</port>
                <profilepath>your-wp_profile-path-here</profilepath>
                <cell>your-wp_profile-cell-here</cell>
            </configuration>
            <goals>
                <goal>deploy-portlet</goal>
            </goals>
        </execution>
    </executions>
</plugin>

2) Right click on your Maven project, the context menu will appear.  Select Run As -> Maven build...  (NOTE: chose the Maven build options WITH ellipses.)

Set Goals to: integration-test -X

Click Apply. Click Run.

The console file messages indicate that the installation of PA_portletapp-portlet application was successful. 

Verify that the PA_portletapp-portlet application was successfully deployed to the WebSphere Application Server and the WebSphere Portal Server. From the Servers view, right click on the WebSphere Portal Server definition. Select Administration -> Run Administrative Console


The WebSphere Application Server Administration Console appears in a browser view.  Log on to the WebSphere Application Server Administration Console and navigate to Applications -> Application Types -> WebSphere enterprise applications.  The console shows that the PA_portletapp-portlet application is installed and running:

Log off the WebSphere Application Server Administration Console and log on to the WebSphere Portal Console. 
From the Servers view, right click on the WebSphere Portal server definition.  Select Open Portal.  The application also appears under the Portal Console -> Manage Applications:


NOTE:  Maven publishing is different from non-Maven publishing where any changes made to the application will not automatically be deployed to the server.  The application must be redeployed.

For additional information, please see the following tech doc:

http://www-01.ibm.com/support/docview.wss?uid=swg21302931

For Add/Remove Deployment via the Rational Application Developer’s Servers view (The preferred method of deployment for iterative development):

NOTE:  Prior to configuring this step, if you navigate to the Servers view, then right click on the WebSphere Portal Server definition. and select ‘Add and Remove…’.  A dialog message appears that shows the following:
“There are no resources that can be added or removed from the server.”

Now, to allow the application to be installed/uninstalled via the server view’s ‘Add and Remove’ option:

1) Open the Window Preferences dialog.  Navigate to  Window -> Preferences -> Java EE -> Maven -> Maven Project Settings.

Set the Dynamic Web Project -> Content Directory value to src/main/webapp by pressing the ‘Set Maven value’ button to the right of the value. Click OK.

2) Create a new EAR project

From the perspective toolbar, navigate to File -> New -> Other -> Java EE -> Enterprise Application Project.  Click Next to launch the EAR Application Project wizard.

Enter a new project name e.g. "MyMavenEAR" and set the target runtime to the applicable WebSphere Portal version. Click Next.

Enable your Maven Web/Portlet project as the Java EE module dependency. Click Finish.

Now add the WAR project as member of EAR project.  Right click the new MyMavenEAR project.  From the context menu, select Java EE Tools -> Generate Deployment Descriptor Stub.

3) Use the server view Add/Remove option to Add the new EAR project to the WebSphere Portal Server and Publish

In the Servers view, right click on your WebSphere Portal Server definition.
Select the Add and Remove... option.  The Add and Remove dialog appears.
Select "MyMavenEAR" from the Available list.
Click Add to move it to the Configured list.
Click Finish.


 

The installation messages will appear in the console.log.

Following a successful installation, MyMavenEAR appears in the WebSphere Application Server Administration Console’s list of installed applications.

When you open the WebSphere Portal Server definition in the server view, under the Portal tab, there is a default Portal Page configuration name set to Rational Components.

Prior to executing the Add and Remove step, edit the server definition and change the title to RAD Portal Maven Test.
Log on to the WebSphere Portal Console and the portlet displays in the RAD Portal Maven Test page.

To uninstall from the server, in the Servers view, right click on your WebSphere Portal Server definition.
Select the Add and Remove... option.  The Add and Remove dialog appears.
Select "MyMavenEAR" from the Configured list.
Click Remove to move it to the Available list.
Click Finish.

The uninstall messages will appear in the console.log.

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Component":"Maven","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.6.1.3;9.6.1.4;9.7.0.1;9.7.0.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
20 January 2020

UID

ibm10883464