Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » WTP Tomcat hot deploy with m2eclipse
WTP Tomcat hot deploy with m2eclipse [message #523599] Sat, 27 March 2010 05:48 Go to next message
Hieu Lam is currently offline Hieu Lam
Messages: 3
Registered: March 2010
Junior Member
Hi all,

I am using m2eclipse with tomcat WTP Server plugin. My main web application depends on other java projects (jar module) and for now whenever I make some changes in these java project, I have to publish and stop/start server which is time consuming and slow down the development process. Is there anyway that tomcat can hot deploy these jar, I think whenever I build using m2eclipse it will generated updated .jar file. I hope there is a way that these jar can be hot deployed in to the web app without restart require ? I have been chasing this solution for a while but I can't not find on.

Any help is really really aprreciated.
Re: WTP Tomcat hot deploy with m2eclipse [message #523875 is a reply to message #523599] Mon, 29 March 2010 17:06 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
Hieu Lam wrote:
> Hi all,
> I am using m2eclipse with tomcat WTP Server plugin. My main web
> application depends on other java projects (jar module) and for now
> whenever I make some changes in these java project, I have to publish
> and stop/start server which is time consuming and slow down the
> development process. Is there anyway that tomcat can hot deploy these
> jar, I think whenever I build using m2eclipse it will generated updated
> .jar file. I hope there is a way that these jar can be hot deployed in
> to the web app without restart require ? I have been chasing this
> solution for a while but I can't not find on.
> Any help is really really aprreciated.

With the class loading provided by Tomcat, there is no hot jar
deployment. The webapp's current class loader has to be discarded and
an new one created to load the updated class. However, if reloading is
enabled on the context, then updating a jar will trigger automatic
reloading of the webapp. The reload is handled by a background thread
in Tomcat and should start the reload within about 5 seconds. If the
reload is successful, you can continue testing your webapp and ignore
the fact that the Servers view indicates Tomcat should Restart. The
Tomcat support in WTP isn't able to track the fact that Tomcat
internally reloaded the webapp.

How much time this approach will save over restarting Tomcat will
depend. Be aware there are issues with this approach. First, the old
version of the webapp is likely to leak memory to some degree. How many
times you can restart before running out of heap depends on your memory
parameters and your webapp. Only being able to restart a few times is
not unheard of. The newest versions of Tomcat 6.0.x make an extra
effort to avoid this, but success will depend on your webapp. Also,
Tomcat will try to restore HTTP sessions across the reload, which may or
may not be completely successful. Depending on what changed, there can
be issues with respect to classes that remain in memory during the
reload. As a result, if you see any odd behavior, first try restarting
Tomcat to see if that clears up the behavior before assuming it's a bug
in the webapp.

Are you able to use the "Serve Modules Without Publishing" option in the
Tomcat server editor? I'm not that familiar with m2eclipse to know if
it doesn't something in a way that would prevent that option from
working? With that option enabled, you have the possibility of using
the hot code replacement available in debug mode.

Cheers,
Larry
Re: WTP Tomcat hot deploy with m2eclipse [message #526027 is a reply to message #523875] Thu, 08 April 2010 14:50 Go to previous messageGo to next message
Hieu Lam is currently offline Hieu Lam
Messages: 3
Registered: March 2010
Junior Member
Thank you so much for reply Larry. It's a pity to hear Tomcat don't support jar hot deploy Sad Sad I remembered working on Weblogic and use a server plugin for Weblogic and it can hot deploy any thing. So how about if I delete the jar in the lib folder and choose to output the jar project .class files directly to WEB-INF/classes folder ? Does Tomcat support hot deploy for .class files ?
Re: WTP Tomcat hot deploy with m2eclipse [message #526120 is a reply to message #526027] Thu, 08 April 2010 18:16 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
Hieu Lam wrote:
> Thank you so much for reply Larry. It's a pity to hear Tomcat don't
> support jar hot deploy :( :( I remembered working on Weblogic and use
> a server plugin for Weblogic and it can hot deploy any thing. So how
> about if I delete the jar in the lib folder and choose to output the jar
> project .class files directly to WEB-INF/classes folder ? Does Tomcat
> support hot deploy for .class files ?

If you enable the "Serve Modules Without Publishing" option, then a
special jar is added to the Tomcat server which allows the Tomcat
support in WTP to control the "classpath" of the web application. Also,
utility projects are not assembled in to jars. Instead, the Java output
folder(s) of the utility projects are included in the "classpath" of the
web application, effectively serving the class files directly. If you
disable the auto-loading for the context, and run in debug mode, changes
you make to classes can be hot-code-replaced so the context doesn't have
to reload. I believe this will accomplish what you are looking for.

Cheers,
Larry
Re: WTP Tomcat hot deploy with m2eclipse [message #527673 is a reply to message #526120] Fri, 16 April 2010 05:27 Go to previous messageGo to next message
Hieu Lam is currently offline Hieu Lam
Messages: 3
Registered: March 2010
Junior Member
Thanks so much Larry, I will give it a try.
Re: WTP Tomcat hot deploy with m2eclipse [message #543364 is a reply to message #527673] Tue, 29 June 2010 08:34 Go to previous messageGo to next message
Paul Greyson is currently offline Paul Greyson
Messages: 2
Registered: June 2010
Junior Member
This approach is working well for me.

However, I wonder can anyone explain the value of the -Dwtp.deploy argument? After choosing "Serve Modules Without Publishing" this setting is changed in my .launch file. But the folder that is passed as an argument does not actually contain my web application. So I'm a bit mystified.

Thanks.

Re: WTP Tomcat hot deploy with m2eclipse [message #543578 is a reply to message #543364] Tue, 29 June 2010 20:18 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
On 6/29/2010 4:34 AM, Paul Greyson wrote:
> This approach is working well for me.
>
> However, I wonder can anyone explain the value of the -Dwtp.deploy
> argument? After choosing "Serve Modules Without Publishing" this setting
> is changed in my .launch file. But the folder that is passed as an
> argument does not actually contain my web application. So I'm a bit
> mystified.
>
> Thanks.
>
>

"wtp.deploy" is a convenience system property for use in policy files
when using a Java security manager, for example:

grant codeBase "file:${wtp.deploy}/your_app_name/-" {...


With "Serve modules without publishing" enabled, your web application is
spread out within your workspace. In this case, "wtp.deploy" points to
your workspace in an attempt to remain somewhat useful in policy files
for those determined to test with a security manager.

Cheers,
Larry
Re: WTP Tomcat hot deploy with m2eclipse [message #543618 is a reply to message #543578] Wed, 30 June 2010 05:13 Go to previous message
Paul Greyson is currently offline Paul Greyson
Messages: 2
Registered: June 2010
Junior Member
Thanks very much for the reply!
Previous Topic:Apache Tomcat
Next Topic:Dynamic Web Project setup with new Deployment Assembly page
Goto Forum:
  


Current Time: Sun Oct 26 07:49:42 GMT 2014

Powered by FUDForum. Page generated in 0.08757 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software