Setting Up Liferay Portal on Websphere 7

This article is on how to deploy Liferay Portal on WebSphere 7

Resolution

Before making any changes to the Websphere application server, stop the server first! Failure to do so can cause errors.

The latest versions of Liferay Portal from 6.1 onwards allows hot deploys in Websphere. To configure this feature correctly, make sure that the auto.deploy.dest.dir is a separate directory from the liferay.home directory. (In other words, do NOT set liferay.home as C:/home and auto.deploy.dest.dir as C:/home/deploy; doing so will cause the deploy folder for both liferay.home and auto.deploy.dest.dir to be identical and will cause problems with plugin deployment).

Place the portal-ext.properties inside the Liferay.war file before deployment.

See Configuring the database within the Administrative Console if using JNDI to configure the database. Set the database properties inside the portal-ext.properties if using JDBC to connect.

Obtain the Required .jar and .war files

The following .jar files are required.

  • hsql.jar
  • portal-service.jar
  • portlet.jar

In addition, the following .jar files are also required.

  • jtds.jar
  • mysql.jar
  • persistance.jar
  • postgresql.jar
  • servlet-api.jar
  • activation.jar (only with mail integration)

  • mail.jar (only with mail integration)

Setting up Liferay on Websphere

1. Place the following .jar files in this location: C:\Program Files\IBM\Websphere\AppServer\lib\ext

  • hsql.jar
  • jtds.jar
  • mysql.jar
  • persistance.jar
  • portal-service.jar
  • postgresql.jar

2. Place the following .jar files in this location: C:\Program Files\IBM\Websphere\AppServer\java\jre\lib\ext

  • servlet-api.jar
  • portlet.jar

3. (Optional and only for use when specifically requiring mail integration): C:\Program Files\IBM\Websphere\AppServer\java\jre\lib\ext

  • activation.jar
  • mail.jar

4. Start the Websphere 7 Server by going to Start> Programs> IBM WebSphere> Application Server V7.0> Profiles> AppSrv01 and then click Start the Server

5.Start the Administrative Console by going to Start> Programs> IBM WebSphere> Application Server V7.0> Profiles> AppSrv01 and then click Administrative Console

6. Go to Applications> Application Types> WebSphere Enterprise Application. There are several applications already running. Check all applications and click Stop. Uninstall the default application because this will conflict with Liferay's default context root settings.

Configuring the MySQL Database Within the Administrative Console to Use JNDI Settings

By default, Liferay's MySQL connections in the portal.properties is a JDBC connection. However, users can also connect to a database through JNDI connections instead of purely JDBC. Using the JNDI, users have the options to set as PoolDataSource or XADataSource.

JNDI PoolDataSource Connection Steps

  1. Click "Resources" from the left drop down menu.
  2. Click "JDBC Providers"
  3. Select the third option that has both the node and the server from the Scope drop down.
  4. Click the New... button.
  5. Select the following:
    1. Database Type: User-defined
    2. Implementation class name: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
    3. Name: MySQL Provider
    4. Description: MySQL JNDI connection
  6. Click Next.
  7. Delete the value in the class path. This is because we will be using our own mysql.jar. Ensure that the mysql.jar file is already in its proper place in the WebSphere directory before starting the server.
  8. Click Next.
  9. Click the Finish button.
  10. Click Save.
  11. Assert that "MySQL Provider" now displays as a new JDBC provider.
  12. Click the newly created MySQL Provider.
  13. Click "Data Sources" under "Additional Properties".
  14. Click the New button.
  15. Enter "liferaydatabasesource" in the Data source name field.
  16. Enter "java_liferay:jdbc/LiferayPool" in the JNDI name field.
  17. Click Next for the next screens and leave the default values until the Summary page.
  18. Click Finish.
  19. Click Save.
  20. Assert that "liferaydatabasesource" now displays as a new data source.
  21. Click the "liferaydatabasesource" link.
  22. Click "Custom Properties" under "Additional Properties"
  23. Click the Show filter function. Search for the following then input the corresponding values:
    Filter: Name. Search terms"
    1. user - Value: root (blank for anonymous user)
    2. serverName - Value: Database IP Address or (localhost)
    3. databaseName - Value: database name
  24. Click OK.
  25. Click Save.

In the portal-ext.properties, add the following:

plugin.notifications.enabled=false

	jdbc.default.jndi.name=java_liferay:jdbc/LiferayPool
	
	liferay.home=
	
	auto.deploy.dest.dir=

This is in place of the default JDBC connections. It must be one or the other.

For JNDI and XA Datasource, there are several key differences. Notably, use the mysql-connector-java-5.1.25-bin.jar instead of the mysql.jar available from the source files. Second, specify the XA connection in the Implementation class name field.

  1. Click "Resources" from the left drop down menu.
  2. Click "JDBC Providers"
  3. Select the third option that has both the node and the server from the Scope drop down.
  4. Click the New... button.
  5. Select the following:
    1. Database Type: User-defined
    2. Implementation class name: com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.
    3. Name: MySQL Provider
    4. Description: MySQL JNDI connection
  6. Click Next.
  7. Delete the value in the class path. This is because we will be using our own mysql-connector-java-5.1.25-bin.jar. Ensure that the mysql-connector-java-5.1.25-bin.jar file is already in its proper place in the WebSphere directory before starting the server.
  8. Click Next.
  9. Click the Finish button.

Continue with the same steps in the JNDI section after this point.

WebSphere Optimization (Essential for proper function of Liferay in WebSphere)

Before starting Liferay, the user must "optimize" Websphere by changing several settings in the Java and Dynamic Cache Service. Changing these settings will allow Liferay to function properly without slowing down, crashing, or losing essential features like the dockbar or CKEditor.

Go to Application Servers> Server1> Java and Process Management> Process definition> Java Virtual Machine

  • Set Initial Heap Size = 256MB
  • Set Maxium Heap Size = 1024MB
  • Verbose garbage collection is set to true
  • Set Generic JVM argument: -Xk22000 -Xp64k,16k -Dfile.encoding=UTF-8

Go to Application Servers> server1> Container Services>Dynamic Cache Service

  • Set Cache Size = 3000
  • Set Default priority = 3

Go to Application servers > server1 > Web container > Custom properties

  • Name = com.ibm.ws.webcontainer.AllowQueryParamWithNoEqual
  • Value = true

Restart the server.

Setting up the Equifax Certificate for Mail Integration (Optional, but required when testing mail integration features using Gmail)

By default, WebSphere does not trust the Equifax Secure Certificate Authority that is used by the domain smtp.gmail.com. Thus, the certificate must be added to trust certificates in order for proper function of mail integration using Gmail.

1. Download the certificate from the following link:

https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Certificate_Authority.cer

2. In the Admin Console, go to "SSL certificate and key management", go to "Manage endpoint security configurations", select a node (either one should work), go to "Key stores and certificates", go to "NodeDefaultTrustStore", go to "Signer certificates".

3. Click "Add", type "equifax" as the alias, and enter in the path to the .cer file. Apply and save. The Equifax certificate will be added.

4. Make sure that the activation.jar and mail.jar files are added to the C:\Program Files\IBM\Websphere\AppServer\java\jre\lib\ext directory as mentioned above

Installing and starting Liferay

Once all the necessary steps have been taken, the application server is now ready to deploy Liferay. Install the liferay.war file as a new application and follow the prompts. Save to the master configuration and start Liferay. The portal will start on port 9080.

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助