Notes on how to install a portlet on Liferay
- Install Liferay, if you haven't done so already.
- Get/Create a deployment script. For example:
- Download portlet-deployer ant build
- You may need to (ahem) improve the ant build file:
- Read: Directions for setting up Hot Deploy
- Edit the ant file to set up some filepaths for your local system. This is described in the above directions.
- Note: You will also have to add paths to the classpath in the build.xml as otherwise it will be missing libraries. I've attached variants of the file to this page:
- portlet-deployer-3.6.0.xml - original
- build.xml - my version
- portlet-deployer-3.6.0.xml.diff - diff of those two files
- Create a deploy directory. (I chose to make my deploy directory a child of my tomcat directory.)
- Copy the portlet war to the deploy directory.
- Copy the deployment build file to the deploy directory.
- Run your deployment script. (For example: ant deploy -Dportlet=search-confluence-portlet)
- This will create a new directory in your tomcat/webapps directory where this portlet will live.
- You will need to add liferay specific libraries to this directory. More on that later.
- Use the portal application to load and interact with the portlet.
- Liferay example:
- You should not need to restart tomcat for the deployment script to work. (It's a Hot Deploy script.)
- Launch Liferay in a browser, and sign in.
- Add content by:
- mousing over the Liferay logo in the upper right corner
- Clicking the + (plus) logo.
- A popup of addable content will launch.
- Look for the new portlet in the Undefined category.
- Click the add button.
- Close the addable content button.
- Most likely, it will say: Portlet is temporary unavailable. This message occurs when the portlet is having server side errors. (Remember, we're missing necessary liferay libraries.)
- So, check the logs for help on figuring out what you're missing. The log you're interested is located in tomcat/logs/catalina.out. Possible errors might be:
- File "/WEB-INF/tld/liferay-portlet.tld" not found. Solution:
- cp webapps/ROOT/WEB-INF/tld/liferay-portlet.tld webapps/my-confluence-portlet/WEB-INF/tld/.
- java.lang.ClassNotFoundException: com.liferay.taglib.portlet.ActionURLTei. solution:
- cp webapps/ROOT/WEB-INF/lib/util-taglib.jar webapps/my-confluence-portlet/WEB-INF/lib/.
- NoClassDefFoundError: com/liferay/util/Validator. solution:
- cp webapps/ROOT/WEB-INF/lib/util-java.jar webapps/my-confluence-portlet/WEB-INF/lib/.
- Restart tomcat after any library changes.
- Refresh the Liferay page in your browser.
- Liferay example:
