JavaRebel brings Ruby and PHP style dynamic reloading of classes to Java. While it currently has several limitations it can speed up development dramatically.
JavaRebel allows an application (stand-alone or within an application server) to reload most class changes on the fly, including adding and removing methods and fields.
Using bytecode modification and a little bit of magic JavaRebel extends the JVM with ability to reload almost arbitrary changes to classes on-the-fly. This includes adding and removing both methods and fields and the only forbidden changes are to ‘extends’ and ‘implements’ clauses. Since all the existing object instances are preserved the application and server can continue running and code changes are immediately visible in the application.
Some limitations that have been discovered include:
- getClass().getPackage() returns null. Zeroturnaround is aware of this and are working on resolving it
- Customer classloaders are not supported
- No hooks are currently provided for performing actions at resource reload (for instance refreshing an object in a dependency graph in a Spring application)
Despite the current limitations, feedback has been generally positive. Likewise, Zeroturnaround is working to make nightly builds available for use and plans to release an SDK soon to help solve some problems, such as the custom classloader restriction.
Community comments
Typo
by Jevgeni Kabanov,
Re: Typo
by Michael Neale,
Re: Typo
by Jevgeni Kabanov,
Re: Typo
by Michael Neale,
Re: Typo
by Jevgeni Kabanov,
Typo
by Jevgeni Kabanov,
Your message is awaiting moderation. Thank you for participating in the discussion.
Should be "custom", not "customer" classloaders :)
Re: Typo
by Michael Neale,
Your message is awaiting moderation. Thank you for participating in the discussion.
Yeah and at that it is a bit of a show stopper. There is so much meta programming going on these days (eg if you use hibernate, spring) behind the scenes that "custom" classloaders are the norm.
Re: Typo
by Jevgeni Kabanov,
Your message is awaiting moderation. Thank you for participating in the discussion.
JavaRebel supports custom classloaders themselves. JBoss, Spring, Hibernate, Tapestry 4 & 5 all run wonderfully. All these are used to create proxies or subclasses or just postprocess loaded classes. The thing that isn't supported is when you have classes in some custom places and use your own classloader to locate them. The issue is described here: www.zeroturnaround.com/forum/topic.php?id=16....
Re: Typo
by Michael Neale,
Your message is awaiting moderation. Thank you for participating in the discussion.
OK thats great ! What about dirty hackers (like me) who do tend to do the latter a bit ;) (don't try this at home kids !) - anything in the works like that?
I have run into this problem before with instrumentation tools like emma and clover in the past (may have been fixed by now, not sure).
If this works well, I hope it leads to greater things being build into the JDK itself (without hosing the business model of course !).
Re: Typo
by Jevgeni Kabanov,
Your message is awaiting moderation. Thank you for participating in the discussion.