Tuesday, December 16, 2014

Tomcat: modules/classes auto-reload and published in Tomcat Server when changes made to the web project

When using the spring tool suite, you will have the ability to auto-reload modules and auto-publish the updated project in tomcat server whenever you made changes to the codes in your web project. To enable this feature, double-click your Tomcat server instance in the "Servers" tab in the IDE, and do the following steps:

1. Check the option "Modules auto-reload by default" under the "Server Options" section (or check the "Enable Java-agent reload behavior" option under the "Application reload behavior section", depending on your IDE)

2. Select the radio option "Automatically publish when resources change" under the "Publish" section

Now restart your Tomcat server, and whenever you made changes to your code, your changes will be immediately reflected on the changes in the web pages.

Note that if you do not have the options as stated in step 1 because of the IDE you are using does not package with this feature. The alternative step will be to

1.1 Download the spring-loaded from

https://github.com/spring-projects/spring-loaded

 and store the downloaded jar file in your file system somewhere (said, /home/chen/Documents/Works/spring-reloaded/springloaded-1.2.1.RELEASE.jar)

1.2 Double-click the Tomcat server instance in your IDE's "Servers" tab and click the link "Open Launch Configuration" in the "Server Configuration" page.

1.3 In the "Edit Configuration" dialog popup, select the "Arguments" tab, and add the following to the end of the "VM arguments" field text:

-javaagent:/home/chen/Documents/Works/spring-reloaded/springloaded-1.2.1.RELEASE.jar -noverify

After the above step, following the step 2 as mentioned above and restart the server after that.


No comments:

Post a Comment