IBM ® WebSphere ® is a trademark of International Business Machines Corporation, registered in many jurisdictions worldwide.
For Liferay DXP to work correctly, WebSphere 9 (Fix Pack 11 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.
Now, download the Liferay DXP WAR and Dependency JARs:
- Liferay DXP WAR file
- Dependencies ZIP file
- OSGi Dependencies ZIP file
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
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.
Click Create…, choose Application Server, and then click Next.
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.
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.
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.
Choose node, server, and host names for your server. These are specific to your environment. Click Next.
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.
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.
Once the certificates are generated, set a password for your keystore. Click Next.
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.
Choose whether to start this profile when the machine starts. Click Next.
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.
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.
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
properties in your WebSphere application server:
com.ibm.ws.webcontainer.initFilterBeforeInitServlet = true com.ibm.ws.webcontainer.invokeFilterInitAtStartup = true
webcontainer properties in the WebSphere application server, follow the
instructions here in WebSphere’s
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:
maximumHeapSize="2560" inside the
jvmEntries tag. For example:
<jvmEntries xmi:id="JavaVirtualMachine_1183122130078" ... maximumHeapSize="2560">
Administrators can set the UTF-8 properties in the
<jvmEntries genericJvmArguments=.../> attribute in
server.xml. This is required or else
special characters will not be parsed correctly. Set the maximum and minimum
heap sizes to
2560m there too. Add the following inside the
<jvmEntries xmi:id="JavaVirtualMachine_1183122130078" ...genericJvmArguments="-Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xms2560m -Xmx2560m">
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
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
secureSessionCookie tag containing
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:
Unzip the Dependencies ZIP file and place its contents in your WebSphere application server’s
[Install Location]/WebSphere/AppServer/lib/extfolder. If you have a JDBC database driver
JAR, copy it to this location as well.
From the same archive, copy
[Install Location]/WebSphere/AppServer/javaextfor WebSphere 9.0.0.x. WebSphere already contains an older version of
portlet.jarwhich must be overridden at the highest class loader level. The new
portlet.jar(version 3) is backwards-compatible.
Unzip the OSGi Dependencies ZIP file and place its contents in the
[Liferay Home]/osgifolder (create this folder if it doesn’t exist). This is typically
Ensuring that Liferay DXP’s portlet.jar is loaded first
In addition to placing the
portlet.jar in the correct folder, you must
config.ini file so that it is loaded first. Navigate to
Find the property
Insert the property
Save the file.
Once you’ve installed these dependencies and configured the
start the server profile you created for Liferay DXP. Once it starts, you’re ready
to configure your database.
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. See the Using the Built-in Data Sources section for more article.
You’ll set your database information in Liferay DXP’s setup wizard after the install.
Open the Administrative Console and log in.
Click Resources → JDBC Providers.
Select a scope and then click New.
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 type → User-defined, and then enter
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSourcein Implementation Class Name. Click Next when you are finished.
Clear any text in the class path settings. You already copied the necessary JARs to a location on the server’s class path. Click Next.
Review your settings and click Finish. The final configuration should look like this:
Click your new provider configuration when it appears in the table, and then click Data Sources under Additional Properties. Click New.
Enter liferaydatabasesource in the Data source name field and
jdbc/LiferayPoolin the JNDI name field. Click Next.
Click Next in the remaining screens of the wizard to accept the default values. Then review your changes and click Finish.
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.
Type user into the search terms and click Go.
Select the user property and give it the value of the user name to your database. Click OK and save to master configuration.
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:
Click OK and save to master configuration.
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.
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.
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. See the Configuring Mail article on how to use Liferay DXP’s built-in mail sessions.
Creating a WebSphere-Managed Mail Session (Optional)
Click Resources → Mail → Mail Providers.
Click the Built-In Mail Provider for your node and server.
Click Mail Sessions and then click the New button.
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.
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.
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:
Click Application Servers → server1 → Session Management → Enable Cookies
De-select Restrict cookies to HTTPS sessions
If you did not add the
-Dfile.encoding=UTF-8 property in the
can do so in the Administrative Console.
Click Application Servers → server1 → Process definition.
Click Java Virtual Machine under Additional Properties.
-Dfile.encoding=UTF-8in the Generic JVM arguments field.
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!
In WebSphere’s administrative console, click Applications → New Application → New Enterprise Application.
Browse to the Liferay DXP
.warfile, select it, and click Next.
Leave Fast Path selected and click Next. Ensure that Distribute Application has been checked and click Next again.
Choose the WebSphere runtimes and/or clusters where you want Liferay DXP deployed. Click Next.
Select the virtual host to deploy Liferay DXP on and click Next.
Map Liferay DXP to the root context (
/) and click Next.
Select the metadata-complete attribute setting that you want to use and click Next.
Ensure that you have made all the correct choices and click Finish. When Liferay DXP has installed, click Save to Master Configuration.
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
.war file. Navigate to the
WEB_INF folder and add the following
setting to the
ibm-web-ext.xml or in most cases the
<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:
Note that the Liferay DXP
.war comes pre-packaged with the
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
Start Liferay DXP
If you plan to use Liferay DXP’s [setup
wizard](/docs/7-2/deploy/-/knowledge_base/d/installing-product#using-the-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.propertiesin 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
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.
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!