2

I want to reload (or restart) one specific web application on an Apache Tomcat (6 or 7) server without Tomcat Manager or the automatic Reloadable attribute. Using the manager would give again another security risk, and reloadable attribute does not work when you need to upload/copy large files since it already reloads when the upload has not yet finished.

Being root, it should be easy to reload a specific web application, instead of doing a Tomcat service restart (which reloads every web application on it), right?

Yeti
  • 269
  • 1
  • 4
  • 14

3 Answers3

2

Use JMX, and only allow attaching from localhost.

pyroscope
  • 231
  • 1
  • 3
  • While the answer seems to solve the problem, its quite vague for a Tomcat-newbie. Is there no easy command like, say `tomcat -enable someSite.war`? I'm gonna dive into JMX's doc, and google for some more explicit results, but adding a few copy/pastable lines --if they do exist--, would help a lot – Balmipour Sep 22 '17 at 15:23
  • You can use JMX to restart a webapp? – rogerdpack Oct 12 '17 at 16:33
0

The typical method of re-uploading large files is to just drop a whole new .war file out there, tomcat will redeploy your app "in full". These days you can do parallel deployment https://stackoverflow.com/a/6584259/32453

Since you mentioned you're root, you could bounce all of tomcat I suppose, as well.

or the idea I had for it would be to copy all the new files over then just "rename" folders so rename it to your webapps folder somehow after renaming the old one to something else.

There might also be a way to instruct tomcat to only watch "specific locations" instead of the default (which is at least WEB-INF/lib/*) (context.xml: WatchedResource tag by default is WEB-INF/web.xml).

so you could copy the files over and then touch a file there.

rogerdpack
  • 575
  • 2
  • 8
  • 22
-1

Using the manager would give again another security risk

What security risk are you talking about?

wget --http-user=user \
     --http-password=password \
     -q -O - http://localhost:8080/manager/reload?path=/examples

http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Supported%20Manager%20Commands

quanta
  • 50,327
  • 19
  • 152
  • 213
  • The security risk is that there is an extra username/password login open to the internet. The advantage is you can do remotely managing, but I don't need that, so it's just an extra security risk. Also, I need to have an extra password to 'remember', and the password is sent in plaintext over the connection. – Yeti Nov 06 '14 at 08:16