WTP Tomcat hot deploy with m2eclipse [message #523599] |
Sat, 27 March 2010 01:48  |
Eclipse User |
|
|
|
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 13:06   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03378 seconds