Installing Liferay DXP on WebSphere

IBM ® WebSphere ® is a trademark of International Business Machines Corporation, registered in many jurisdictions worldwide.

For Liferay DXP to work correctly, WebSphere 8.5.5 Fix Pack 11 (or later) or WebSphere 9 (Fix Pack 7 is the latest) must be installed. You can find more information about this fix pack here.

Please also note that Liferay DXP doesn’t support the WebSphere Application Liberty Profile.

You should also read the following articles to familiarize yourself with Liferay DXP’s general installation steps:

Note that the Liferay Home folder is important to the operation of Liferay DXP. In Liferay Home, Liferay DXP creates certain files and folders that it needs to run. On WebSphere, Liferay Home is typically [Install Location]/WebSphere/AppServer/profiles/your-profile/liferay.

Before proceeding, you must download these Additional Files:

  • Liferay DXP WAR file
  • Dependencies ZIP file
  • OSGi Dependencies ZIP file

Without any further ado, get ready to install Liferay DXP in WebSphere!

Preparing WebSphere for Liferay DXP

When the application server binaries have been installed, start the Profile Management Tool to create a profile appropriate for Liferay DXP.

  1. Click Create…, choose Application Server, and then click Next.

  2. Click the Advanced profile creation option and then click Next. You need the advanced profile to specify your own values for settings such as the location of the profile and names of the profile, node and host, to assign your own ports, or to optionally choose whether to deploy the administrative console and sample application and also add web-server definitions for IBM HTTP Server. See the WebSphere documentation for more information about these options.

    Figure 1: Choose the Advanced profile option to specify your own settings.

    Figure 1: Choose the Advanced profile option to specify your own settings.

  3. Check the box Deploy the administrative console. This gives you a web-based UI for working with your application server. Skip the default applications. You’d only install these on a development machine. Click Next.

  4. Set the profile name and location. Ensure you specify a performance tuning setting other than Development, since you’re installing a production server. See the WebSphere documentation for more information about performance tuning settings. Click Next.

  5. Choose node, server, and host names for your server. These are specific to your environment. Click Next.

  6. Administrative security in WebSphere is a way to restrict who has access to the administrative tools. You may want to have it enabled in your environment so that a user name and password are required to administer the WebSphere server. See WebSphere’s documentation for more information. Click Next.

  7. Each profile needs a security certificate, which comes next in the wizard. If you don’t have certificates already, choose the option to generate a personal certificate and a signing certificate and click Next.

  8. Once the certificates are generated, set a password for your keystore. Click Next.

  9. Now you can customize the ports this server profile uses. Be sure to choose ports that are open on your machine. When choosing ports, the wizard detects existing WebSphere installations and if it finds activity, it increments ports by one.

  10. Choose whether you want this profile started when the machine starts. Click Next.

  11. WebSphere ships with IBM HTTP Server, which is a re-branded version of Apache. Choose whether you want a web server definition, so that this JVM receives requests forwarded from the HTTP server. See WebSphere’s documentation for details on this. When finished, click Next.

  12. The wizard then shows you a summary of what you selected, enabling you to keep your choices or go back and change something. When you’re satisfied, click Next.

WebSphere then creates your profile and finishes with a message telling you the profile was created successfully. Awesome! Your profile is complete. Now there are a few things you need to configure in your application server.

Figure 2: Example of the settings before creating the profile.

Figure 2: Example of the settings before creating the profile.

Configuring the WebSphere Application Server

In this version of WebSphere, servlet filters are not initialized on web application startup, but rather, on first access. This can cause problems when deploying certain apps to Liferay DXP. To configure servlet filters to initialize on application startup (i.e., deployment), set the following webcontainer properties in your WebSphere application server:

com.ibm.ws.webcontainer.initFilterBeforeInitServlet = true
com.ibm.ws.webcontainer.invokeFilterInitAtStartup = true

To set webcontainer properties in the WebSphere application server, follow the instructions here in WebSphere’s documentation.

Setting up JVM Parameters for Liferay DXP

Next, in the WebSphere profile you created for Liferay DXP, you must set an argument that supports Liferay DXP’s Java memory requirements. You’ll modify this file:

[Install Location]/WebSphere/AppServer/profiles/your-profile/config/cells/your-cell/nodes/your-node/servers/your-server/server.xml

Add maximumHeapSize="2048" inside the jvmEntries tag. For example:

<jvmEntries xmi:id="JavaVirtualMachine_1183122130078" ... maximumHeapSize="2048">

Administrators can set the UTF-8 properties in the server.xml file. This is required or else special characters will not be parsed correctly. Add the following inside the jvmEntries tag:

<jvmEntries xmi:id="JavaVirtualMachine_1183122130078" ...genericJvmArguments="-Dfile.encoding=UTF-8 -Duser.timezone=GMT">

Alternately, you can set the UTF-8 properties from the WebSphere Admin Console. (See below.)

Removing the secureSessionCookie Tag

In the same profile, you should delete a problematic secureSessionCookie tag that can cause Liferay DXP startup errors. Note that this is just a default setting; once Liferay DXP is installed, you should tune it appropriately based on your usage.

In [Install Location]/WebSphere/AppServer/profiles/your-profile/config/cells/your-cell/cell.xml, Delete the secureSessionCookie tag containing xmi:id="SecureSessionCookie_1".

If this tag is not removed, an error similar to this may occur:

WSVR0501E: Error creating component com.ibm.ws.runtime.component.CompositionUnitMgrImpl@d74fa901    
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: SRVE8111E: The application, LiferayEAR, is trying to modify a cookie which matches a pattern in the restricted programmatic session cookies list [domain=*, name=JSESSIONID, path=/].

Installing Liferay DXP’s Dependencies

You must now install Liferay DXP’s dependencies. Recall that earlier you downloaded two ZIP files containing these dependencies. Install their contents now:

  1. liferay-dxp-digital-enterprise-dependencies-[version].zip: Unzip this file and place its contents in your WebSphere application server’s [Install Location]/WebSphere/AppServer/lib/ext folder. If you have a JDBC database driver JAR, copy it to this location as well.

  2. From the same archive, copy portlet.jarinto [Install Location]/WebSphere/AppServer/java/java-[version]/jre/lib/ext for WebSphere 8.5.5.11 or [Install Location]/WebSphere/AppServer/javaext for WebSphere 9.0.0.x. WebSphere already contains an older version of portlet.jar which must be overridden at the highest classloader level. The new portlet.jar (version 3) is backwards-compatible.

  3. liferay-dxp-digital-enterprise-osgi-[version].zip: Unzip this file and place its contents in the [Liferay Home]/osgi folder (create this folder if it doesn’t exist). This is typically [Install Location]/WebSphere/AppServer/profiles/your-profile/liferay/osgi.

Before starting the server, verify that all the following jars have been copied to the correct folders. Optional jars are available (italics) and are used to optimize Liferay performance which must be added to this folder. Required jars in bold are from the liferay-digital-enterprise-dependencies-[version] zip. The following files should be present within the lib/ext (WebSphere Application) folder:

  1. activation.jar
  2. com.liferay.registry.api.jar
  3. hsql.jar
  4. A JDBC database jar (e.g. MySQL, MariaDB, IBM DB2, Postgres for production)
  5. persistence.jar
  6. portal-kernel.jar
  7. portlet.jar

The following folders should be present within the /liferay/osgi folder:

  1. Configs
  2. Core
  3. Marketplace
  4. Modules
  5. Portal
  6. Static
  7. Test
  8. War

Ensuring that Liferay DXP’s portlet.jar is loaded first

In addition to placing the portlet.jar in the correct folder, you must configure the config.ini file so that it is loaded first. Navigate to /IBM/WebSphere/AppServer/configuration/config.ini.

  1. Find the property com.ibm.CORBA,com.ibm

  2. Insert the property javax.portlet,javax.portlet.filter,javax.portlet.annotations after com.ibm.CORBA and before com.ibm.

  3. Save the file.

Once you’ve installed these dependencies and configured the config.ini file, start the server profile you created for Liferay DXP. Once it starts, you’re ready to configure your database.

Database Configuration

If you want WebSphere to manage the database connections, follow the instructions below. Note this is not necessary if you plan to use Liferay DXP’s standard database configuration; in that case, skip this section. You’ll set your database information in Liferay DXP’s setup wizard after the install.

Figure 3: WebSphere JDBC providers

Figure 3: WebSphere JDBC providers

  1. Start WebSphere.

  2. Open the Administrative Console and log in.

  3. Click Resources → JDBC Providers.

  4. Select a scope and then click New.

  5. Select your database type, provider type, and implementation type. If you select a predefined database, the wizard fills in the name and description fields for you. If the database you want to use isn’t listed, select User-defined from the Database type field and then fill in the Implementation Class Name. For example, if you use MySQL, select Database typeUser-defined, and then enter com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource in Implementation Class Name. Click Next when you are finished.

  6. Clear any text in the classpath settings. You already copied the necessary JARs to a location on the server’s classpath. Click Next.

  7. Review your settings and click Finish. The final configuration should look like this:

    Figure 4: Completed JDBC provider configurations.

    Figure 4: Completed JDBC provider configurations.

  8. Click your new provider configuration when it appears in the table, and then click Data Sources under Additional Properties. Click New.

  9. Enter liferaydatabasesource in the Data source name field and jdbc/LiferayPool in the JNDI name field. Click Next.

  10. Click Next in the remaining screens of the wizard to accept the default values. Then review your changes and click Finish.

  11. Click the data source when it appears in the table and then click Custom Properties. Now click the Show Filter Function button. This is the second from last of the small icons under the New and Delete buttons.

  12. Type user into the search terms and click Go.

    Figure 5: Modifying data source properties in WebSphere

    Figure 5: Modifying data source properties in WebSphere

  13. Select the user property and give it the value of the user name to your database. Click OK and save to master configuration.

  14. Do another filter search for the url property. Give this property a value that points to your database. For example, a MySQL URL would look like this:

    jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
    

    Click OK and save to master configuration.

  15. Do another filter search for the password property. Enter the password for the user ID you added earlier as the value for this property. Click OK and save to master configuration.

  16. Go back to the data source page by clicking it in the breadcrumb trail. Click the Test Connection button. It should connect successfully.

Once you’ve set up your database, you can set up your mail session.

Mail Configuration

If you want WebSphere to manage your mail sessions, use the following procedure. If you want to use Liferay DXP’s built-in mail sessions, you can skip this section.

Creating a WebSphere-Managed Mail Session (Optional)

  1. Click Resources → Mail → Mail Providers.

  2. Click the Built-In Mail Provider for your node and server.

  3. Click Mail Sessions and then click the New button.

  4. Give your mail session a name of liferaymail and a JNDI name of mail/MailSession. Fill in the correct information for your mail server in the sections Outgoing Mail Properties and Incoming Mail Properties. Click OK and then save to the master configuration.

  5. Click your mail session when it appears in the table and select Custom Properties under the Additional Properties section. Set any other JavaMail properties required by your mail server, such as the protocol, ports, whether to use SSL, and so on.

  6. Click Security → Global Security and de-select Use Java 2 security to restrict application access to local resources if it is selected. Click Apply.

Note that you may also need to retrieve a SSL certificate from your mail server and add it to WebSphere’s trust store. See WebSphere’s documentation for instructions on this.

Verifying WebSphere Mail Provider

To validate that the mail session has been configured correctly, there are a number of ways to test this once the WAR has been deployed, the server has started, and the user has signed in as the system administrator. One quick way to validate is to create a new user with a valid email account. The newly created user should receive an email notification. The logs should display that the SMTP server has been pinged with the correct port number listed.

Enable Cookies for HTTP Sessions

WebSphere restricts cookies to HTTPS sessions by default. If you’re using HTTP instead, this prevents users from signing in to Liferay DXP and displays the following error in the console:

20:07:14,021 WARN  [WebContainer : 1][SecurityPortletContainerWrapper:341]
User 0 is not allowed to access URL http://localhost:9081/web/guest/home and
portlet com_liferay_login_web_portlet_LoginPortlet

This occurs because Liferay DXP can’t use the HTTPS cookie when you use HTTP. The end result is that new sessions are created on each page refresh. Follow these steps to resolve this issue in WebSphere:

  1. Click Application Serversserver1Session Management → Enable Cookies

  2. De-select Restrict cookies to HTTPS sessions

  3. Click Apply

  4. Click Save

Enable UTF-8

If you did not add the -Dfile.encoding=UTF-8 property in the server.xml, you can do so in the Administrative Console.

  1. Click Application Serversserver1Process definition.

  2. Click Java Virtual Machine under Additional Properties.

  3. Enter -Dfile.encoding=UTF-8 in the Generic JVM arguments field.

  4. Click Apply and then Save to master configuration.

Once the changes have been saved, Liferay DXP can parse special characters if there is localized content.

Deploy Liferay DXP

Now you’re ready to deploy Liferay DXP!

  1. In WebSphere’s administrative console, click ApplicationsNew ApplicationNew Enterprise Application.

  2. Browse to the Liferay DXP .war file, select it, and click Next.

  3. Leave Fast Path selected and click Next. Ensure that Distribute Application has been checked and click Next again.

  4. Choose the WebSphere runtimes and/or clusters where you want Liferay DXP deployed. Click Next.

  5. Select the virtual host to deploy Liferay DXP on and click Next.

  6. Map Liferay DXP to the root context (/) and click Next.

  7. Select the metadata-complete attribute setting that you want to use and click Next.

  8. Ensure that you have made all the correct choices and click Finish. When Liferay DXP has installed, click Save to Master Configuration.

    Figure 6: Review your deployment options before deploying.

    Figure 6: Review your deployment options before deploying.

You’ve now installed Liferay DXP!

Setting the JDK Version for Compiling JSPs

Liferay DXP requires that its JSPs are compiled to the Java 8 bytecode format. To ensure that WebSphere does this, shut down WebSphere after you’ve deployed the Liferay DXP .war file. Navigate to the WEB_INF folder and add the following setting to the ibm-web-ext.xml or in most cases the ibm-web-ext.xmi file:

<jsp-attribute name="jdkSourceLevel" value="18" />

The exact path to the ibm-web-ext.xmi file depends on your WebSphere installation location and Liferay DXP version, but here’s an example:

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/localhostNode01Cell/applications/liferayXX.ear/deployments/liferayXX/liferayXX.war/WEB-INF/ibm-web-ext.xmi

Note that the Liferay DXP .war comes pre-packaged with the ibm-web-ext.xmi file; this format is functionally the same as .xml and WebSphere recognizes both formats. For more general information on how WebSphere compiles JSPs see IBM’s official documentation for WebSphere Application Server 8.5.5.x or WebSphere Application Server 9.0.0.x.

Now restart WebSphere.

Start Liferay DXP

  1. If you plan to use Liferay DXP’s setup wizard, skip to the next step. If you wish to use WebSphere’s data source and mail session, create a file called portal-ext.properties in your Liferay Home folder. Place the following configuration in the file:

     jdbc.default.jndi.name=jdbc/LiferayPool
     mail.session.jndi.name=mail/MailSession
     setup.wizard.enabled=false
    
  2. In the WebSphere administrative console, navigate to Enterprise Applications, select the Liferay DXP application, and click Start. While Liferay DXP is starting, WebSphere displays a spinning graphic. Don’t watch it too closely, or you might get hypnotized.

  3. In Liferay DXP’s setup wizard, select and configure your database type. Click Finish when you’re done. Liferay DXP then creates the tables it needs in the database.

Congratulations! You’ve installed Liferay DXP on WebSphere!

« Installing Liferay DXP on WebLogic 12c R2Installing Elasticsearch »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 1 de 1