Swati Joshi
Swati Joshi

Reputation: 105

How to hot deploy code in Tomcat running in debug mode

How to configure Tomcat server in debug mode for Eclipse to support hot deployment? Hot swap or hot code replace without restarting the Server, which can speed up the development.

Upvotes: 1

Views: 4793

Answers (3)

outdev
outdev

Reputation: 5492

Hot swap will change the modified class byte code on disk, which will trigger tomcat redeploy. Also hot swap supports only simple changes within method body. So hot swapping on tomcat is not working out of the box. There are third party solutions for this, like JRebel.

Upvotes: 0

Rupesh Agrawal
Rupesh Agrawal

Reputation: 695

We can make some changes in tomcat to support hot deploy, there can be different ways to achieve that.
One of the simplest way is making change in tomcat setting in eclipse/STS,

  • Double click on the Tomcat plugin, refer to publishing tab, make sure "Automatically publish when resources change" is selected. enter image description here
  • In the Tomcat Plugin page, click on the Module view, make sure Auto Reload is Disabled. Default is enabled. enter image description here **NOTE: **
  • This is applicable in case of debug mode only
  • Only method code changes is supported, new added method,class, database script,tomcat is required to be restarted.
    Reference:
    Click here for mkyong.com link

Upvotes: 1

Pavel Uvarov
Pavel Uvarov

Reputation: 1100

I'm not sure that it is possible without redeploy and without external tools. For case to update only updated classes/resources I use HotSwapAgent tool But this tool have some limitations and I wouldn't recommend it for prod.

Upvotes: 0

Related Questions