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 添付ファイル
120368 参照数
平均 (4 投票)
平均評価は4.25星中の5です。
コメント
コメント 作成者 日時
I followed the instruction and after ant war, I... Puj Z 2010/06/12 12:33
The answer is that the .jar is empty. I am not... Puj Z 2010/06/14 5:08
ok, new problem: While using the Hello World... Puj Z 2010/06/14 6:24
Puj Z, Brian's hello world was just simple... Tomáš Polešovský 2010/06/14 13:24
Thanks Tom! I will try to modify it then.... Puj Z 2010/06/16 5:52
new Exlet (ext plugin) is a great idea... but... ilke Muhtaroglu 2010/07/02 4:32
The list of ext-impl files should also include... Tor Iver Wilhelmsen 2010/08/05 3:32
Has anyone experienced ext-plugin with Liferay... Sampsa Sohlman 2010/08/09 13:48
A lot of thanks to you Tomas for informative... Jakub Liska 2010/09/08 4:29
I was able to successfully upgrade the old ext... simeon mitev 2010/10/12 2:27
I have custom java class in ext plugin (under... Nagendra Kumar Busam 2010/10/29 8:54
Hi all..How to change liferay-ui.tld in... Ezhil Raja 2011/02/09 4:04
How should i edit Jsp file in extension... Ezhil Raja 2011/02/09 4:09
"Caused by: org.hibernate.HibernateException:... Ezhil Raja 2011/02/09 19:40
For liferay 6.0.5 you can undeploy using with... ibrahim çağlar 2011/04/14 2:49
acho que ainda nao entendi o que exatamente o... ricardo wolosker 2012/01/07 14:56
If we use maven, where we copy est-spring.xml? slimen Belhaj Ali 2014/12/29 7:38
ext-spring.xml should be inside ext-impl.jar... Tomáš Polešovský 2015/01/19 5:44

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!
投稿日時:10/06/12 12:33
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.
Puj Zへのコメント。投稿日時:10/06/14 5:08
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....
投稿日時:10/06/14 6:24
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
Puj Zへのコメント。投稿日時:10/06/14 13:24
Thanks Tom!
I will try to modify it then.
Cheer,
Pujan
Tomas Polesovskyへのコメント。投稿日時:10/06/16 5:52
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
投稿日時:10/07/02 4:32
The list of ext-impl files should also include portal-ext.properties, even though there is an empty such file there already.
投稿日時:10/08/05 3:32
Has anyone experienced ext-plugin with Liferay 5.2 EE sp3 and sp4
投稿日時:10/08/09 13:48
A lot of thanks to you Tomas for informative stuff like this...I wish there was more documentation like this one
投稿日時:10/09/08 4:29
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?
Jakub Liskaへのコメント。投稿日時:10/10/12 2:27
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
投稿日時:10/10/29 8:54
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 ?
投稿日時:11/02/09 4:04
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 ?
投稿日時:11/02/09 4:09
"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...
投稿日時:11/02/09 19:40
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
投稿日時:11/04/14 2:49
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?
ibrahim çağlarへのコメント。投稿日時:12/01/07 14:56
If we use maven, where we copy est-spring.xml?
投稿日時:14/12/29 7:38
ext-spring.xml should be inside ext-impl.jar META-INF directory:

unzip -l ext-impl.jar
Archive: ext-impl.jar
Length Date Time Name
--------- ---------- ----- ----
...
0 2012-10-24 12:14 META-INF/
499 2012-10-24 12:14 META-INF/ext-spring.xml
...
slimen Belhaj Aliへのコメント。投稿日時:15/01/19 5:44