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:

  1. call ant clean from your ext-plugin directory, see Ext plugin thread
  2. or delete ext plugin from your Tomcat (similar for any other app server, sometimes you must undeploy the web application, not just delete it)
    1. 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
    1. 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 #

0 Attachments
75356 Views
Average (4 Votes)
The average rating is 4.25 stars out of 5.
Comments
Threaded Replies Author Date
I followed the instruction and after ant war, I... Puj Z June 12, 2010 12:33 PM
The answer is that the .jar is empty. I am not... Puj Z June 14, 2010 5:08 AM
ok, new problem: While using the Hello World... Puj Z June 14, 2010 6:24 AM
Puj Z, Brian's hello world was just simple... Tomas Polesovsky June 14, 2010 1:24 PM
Thanks Tom! I will try to modify it then.... Puj Z June 16, 2010 5:52 AM
new Exlet (ext plugin) is a great idea... but... ilke Muhtaroglu July 2, 2010 4:32 AM
The list of ext-impl files should also include... Tor Iver Wilhelmsen August 5, 2010 3:32 AM
Has anyone experienced ext-plugin with Liferay... Sampsa Sohlman August 9, 2010 1:48 PM
A lot of thanks to you Tomas for informative... Jakub Liska September 8, 2010 4:29 AM
I was able to successfully upgrade the old ext... simeon mitev October 12, 2010 2:27 AM
I have custom java class in ext plugin (under... Nagendra Kumar Busam October 29, 2010 8:54 AM
Hi all..How to change liferay-ui.tld in... Ezhil Raja February 9, 2011 4:04 AM
How should i edit Jsp file in extension... Ezhil Raja February 9, 2011 4:09 AM
"Caused by: org.hibernate.HibernateException:... Ezhil Raja February 9, 2011 7:40 PM
For liferay 6.0.5 you can undeploy using with... ibrahim çağlar April 14, 2011 2:49 AM
acho que ainda nao entendi o que exatamente o... ricardo wolosker January 7, 2012 2:56 PM

I followed the instruction and after ant war, I did ant deploy, which was successful, but when starting tomcat, I get this exception three times:

SCHWERWIEGEND: Exception processing JAR at resource path C:\www6.0\tomcat-6.0.26\lib\ext\ext-service.jar in context /tunnel-w
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:203)
at java.util.jar.JarFile.<init>(JarFile.java:132)
at java.util.jar.JarFile.<init>(JarFile.java:97)
at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:346)

I did not do the installation part (copy the war to the deploy folder, because I thought ant deploy should actually do all the necessary copying.

I appreciate any helps!
Posted on 6/12/10 12:33 PM.
The answer is that the .jar is empty.
I am not sure if this is an issue or not, but I guess it's better to be able to run an empty ext.
Posted on 6/14/10 5:08 AM in reply to Puj Z.
ok, new problem:

While using the Hello World ext that Brian has offered as the sample Extlet, I see the following error in eclipse for ext-util-taglib\src\com\liferay\taglib\util:
StringServletResponse stringResponse = getServletResponse();
The method getServletResponse() is undefined for the type IncludeTag

I am using all the necessary lib files plus jdk1.6

Should I add any new libraries in addition to what is in $CATALINA_HOME\webapps\ROOT\WEB-INF\lib
AND
$CATALINA_HOME\lib
and
$CATALINA_HOME\lib\ext
?

It's confusing....
Posted on 6/14/10 6:24 AM.
Puj Z,

Brian's hello world was just simple illustration of the possibilities. I think nowadays the trunk code has slightly changed. Try to use the SVN revision that Brian mentioned:

Use the latest /portal/trunk and /plugins/trunk as of rev 42007.

-- tom
Posted on 6/14/10 1:24 PM in reply to Puj Z.
Thanks Tom!
I will try to modify it then.
Cheer,
Pujan
Posted on 6/16/10 5:52 AM in reply to Tomas Polesovsky.
new Exlet (ext plugin) is a great idea...

but now how to work within eclipse ? I can not import the new ext plugin into Eclipse easily.

It is just a bunch of folder, and when I try to import it as a folder into a empty java project, those directories without file inside are not created in eclipse! After running ant deploy i get error regarding these missing folders.

Any guidance to have to have new extlet in eclipse environment.

I use eclipse helios and ubuntu with liferay 6.02

ilke
Posted on 7/2/10 4:32 AM.
The list of ext-impl files should also include portal-ext.properties, even though there is an empty such file there already.
Posted on 8/5/10 3:32 AM.
Has anyone experienced ext-plugin with Liferay 5.2 EE sp3 and sp4
Posted on 8/9/10 1:48 PM.
A lot of thanks to you Tomas for informative stuff like this...I wish there was more documentation like this one
Posted on 9/8/10 4:29 AM.
I was able to successfully upgrade the old ext to the new plugin-ext but when I try to build it I get approx. 70 "package does not exist" errors:

...
C:\liferay-plugins-sdk-6.0.5\ext\kopiwa-ext\docroot\WEB-INF\ext-service\src\com\­liferay\portlet\tags\service\persistence\TagsAssetFinderUtil.java:85
: package com.liferay.portlet.tags.model does not exist
public static java.util.List<com.liferay.portlet.tags.model.TagsAsset> findByOrEntryIds(
...

The package really do not exist in any of the jars copied to the ext.

What could be the problem?
Posted on 10/12/10 2:27 AM in reply to Jakub Liska.
I have custom java class in ext plugin (under ext-impl), when i deploy ext plugin second time after undeploying using the steps mentioned @ the end of the article. It was throwing following error

18:57:27,093 ERROR [RequestProcessor:296] No action instance for path /custom_layout_configuration/view could be created
java.lang.ClassNotFoundException: com.xyz.portlet.addapplication.ViewCustomCategorizedPortletsAction

I am getting this error repeatedly for first time after every deployment, if i restart server again i am not seeing any error

how can i avoid this, thanks in advance
Posted on 10/29/10 8:54 AM.
Hi all..How to change liferay-ui.tld in extension environment.Can i edit directly in liferay-portal-6.0-ee\tomcat-6.0.29\webapps\ROOT\WEB-INF\tld ?
Posted on 2/9/11 4:04 AM.
How should i edit Jsp file in extension environment.I have put my jsp file inside /ehlo-world-ext/docroot/WEB-INF/ext-web/docroot/ROOT/html/portlet/message_boards­ (am modifying file related to message_boards).Even though it took the change inside ehlo-world-ext(webapps)...not refleting in browser. Am i doing in correct way ?
Posted on 2/9/11 4:09 AM.
"Caused by: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"

This happens when I happen to use ext-impl.

The approach I took is to copy the changed classes itself to ext-impl and not extend them.

Thanks...
Posted on 2/9/11 7:40 PM.
For liferay 6.0.5 you can undeploy using with ant.
You should add this script to build.xml

<target name="undeploy" depends="clean-ext" >
<property name="app.name" value="${app.name}"></property>
<property name="tomcat.home" value="${tomcat.name}"></property>
<echo>Application Name :"${app.name}"</echo>
<echo>Catalina Home :"${tomcat.home}\webapps\${app.name}-ext"</echo>

</target>
<target name="clean-ext">
<delete includeemptydirs="true">
<fileset dir="${tomcat.home}\webapps\${app.name}-ext" includes="**/*" />

</delete>
<echo>Deleting util-bridges.jar</echo>
<delete file="${tomcat.home}\webapps\ROOT\WEB-INF\lib\ext-${app.name}-ext-util-bridges.j­ar"></delete>
<echo>Deleting util-taglib.jar</echo>
<delete file="${tomcat.home}\webapps\ROOT\WEB-INF\lib\ext-${app.name}-ext-util-taglib.ja­r"></delete>
<echo>Deleting util-java.jar</echo>
<delete file="${tomcat.home}\webapps\ROOT\WEB-INF\lib\ext-${app.name}-ext-util-java.jar"­></delete>
<echo>Deleting ext-impl.jar</echo>
<delete file="${tomcat.home}\webapps\ROOT\WEB-INF\lib\ext-${app.name}-ext-impl.jar"></de­lete>
<echo>Deleting ext-"${app.name}"-ext.xml</echo>
<delete file="${tomcat.home}\webapps\ROOT\WEB-INF\ext-${app.name}-ext.xml"></delete>
<­delete file="${tomcat.home}\temp\liferay\com\liferay\portal\deploy\dependencies\ext-${a­pp.name}-ext-util-bridges.jar"></delete>
<delete file="${tomcat.home}\temp\liferay\com\liferay\portal\deploy\dependencies\ext-${a­pp.name}-ext-util-taglib.jar"></delete>
<delete file="${tomcat.home}\temp\liferay\com\liferay\portal\deploy\dependencies\ext-${a­pp.name}-ext-util-java.jar"></delete>

</target>
--------------------------
and create build.properties and put properties as above
app.name=YourAppName
tomcat.home=C\:\\Java\\Liferay\\Liferay-portal-6.0.5\\t­omcat-6.0.26

That's it. Enjoy
Posted on 4/14/11 2:49 AM.
acho que ainda nao entendi o que exatamente o Ext faz. Por exemplo, e se eu quiser implementar um dialeto SQLite, qual classe deveria ser implementada?
Posted on 1/7/12 2:56 PM in reply to ibrahim çağlar.