Tomcat reloading exploded war with spring-loaded

1k views Asked by At

There's alot of questions on different forums [1] [2] [3] about this topic but none seem to provide a definitive answer. I've tried different combinations suggested in the various posts but I have yet to succeed.

My goal is to make compiled source code in a standalone tomcat (8) reloadable - just like the embedded tomcat reloads newly complied sources in e.g. spring-boot or Grails. There are a few constraints that I need to comply with:

  • No Grails or Spring-boot is available
  • No Maven or Gradle is available
  • The tomcat should read the exploded war file from an external location

To keep things simple I use a very simple JEE app with Spring MVC as POC for this before I move on to the real deal. The setup is as follows (for now):

  • Exploded war builds into directory target/exploded
  • Tomcat is setup with default settings except from Context.xmlwhere the two lines regarding WatchedResource are removed. Context is not set to reloadable="true".
  • The Tomcat server is run from within IntelliJ Idea (2016.3) like this: Tomcat run-config - deployment tab where the "exploded" folder points to the target described above. And the "Server" tab like this: enter image description here

The server starts up and the app is running fine. I then try to change some code, save it, and build a new exploded war file. I can see the class files change - but nothing is reloaded in tomcat.

Can anybody please elaborate? Is this approach even possible - in contrary to what many posts suggest? How is it possible in the embedded tomcat in e.g. Grails?

0

There are 0 answers