Liferay.com

Wednesday, September 22, 2010

Deployment/Undeployment with Ext plugins environment

I found some weird behavior when i started working with ext plugins using Liferay version 6.0.5. These problems are related to deployment & undeployment of ext plugins.I thought it might be helpful to beginners of new liferay ext plugins.

You will be having files related to your each ext plugin under following places

Suppose for example i have created a ext plugin named "second"

1) You will be having some jars @ temp folder of your tomcat instance @ \temp\liferay\com\liferay\portal\deploy\dependencies

In my case,
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\temp\liferay\com\liferay\portal\deploy\dependencies\ext-second-ext-util-bridges.jar
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\temp\liferay\com\liferay\portal\deploy\dependencies\ext-second-ext-util-taglib.jar
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\temp\liferay\com\liferay\portal\deploy\dependencies\ext-second-ext-util-java.jar

2) You will be having jars related to each of your ext plugin @ \webapps\ROOT\WEB-INF\lib

In my case,
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\lib\ext-second-ext-util-bridges.jar
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\lib\ext-second-ext-util-taglib.jar
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\lib\ext-second-ext-util-java.jar
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\lib\ext-second-ext-impl.jar


3) xml file related to each ext plugin will be placed @ \webapps\ROOT\WEB-INF

In my case,
D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\WEB-INF\ext-second-ext.xml

4) Service file @ global class path of app server - \lib\ext\ext-second-ext-service.jar. Since this is a shared library/global class path you cannot undeploy when server is in running state.


D:\projects\liferay\rNd\liferay-portal-6.0.5\tomcat-6.0.26\lib\ext\ext-second-ext-service.jar

5) Once your ext plugin is deployed properly you may see some message some thing like below
[ExtHotDeployListener:188] Extension environment for "YOUR_EXT_PLUGIN_NAME" has been applied. You must reboot the server and redeploy all other plugin
s.



Copy the below code to a bat file, change tomcat_home according to your tomcat instance
> you need to send your ext plugin name as parameter , in my case "second"
> before redeploying stop the server & run the following command then redeploy

@echo off
set app_name=%1
if "%app_name%" == "" goto end
set tomcat_home=E:\Liferay605\bundles\tomcat-6.0.26
rmdir /S /Q %tomcat_home%\webapps\%app_name%-ext
del /S /Q %tomcat_home%\lib\ext\ext-%app_name%-ext-service.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-bridges.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-taglib.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-java.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-impl.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\ext-%app_name%-ext.xml
del /S /Q %tomcat_home%\temp\liferay\com\liferay\portal\deploy\dependencies\ext-%app_name%-ext-util-bridges.jar
del /S /Q %tomcat_home%\temp\liferay\com\liferay\portal\deploy\dependencies\ext-%app_name%-ext-util-taglib.jar
del /S /Q %tomcat_home%\temp\liferay\com\liferay\portal\deploy\dependencies\ext-%app_name%-ext-util-java.jar
:end
Please post your comments/feedback/suggestions on this topic if possible

12 comments:

  1. Thanks for explanations, Nagendra! This cleans-up things a bit. Will try and report how well this works.
    One possible suggestion I just thought about: its possible to modify EXT plugin build.xml to run "undeploy" task prior to deploy, since there is complete config about Tomcat (or other server) location present in parent build.xml! Doing so may make deployment/undeployment of EXT plugin quite transparent thing I think :)

    ReplyDelete
  2. Even i thought about that, one problem i found was we will have service related jar of ext plugin(s) in global class path of the server (tomcat or any other)which cannot be loaded/applied without restarting the server.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Anyway it's way better then redeploying ENTIRE Liferay Portal and re-applying EXT plugin after that. My ANT task works like charm, but 2 server restarts required in order to make EXT plugin active... Unfortunately, Liferay Plugin SDK isn't mature enough yet...

    ReplyDelete
  5. You are right ext plugins are not mature enough, it will take some time to come to certain level maturity.

    I can say ext plugins are not hot deployable as of now (It depends on what changes we have made even)

    We have problem if we try to deploy more than one ext plugin in Liferay 6.0.5,it is not able to merge ext related configuration files under ROOT\WEB-INF\ of tomcat deployment directory.

    ReplyDelete
  6. I share your pain.

    Ext Plugin isn't right now what it could be - I'm trying to be patient.

    If you are hungry for more info try to look at:
    http://www.liferay.com/community/wiki/-/wiki/Main/Ext+Plugin

    -- tom

    ReplyDelete
  7. Thomas, Thank you very much for details & link :)

    ReplyDelete
  8. Here is the link to patch for redeploy problems


    http://issues.liferay.com/browse/LPS-14221

    ReplyDelete
  9. Thanks Nagendra ...
    I've faced one another problem while using plugins-ext.
    When i removed the plugins-ext jar files created in tomcat/webapps/ROOT/WEB-INF/lib and when i redeploy it didn't copy all those jars again after restaring the server.

    Then i've found somewhere we've one ant task for ext-plugins that is "direct-deploy". When i've used it, jar files started copied using this ant target.

    Not sure what is the problem with deployment or i am doing anything wrong. But "direct-deploy" works for me.

    -
    Tejas

    ReplyDelete
  10. If you have any custom classes in ext plugin then there is problem with loading on first start of the server. JSP files its not a problem. Direct deploy i hope will work in that case

    ReplyDelete
  11. Hi everybody and thanks Nagendra for this topic.
    I have the same problem as TEJ. When I use direct deploy, I have all my jars copied to the WEB-INF/lib folder of my liferay instance, but I'd like to deploy the ext plugin on another server different from my development server. And when I just use the hot deploy it doesn't copy those jars, so I have to do it manually.

    Is it an issue or am I missing something?

    Thanks everybody for your answers.

    ReplyDelete
  12. Alex, redeployment is handled entirely in a different way when it comes to Ext plugins. Here is some notes from liferay doucumentation

    The direct-deploy target is faster because the changes are applied directly., while the Liferay server does it on start up if you use the deploy target. For that reason it is usually preferred during development.

    Check this for more info, http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/developing-an-ext-plugin

    ReplyDelete