-1

I need a java/j2ee program, that will load an updated class file when the server is still on. In our Web Application testing environment few classes(Java files) are being frequently changed to fix defects and need to load them in JVM fresh. We can not restart the server to impact on going testing .

Can we write a program to load it using class loader?

duffymo
  • 305,152
  • 44
  • 369
  • 561
Ram
  • 35
  • 2
  • 6
  • 1
    Have you tried ? – vincrichaud Mar 22 '18 at 15:51
  • You should not do this. A better bet would be to use a JVM that allows hot redeploy. – duffymo Mar 22 '18 at 15:52
  • 1
    An Idea would be an OSGI environment like Apache Felix or Equinox. These enable dynamic loading, starting and stopping of soocalled bundles etc. – Axel Amthor Mar 22 '18 at 15:55
  • So people and/or automated testing runs 24/7? There is no time slice to update the server? Which is more important: deploy fixed defects or keep the environment up? – Andrew S Mar 22 '18 at 15:56
  • actually its a small teating environment and almost no scope for OSGI, Apache Flex. seems the requirement is to write a java program to dovthe job ... will that be possible ? – Ram Mar 22 '18 at 15:58
  • Why would a deploy/restart of a small test environment be so disruptive? How much time, 5 minutes? Over lunch? Scheduled at night? Assuming it is possible, would it be acceptable to have the test environment not as close as the production environment? – Andrew S Mar 22 '18 at 16:12
  • consider multiple nodes + rolling restarts – the8472 Mar 24 '18 at 20:49

2 Answers2

0

No you cannot, you would need to have the container on the server side. Although for your server like tomcat, jboss, websphere etc. you can configure them to hot deploy but the server side would still needs restart once new class file is placed. If you are trying to hot deploy a class file you can try using JRebel it will allow you to hot deploy the class file without actually restarting because it is managed within JRebel container. (also note that JRebel is not free)

logger
  • 1,983
  • 5
  • 31
  • 57
-1

There are quite a few solutions/plugins which help you with hot-deployment of java code saving you with complete build and server restart. I had used jRebel earlier available at https://www.jrebel.com/products/jrebel. There are other such solutions/tools that can help you with the hot deployment.

Abhay Phougat
  • 280
  • 2
  • 6