Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Tomcat not Updating

I am developing an application with SpringMVC and Tomcat using Eclipse. The problem is: the server does not update the changes I am making.

One example:

@RequestMapping(value = "test", method = RequestMethod.GET)
    public ModelAndView test(){

        ModelAndView mv = new ModelAndView("test");                 
        System.out.println("test");
        return mv;
    }

Every time I hit the mapped url, Eclipse prints test in my console. If I comment out the println, I get the same result.

Attempts to fix the problem:

  • clean Tomcat directory
  • restart the server
  • close Eclipse
  • add/remove the project in the Server tab
  • delete the JSP the method is using
  • different browsers

All to no effect. It just looks like Tomcat is not updating any changes I make in the code.

like image 213
Mauro M Avatar asked Jul 06 '15 14:07

Mauro M


2 Answers

To make Eclipse Tomcat update automatically or hot deploy you have to make certain changes in server configuration:

Below are the steps:

  1. Double clicks on the Tomcat Server, refer to "publishing" tab in the "Overview" view, make sure "Automatically publish when resources change" is selected. This should be the default option, to support “hot deploy” resources, for example : JSP, XML and properties files.

  2. In the Tomcat Plugin page, click on the "Modules" view, Select the Module then click on Edit button and make sure "Auto Reload" is "Disabled". Default is enabled.

  3. Start Project in DEBUG mode. Hot Deploy is supported in DEBUG mode only.

like image 143
Arpit Aggarwal Avatar answered Oct 23 '22 10:10

Arpit Aggarwal


Two more things to check:

  • deploy directory: in the tomcat server UI and according to "deploy path" configuration, check that the output directory has read/write access (you could also remove it and try to publish again : check expected output resources/classes).
  • deployment assembly: in project properties menu; in the "deployment assembly" section, check that you are publishing all wanted resources. For example, in my case I download/generate some items from maven custom plugin phase and this resources are not published by default. I had to add some target subdirectories here...
like image 26
boly38 Avatar answered Oct 23 '22 09:10

boly38