JRebel allows for newly compiled code to be redeployed without restarting the application. I am wondering if there are any alternative (free?). The FAQ page answers this question, but I am sure it's biased towards JRebel. This question was asked a year ago on this site, but I am bringing it back up to see if anyone has any new information.
On a side note, I really like JRebel, but if there is a free alternative, I am willing to try it.
One additional note, I am working on an open source project, and they offer free one year licenses to people who can prove they are on an open source project. Which works great for me (www.kuali.org), but I won't be on that project forever.
Take a look at DCEVM, it's a modification of the HotSpot VM that allows unlimited class redefinitions at runtime. You can add/remove fields and methods and change the super types of a class at runtime. The features of DCEVM may be integrated in a future update of Java as part of JEP 159.
The binaries available on the original site are limited to Java 6u25 and to early versions of Java 7. The project has been forked on Github and supports recent versions of Java 7 and 8. The maintainer provides binaries for 32/64 bits VMs on Windows/Linux. Starting with Java 11 the project moved to a new GitHub repository and now also provides binaries for OS X.
DCEVM is packaged for Debian and Ubuntu, it's conveniently integrated with OpenJDK and can be invoked with java -dcevm
. The name of the package depends on the version of the default JDK:
- Debian 7&8 and Ubuntu 15.04 : openjdk-7-jre-dcevm
- Debian 9 and Ubuntu 16.04 : openjdk-8-jre-dcevm
- Debian 10 and Ubuntu 19.04 : openjdk-11-jre-dcevm
Hotswap Agent is an extension to DCEVM which supports many Java frameworks (reload Spring bean definition, Hibernate entity mapping, logger level setup, ...).
There is also lot of documentation how to setup DCEVM and compiled binaries for Java 1.7.
By the Spring guys, used for Grails reloading but works with Java too:
DCEVM supports enhanced class redefinitions and is available for current JDK7 and JDK8.
https://github.com/dcevm/dcevm/releases
HotswapAgent is an free JRebel alternative and supports DCEVM in various Frameworks.
I have written an article about DCEVM: Spring-mvc + Velocity + DCEVM
I think it's worth it, since my environment is running without any problems.
I have been working on an open source project that allows you to hot replace classes over and above what hot swap allows: https://github.com/fakereplace/fakereplace
It may or may not work for you, but any feedback is appreciated
You might want to take a look this:
HotSwap support: the object-oriented architecture of the Java HotSpot VM enables advanced features such as on-the-fly class redefinition, or "HotSwap". This feature provides the ability to substitute modified code in a running application through the debugger APIs. HotSwap adds functionality to the Java Platform Debugger Architecture, enabling a class to be updated during execution while under the control of a debugger. It also allows profiling operations to be performed by hotswapping in versions of methods in which profiling code has been inserted.
For the moment, this only allows for newly compiled method body to be redeployed without restarting the application. All you have to do is to run it with a debugger. I tried it in Eclipse and it works splendidly.
Also, as Emmanuel Bourg mentioned in his answer (JEP 159), there is hope to have support for the addition of supertypes and the addition and removal of methods and fields.
Reference: Java Whitepaper 135217: Reliability, Availability and Serviceability
JRebel is free. Don't buy it. Select the "free" option (radio button) on the "buy" page. Then select "Social". After you sign up, you will get a fully functional JRebel license key. You can then download JRebel or use the key in your IDEs embedded version. The catch, (yes, there is a catch), you have to allow them to post on your behalf (advertise) once a month on your FB timeline or Twitter account. I gave them my twitter account, no biggie, I never use it and no one I know really uses it. So save $260.
来源:https://stackoverflow.com/questions/7998669/redeploy-alternatives-to-jrebel