6

I would like to extend the set of reloadable directories on tomcat 7.0.59. When reloadable attribute within Context is set to true, tomcat monitors classes in: /WEB-INF/classes/ and /WEB-INF/lib.

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

Entire system is divided into modules, each module can have its own web context (/WEB-INF/classes/) and/or extend the global context (/classes/). Let's say that I'd like to have /classes/ directory reloadable. How can I achieve that?

I tried using WatchedResource tag, without effect:

<Context reloadable="true" path="/test" docBase="/MY_MODULE/web/webroot">
     <Manager pathname="" />
     <WatchedResource>/MY_MODULE/classes</WatchedResource>
</Context>
luke
  • 3,531
  • 1
  • 26
  • 46
  • Why do you *have* a `/classes/` directory that isn't `/WEB-INF/classes/`? – user207421 Sep 04 '17 at 06:05
  • It's a very large project's specific "feature". – luke Sep 04 '17 at 06:20
  • Have you tried to add a soft link in your file system? – Pablo Lozano Sep 06 '17 at 07:47
  • No, but I'm looking for a solution on tomcat configuration side – luke Sep 06 '17 at 07:49
  • 2
    Saying it's a 'feature' doesn't constitute an answer to the question. What is the reason for the 'feature'? *Considering it isn't supported by Tomcat,* it isn't a 'feature' at all, it is a *bug.* If those classes were in `WEB-INF/classes` you wouldn't have a problem, or a question to answer. – user207421 Sep 06 '17 at 09:41
  • Entire system is divided into modules, each module can have its own web context (`/WEB-INF/classes`) and/or extend the global context (`/classes`). I will try to modify `CATALINA_BASE/conf/context.xml` then. – luke Sep 07 '17 at 07:26
  • 2
    @luke Classes to support 'global context' should be put into JAR files in Tomcat's `lib` directory. You can't just invent a feature and then expect Tomcat to support it. – user207421 Sep 07 '17 at 09:56

1 Answers1

3

You can try starting tomcat with HotSwapAgent: Plugin_tomcat. (GITHUB HotswapProjects)

You can have a differrent hotswap-agent.properties file on each of your modules, to load differrent classpaths.

Kondal
  • 2,870
  • 5
  • 26
  • 40
Marinos An
  • 9,481
  • 6
  • 63
  • 96