-2

I am creating a Spring Server, which unfortunately has to be "on air" the next week and it can not be turned off anymore. I have several questions:

  1. Can I manipulate/update Java classes while the server is running?
  2. Can I manipulate/update HTML pages while the server is running?
  3. If it is not possible, how can I preserve my database if I have to turn off the server and restarting it with the updates?
  4. Would you run it as JavaApplication, JettyRun, Maven, Gradle or another one?
Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Alberto Crespo
  • 2,429
  • 5
  • 28
  • 51

2 Answers2

1

You should have 2 servers and put a load balancer in front of them, when updating you could then rout everything to one server and restart the other.

As to your questions:

  1. I don't think there is a simple and standard way of doing so. EDIT: But, if you are using a web container, some of them, like tomcat supports updating (re deploying) without taking down the server. You might still loose some traffic. please read: Tomcat Docs

  2. Most web containers supports this, so I guess my answer is yes.

  3. Database is using disk. Restarting will keep everything in place, and also, it is very rare that you need to restart a DB.

  4. Maven and Gradle are more for build/testing and not for running real deployed applications, so I would rule those out.

Good luck!

galusben
  • 5,948
  • 6
  • 33
  • 52
  • 1
    Tomcat 7+ has the concept of [parallel deployment](http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment) whereby multiple versions of the same WAR can be deployed without stopping the Tomcat process. While a new version is being deployed, all traffic is handled by the latest deployed version. Once the new version has fully started all new requests are automatically routed to the new version. This feature essentially results in zero loss of application traffic. – manish Feb 05 '15 at 04:20
0

You can deploy your application exploded without requiring restart so you can change methods in classes and html pages at runtime but it looks like hacking your application. If you add new class + html page or change a field in a class then it is not works and also cause your application to lapse.

er3n
  • 1