
Ext Plugin
Intro #
Ext plugins provide the most advanced method of extending Liferay. This comes with some tradeoffs in complexity, and so Ext plugins are designed to be used only in special scenarios in which all other plugin types cannot meet the needs of the project.
Before deciding to use an Ext plugin it's important to understand the costs of using such a powerful tool. The main one is the cost in terms of maintenance. Because Ext plugins allow using internal APIs or even overwriting files provided in the Liferay core, it's necessary to review all the changes done when updating to a new version of Liferay (even if it's a maintenance version or a service pack). Also, unlike the other types of plugins, Ext plugins require the server to be restarted after deployment, as well as requiring additional steps when deploying or redeploying to production systems.
The main use cases in which an Ext plugin may be needed are:
Customizing portal.properties that are not supported by Hook Plugins Customizing Struts Actions Providing custom implementations for any of the Liferay beans declared in Liferay's Spring files (use service wrappers from a hook instead if possible) Adding JSPs that are referenced from portal properties that can only be changed from an ext plugin (be sure to check if the property can be modified from a hook plugin before doing this) Direct overwriting of a class (not recommended unless it's strictly necessary)
Documentation #
Liferay's developer's guide provides accurate and detailed documentation on how to develop and deploy an Ext plugin. Here are direct links to the chapter on Ext plugins:
Liferay 6.0 > Developer's Guide > Ext Plugins
Ext Plugin vs. Extension Environment #
Ext plugin is light-weight extension of the EXT environment. It use the same paradigms for the class loading and overriding as the old EXT. Light-weight means that you can download only < 10MB (whole Plugins SDK) instead of > 100MB (just old EXT).
FAQ #
For current bugs please see: Ext plugin on issues.liferay.com
Ext Plugin vs. Extlet #
Ext Plugin is not Extlet. Extlet was created in IBA CZ and it's an ancestor of the Ext Plugin.
The main difference is that Extlet is for Liferay 5.2.3 on Tomcat, Ext Plugin is for Liferay 6.
Empty ext-service.jar problem #
SEVERE: Exception processing JAR at resource path /data/opt/liferay-portal-6.0.2/tomcat-6.0.26/lib/ext/ext-ehlo-ext-service.jar in context java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:114) ...
The problem: the jar file is empty. Workaround: add some folder into your ext-plugin/docroot/WEB-INF/ext-service/src directory
cd plugins-sdk/ext/ehlo-ext mkdir mkdir docroot/WEB-INF/ext-service/src/META-INF ant war
Changes from ext-impl.jar are not applied #
The ext-impl.jar contains util- jars zipped inside:
unzip -l your-tomcat-install/webapps/ROOT/WEB-INF/lib/ext-ehlo-ext-impl.jar ... 22 06-10-10 22:02 com/liferay/portal/deploy/dependencies/ext-ehlo-ext-util-bridges.jar 22 06-10-10 22:02 com/liferay/portal/deploy/dependencies/ext-ehlo-ext-util-java.jar 22 06-10-10 22:02 com/liferay/portal/deploy/dependencies/ext-ehlo-ext-util-taglib.jar ...
Workaround: delete these jars after deploy from liferay, e.g.
zip -d your-tomcat-install/webapps/ROOT/WEB-INF/lib/ext-ehlo-ext-impl.jar "*.jar"
Ext Plugin can't be undeployed #
Ext Plugin can't be undeployed or even redeployed.
Workaround:
- call ant clean from your ext-plugin directory, see Ext plugin thread
- or delete ext plugin from your Tomcat (similar for any other app server, sometimes you must undeploy the web application, not just delete it)
- Linux - Tomcat:
cd your-tomcat-install # deleting web application rm -rf webapps/*-ext # deleting jars and config files from Liferay find -name "ext-*" | xargs rm -rf # stopping Liferay bin/shutdown.sh ps ax | grep life #... wait until life ends ;) ....# ps ax | grep life #... wait until life ends ;) ....# ps ax | grep life #... wait until life ends ;) ....# # Starting Liferay bin/startup.sh tail -f logs/catalina.out
- Windows - Tomcat: delete all following files & directory and reboot Tomcat (assuming your Ext Plugin is named ehlo-ext):
./webapps/ehlo-ext ./lib/ext/ext-ehlo-ext-service.jar ./webapps/ROOT/WEB-INF/lib/ext-ehlo-ext-util-bridges.jar ./webapps/ROOT/WEB-INF/lib/ext-ehlo-ext-util-taglib.jar ./webapps/ROOT/WEB-INF/lib/ext-ehlo-ext-util-java.jar ./webapps/ROOT/WEB-INF/lib/ext-ehlo-ext-impl.jar ./webapps/ROOT/WEB-INF/ext-ehlo-ext.xml ./temp/liferay/com/liferay/portal/deploy/dependencies/ext-ehlo-ext-util-bridges.jar ./temp/liferay/com/liferay/portal/deploy/dependencies/ext-ehlo-ext-util-taglib.jar ./temp/liferay/com/liferay/portal/deploy/dependencies/ext-ehlo-ext-util-java.jar
Related Information #
- Edward Shin blog entry: Creating Your First EXT Plugin
- Edward Shin blog entry: Upgrading Your EXT Environment to an EXT Plugin
- Forum: Ext environment and the Ext Plugin in 6.x
- Jonas Yuan blog entry: Hooks and plugin Ext in Liferay portal 6
- LPS-7355: Remove Ext environment in favor of the Ext Plugin
- LPS-6341: Ext environment is now available as a plugin
- Extlet Wiki
- Amos Fong blog entry: Minimizing the ext environment
- Ext plugin bugs on issues.liferay.com