Step 4 of 6
This tutorial shows you how to upgrade servlet-based portlets. It refers to
code from before and after upgrading a sample servlet-based portlet called
Sample JSON (project
sample-json-portlet). The portlet shows a Click me
link. When users click the link, the Liferay logo appears.
Follow these steps to upgrade a servlet-based portlet:
Adapt the portlet to Liferay DXP 7.2’s API using the Liferay Upgrade Planner. When running the planner’s Fix Upgrade Problems step, many of the existing issues are autocorrected. For remaining issues, the planner identifies code affected by the new API and ways to adapt it.
For an example upgrade scenario, consider this:
Some servlet-based portlets relied on Liferay Portal to provide several
dependency JAR files. Here’s the
portal-dependency-jars property from a sample
portal-dependency-jars=\ dom4j.jar,\ jabsorb.jar,\ json-java.jar
This property is deprecated in Liferay DXP 7.2 because importing and exporting Java packages has replaced wholesale use of JARs. This means modules and WABs can import packages without concerning themselves with JARs. Liferay DXP exports many third party packages for plugins to use. Best practices for using packages that Liferay DXP exports are found here.
Once you’ve deployed your portlet, the server prints messages that indicate the following portlet status:
- WAR processing
- WAB startup
- Availability to users
The portlet is installed to Liferay’s OSGi runtime and is available to users.
Congratulations! You’ve upgraded and deployed your servlet-based portlet to Liferay DXP 7.2.