Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Tomas Polesovsky
Ext Plugin undeploy and redeploy proposal
December 3, 2010 2:10 PM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

Hi,

currently I'm trying to extend Ext Plugin to be more usable (see also LPS-9442).

As part of it I'm thinking of how to achieve undeploy and redeploy of Ext Plugin some more "standard way", because many developers are fighting with this issue.

Undeploy

The most simple solution for undeploy I see:
1, Display installed Ext plugins in Control Panel -> Installed Plugins section
2, There can be "Uninstall" button for each installed Ext Plugin

Undeploy process then consists of:
- removing all JARS copied during Ext Plugin deploy
- again merge web.xml from scratch using all currently installed Ext Plugins
- container restart

Redeploy

Redeploy is more tricky, because it is hard to distinguish the "redeploy" action in servlet containers from "stop" and "start" container events (redeploy means: to stop and start the web app, which also means: I want to stop server and then start the server emoticon ).

Therefore simple solution is to:
- manually uninstall Ext Plugin using method above
- container restart
- then simply deploy new version of Ext Plugin

Automatic solution 1:
- ignore standard undeploy event, just flag that there was such attempt
- in deploy phase check for undeploy flag (which cannot persist container reboot) and if so then do redeploy

Automatic solution 2:
- ignore standard undeploy event
- in deploy phase check modification time of files (installed vs. to be installed) and redeploy only in case that files were updated
- here redeploy also need to update portal files modification time to be the same as WARs'

--------------------------------

Do you see another possible solutions? I'm open for every suggestion.

Thank you.

-- tom
Louis Sacco
RE: Ext Plugin undeploy and redeploy proposal
December 6, 2010 5:17 PM
Answer

Louis Sacco

Rank: New Member

Posts: 4

Join Date: January 28, 2010

Recent Posts

It would probably be a bit messy to do, but I think having a custom classloader where you could deploy the EXT plugin into and then as easily wipe/redeploy new files would be ideal. Another approach of course would be OSGi.

Otherwise, you're left we restarting the server everytime.

You may want to take a look at Java Rebel as this is exactly the sort of thing they do for reloading classes that have been changed. In the meantime, I posted this to remove the appropriate files much like you describe in the undeploy portion of your post.
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 7, 2010 3:53 AM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

I don't see solution to have custom classloader. There are portal-service.jar and other Ext plugin's service jars that are put into container's classloader (to be visible to other web applications).

1, Thus for every app. server where Liferay is running you need to somehow override server's class loading - which is IMHO not possible, or is at least very difficult to prepare configuration for every server (not mentioning existing environments with all server version).

2, You can bypass it and don't put *-service jars into container, but only if you deploy portlets to Liferay and not parent servlet container. I.e. portlets should NOT be maintained by app. server but by Liferay itself => Liferay becomes servlet container. That's too complicated.

3, Third option is that *-service jars are not in container's classloader and are shared among sibling web-apps classloaders, which means to hack standard classloaders' semantics. That's not right solution.

4, Then you can also extend Spring context to be shared among portlets in different web apps.
The problem here is that you will reference portal services => they can't be destroyed by GC unless you stop and start all portlets. That's also not very good solution.

Maybe there is another solution for custom classloader, but I don't see it right now emoticon

AFAIK Java Rebel use Java Agent for byte code instrumentation. That means for me possible problems in production system and I don't have any reference for JRebel there.

EDIT: Can OSGi solve these problems? I don't know if OSGi can solve these classloader reference problems. I can imagine to build new system based on OSGi, but extending current system could be at least time consuming (not taking into account existing free plugins and other plugins that companies have).

But maybe you see the way...

-- tom
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 16, 2010 1:11 PM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

I've implemented Automatic Solution 1.

See LPS-14221
Artur Linhart
RE: Ext Plugin undeploy and redeploy proposal
December 8, 2010 6:48 AM
Answer

Artur Linhart

Rank: Expert

Posts: 458

Join Date: September 13, 2007

Recent Posts

Hi, Tomáši,

it sounds good, thank You. :-)

Do You know how it will work in the case of the clustered environment?
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 8, 2010 7:31 AM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

Hi Arture

I suppose the same way as other plugins work.

That means:
1, If app. server is able to distribute deployed applications, then it distribute appliction to every node. Node then stops Ext Plugin web app., install new version and starts Ext Plugin, which triggers redeploy.

2, If app. server doesn't support plugins distribution, then administration need to deploy it on every node by hand.

EDIT: But I think it will be now easier to deploy new version in production - you don't need to reinstall the bundle. emoticon

-- tom
Nagendra Kumar Busam
RE: Ext Plugin undeploy and redeploy proposal
December 14, 2010 5:08 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 638

Join Date: July 7, 2009

Recent Posts

Hi Tomas,

It's really great work which helps lots of developers working with LR 6+.Can we use it with Liferay 6.0.5 CE?

Regards,
- Nagendra Kumar
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 15, 2010 7:59 AM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

Hi,

I think it could work - just drop the JAR into your tomcat/ROOT/WEB-INF/lib directory.

The implementation assumes that you use WAR file deployment. I.e. put your Ext Plugin WAR file into deploy directory.

-- tom
Nagendra Kumar Busam
RE: Ext Plugin undeploy and redeploy proposal
December 16, 2010 3:21 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 638

Join Date: July 7, 2009

Recent Posts

Hi Tomas,

I did the same, added the jar to tomcat/ROOT/WEB-INF/lib & started the server. I am getting following error

18:32:09,937 INFO [ExtHotDeployListener:162] Registering extension environment for test-ext
18:32:09,937 ERROR [HotDeployUtil:112] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering extension environment for test-ext
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering extension environment for test-ext
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:45)
at com.liferay.portal.deploy.hot.ExtHotDeployListener.invokeDeploy(ExtHotDeployListener.java:58)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:109)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:182)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:38)
at com.liferay.portal.kernel.servlet.ExtContextListener.contextInitialized(ExtContextListener.java:36)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: com/liferay/portal/kernel/servlet/taglib/FileAvailabilityUtil
at com.liferay.portal.deploy.hot.ExtHotDeployListener.doInvokeDeploy(ExtHotDeployListener.java:225)
at com.liferay.portal.deploy.hot.ExtHotDeployListener.invokeDeploy(ExtHotDeployListener.java:55)
... 20 more
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.kernel.servlet.taglib.FileAvailabilityUtil
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
... 22 more


I checked there is no file by name FileAvailabilityUtil

If you can make it work for CE that will be of great use.

Regards,
- Nagendra Kumar
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 16, 2010 1:10 PM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

Hi,

I've patched it for Liferay 6.0.5 CE - see ext-redeploy-6.0.5.jar

Enjoy emoticon

-- tom
Nagendra Kumar Busam
RE: Ext Plugin undeploy and redeploy proposal
December 17, 2010 1:04 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 638

Join Date: July 7, 2009

Recent Posts

Hi Tomas,

Thank you very much, it's working fine with LR CE 6.0.5 as well. You Rock emoticon

- Nagendra Kumar
Piotr Filipowicz
RE: Ext Plugin undeploy and redeploy proposal
December 17, 2010 2:26 AM
Answer

Piotr Filipowicz

Rank: Junior Member

Posts: 52

Join Date: November 18, 2010

Recent Posts

Great job!

Thanks Tomas.
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 17, 2010 4:40 AM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

Thank you.

Glad to help you ;)

If you encounter any errors get back to me so as I can fix it.

-- tom
Szymon Gołębiewski
RE: Ext Plugin undeploy and redeploy proposal
December 17, 2010 5:00 AM
Answer

Szymon Gołębiewski

Rank: Regular Member

Posts: 247

Join Date: June 8, 2009

Recent Posts

You should put it in liferay-portal->community-plugins emoticon
Milan Jaroš
RE: Ext Plugin undeploy and redeploy proposal
December 21, 2010 3:45 AM
Answer

Milan Jaroš

Rank: Expert

Posts: 269

Join Date: August 18, 2008

Recent Posts

Ahoj Tomáši,
Thank you for your effort - this sound really great.

As I can see you've marked this issue as a Community resolved but I'm not sure if this good idea. Maybe you should notice Brian or Jorge.
Tomas Polesovsky
RE: Ext Plugin undeploy and redeploy proposal
December 22, 2010 4:01 AM
Answer

Tomas Polesovsky

LIFERAY STAFF

Rank: Liferay Master

Posts: 598

Join Date: February 13, 2009

Recent Posts

Ahoj ;)

thank you. They both know about it ;)

-- tom