Frequently Asked Questions
Outline
Basics
- What is/isn’t JRebel?
- How does JRebel work?
- Aren't there free/open source alternatives that do that already?
- What about configuration changes?
- Can JRebel be used in production?
Question: What is/isn’t JRebel?
Answer:
- A development-time tool that decreases turnaround by instantly reloading changes to your code, without having to restart the container or redeploy the application.
- A JVM -javaagent plugin. The -javaagent is a command line option that has been available since Java 5 to allow custom instrumentation plugins to be registered. JRebel uses this option for installation.
- A JAR file about 1 MB big. That’s pretty much says it all – there is no long installation process: just unzip, copy, add options to the command line and enjoy!
- An IDE plugin. There is some configuration/integration you can do to improve your experience, but JRebel will work with a vanilla Java compiler and a text editor as well.
- A framework. JRebel does not introduce any dependencies in your application. You can take it away at any moment and just continue developing the way you do usually.
- An application server. JRebel works with all prominent application servers, but it definitely isn’t one.
- A custom JVM. JRebel doesn’t require you to make any changes to the JVM and works on all prominent JVM implementations.
Question: How does JRebel work?
Answer:
JRebel integrates with the JVM and application servers
mainly
on the class
loader level. It does not create any new class loaders,
instead, it
extends the existing ones with the ability to manage reloaded classes.
When a class is loaded JRebel will try to find a corresponding .class file for
it. It will
search from the classpath (including an application classpath, like WEB-INF/classes)
and from the
places specified in the rebel.xml
configuration file. If it find a .class
file JRebel instruments the loaded class and associates it with the
found .class
file. The .class
file timestamp is then
monitored for changes in the loaded class and updates are propagated
through the extended class loader, to your application.
JRebel can also monitor .class
files in JARs if they are specified in rebel.xml.
Importantly, when loading updates to a class, JRebel preserves all
of
the existing instances of that class. This allows the application to
just continue working, but also means that when adding a new instance
field it will not be initialized in the existing instances, since the
constructor will not be rerun.
Some common misconceptions:
- JRebel just wraps class loaders around classes. In fact JRebel does not add a single new class loader to your application. The solution of reloading Java classes by wrapping them in throwaway classloaders is a well-known one, but unfortunately also very limited. The problem is that unless you also throw away all of the instances of the classes loaded by said class loaders, the code will not reload. However throwing away those instances is only possible if they are somehow managed by the framework, e.g. as it’s done in Tapestry 5.
- JRebel just uses Instrumentation API. The Instrumentation API was introduced in Java 5 and included a limited ability to redefine Java classes on-the-fly. Unfortunately it is limited to only changing method bodies (as is HotSwap) and also suffers from several additional quirks, which makes it not too useful in a real environment. JRebel agent does use it to instrument the application server class loaders and other basic classes, but the API does not play part in the actual reloading process.
Question: Aren't there free/open source alternatives that do that already?
Answer:
In one word: no. However there are several partial solutions:
-
Hot deploy. This is basically when your application is redeployed on any change to the code. Most application servers will allow you to do that. The problem is that it only works for small or lightweight applications. Your typical enterprise application will redeploy for at least 30 seconds and this time is just wasted. With JRebel the reloading time is measured in milliseconds.
-
HotSwap. HotSwap is a technology available in Java since 1.4 that allows you to instantly redefine Java classes inside a debugger session. This is supported by all prominent IDEs (e.g. IntelliJ IDEA, Eclipse and NetBeans), so if you attach a debugger to your application and make some changes, they will be reflected immediately. Unfortunately this technology is very limited, as it only allows changes to method bodies and doesn’t allow new classes to be added. JRebel can be thought of as improved HotSwap, as it allows changes to class structure, including adding methods, fields, constructors and even annotations as well adding classes and changing configurations.
-
OSGi. OSGi is a runtime module container for Java. It allows you to split an application into modules with well-defined dependencies and manage them separately. One of the side-effects is that it allows you to update the modules (or, in OSGi-speak, bundles) one at a time. It is basically the same solution as Hot Deploy, but since the module size is smaller than the application size, the time wasted can be smaller. It will still likely be measured in tens of seconds, since all of the dependent modules should also be updated, but it can be significantly faster than vanilla WAR/EAR applications. JRebel reloading time is still orders of magnitude faster.
-
Throwaway class loaders. Several frameworks (including Tapestry 5, RIFE, Seam, Grails and so on) will instantly reload the changes to the code of the managed components (e.g. beans, pages, controllers, etc). This is possible by wrapping a throwaway class loader around the managed component and recreating its instance after every change. Unfortunately this solution works only for managed components and the rest of the code cannot be reloaded. It can also cause weird ClassCastExceptions and other similar problems due to class loader migration problems. JRebel works for any class in your system, preserves all the current object instances and does not exhibit any class loader-related problems.
Question: What about configuration changes?
Answer:
Reloading changes to Java classes is not always enough. Applications include configurations for Java code, annotations, XML files, property files and so on. JRebel uses configuration-specific plugins to reload those changes instantly, just as it does changes to classes. JRebel comes with plugins for Spring, Guice, Stripes, Tapestry 4 and others out of the box. To find out more check out check out our OSS projects’ overview.
Question: Can JRebel be used in production?
Answer:
JRebel is meant and licensed only as a development tool. If you’re interested in using the same engine for production updates, check out LiveRebel.
Pricing/Licensing
- Free trial
- Corporate license
- Personal license
- Open source developer license
- Refunds
- Can I use my license on several machines?
- Can I use a personal license at work?
Answer:
Answer:
Answer:
- It is non-transferrable.
- It cannot be paid or reimbursed by any entity.
Question: Open source developer license
Answer:
Answer:
Installation
- How do I install JRebel?
- What is exploded and packaged deployment?
- What do I have to change in my application for JRebel to work?
- How do I know that JRebel is working?
- Does JRebel support JVM vendor X version Y?
- Does JRebel support application container X?
- Does JRebel support framework X?
- Do I have to run JRebel in a debugger session?
- Can I debug the application with JRebel enabled?
- Where can I find installation instructions for my particular environment?
- How do I configure my IDE to work with JRebel?
- How do I get JRebel working with Maven?
Question: How do I install JRebel?
Answer:
Question: What is exploded and packaged deployment?
Answer:
Question: What do I have to change in my application for JRebel to work?
Answer:
WEB-INF/classes).
If you're using packaged deployment you should create a rebel.xml configuration file and put it in the application classpath (e.g. WEB-INF/classes).
Please see the installation manual for details.Question: How do I know that JRebel is working?
Answer:
##########################################################
ZeroTurnaround JRebel 4.0 (201105312032)
(c) Copyright ZeroTurnaround, Ltd, 2007-2009. All rights reserved.
You are running JRebel evaluation license.
You have 25 days until the license expires.
You will see this notification until you obtain a
full license for your installation.
Visit www.JRebel.com for instructions on obtaining
a full license. If you wish to continue your evaluation
please e-mail to support@zeroturnaround.com.
If you think you should not see this message contact
support@zeroturnaround.com or check that you have your
license file in the same directory as the JAR file.
##########################################################
Question: Does JRebel support JVM vendor X version Y?
Answer:
Question: Does JRebel support application container X?
Answer:
Question: Does JRebel support framework X?
Answer:
Question: Can I debug the application with JRebel enabled?
Answer:
Question: Where can I find installation instructions for my particular environment?
Answer:
Question: How do I configure my IDE to work with JRebel?
Answer:
Question: How do I get JRebel working with Maven?
Answer:
Runtime
- How does JRebel know what classes have been changed?
- Does JRebel scan all my classes all the time? Isn't that slow?
- Does JRebel slow my system down?
- Does JRebel make the server start up slower?
Question: How does JRebel know what classes have been changed?
Answer:
Question: Does JRebel scan all my classes all the time? Isn't that slow?
Answer:
Question: Does JRebel slow my system down?
Answer:
Question: Does JRebel make the server start up slower?
Answer:
Troubleshooting
- I installed JRebel and my application doesn't start. What do I do?
- I installed JRebel and it doesn't reload classes. What do I do?
- Why doesn’t JRebel reload the changes in the TEST I made?
- I'm getting java.lang.OutOfMemoryError: PermGen space!??
- I get "Too many open files" message?
- Why does my IDE show an error “hot code replace failed”?
- Why setting a breakpoint in debugger does not work?
- Why can’t I evaluate some of the expressions in debugger?
- Why do I have trouble setting a conditional breakpoint?
- Why do I get NullPointerException when accessing a newly added field?
- How to report errors to you? What kind of information to include?
Question: I installed JRebel and my application doesn't start. What do I do?
Answer:
- Does the application start without JRebel?
- Is there an exception in the output? If it is too cryptic just send it to support@zeroturnaround.com or post it on the forum.
Question: I installed JRebel and it doesn't reload classes. What do I do?
Answer:
Question: Why doesn’t JRebel reload the changes in the TEST I made?
Answer:
Question: I'm getting java.lang.OutOfMemoryError: PermGen space!??
Answer:
Question: I get "Too many open files" message?
Answer:
jboss-service.xml.
The limit of open files can be verified by ulimit -a. Increasing of the limit requires root privileges and can be done for the running of the application server via sudo bash -c 'ulimit -n 8192; sudo -u yourUserName ./appServerStartupScript'. Permanent per user configuration is via editing the /etc/security/limits.conf and adding the lines yourUserName hard nofile 8192 and yourUserName soft nofile 8192 at the end of the file.Question: Why does my IDE show an error “hot code replace failed”?
Answer:
Question: Why setting a breakpoint in debugger does not work?
Answer:
Question: Why can’t I evaluate some of the expressions in debugger?
Answer:
getMySomething() -> that.getMySomething() this.getMySomething() -> that.getMySomething()Another problem is that Eclipse does not allow expressions accessing
private members (fields and methods). The easiest way to solve it is to temporary change the access modifier to protected.
This means that in many cases just clicking on an expression in class text and inspecting it is likely to fail (if it refers to current instance or private members). What you should do is copy and modify it adding that in front.
An alternative solution to viewing expressions is to assign them to local variables in the class text and then watch the local variable:
String mySomething = getMySomething()Same trick works for quickly viewing private members.
Question: Why do I have trouble setting a conditional breakpoint?
Answer:
if (myCondition) {
System.out.println(); //Breakpoint
}
Question: Why do I get NullPointerException when accessing a newly added field?
Answer:
- Non-static fields will be initialized once a new class instance is created. This is due to the way Java handles field initialization, which gets run only on constructor calls. Since primitive types cannot be initialized to nulls such fields will cause a
NullPointerExceptionon access. Object types will cause aNullPointerExceptionwhen dereferenced. - Static fields will never get initialized. Again, Java appends the static fields initialization to the ends of the single static initializer method
<clinit>. Rerunning this method is dangerous, since it can overwrite or alter meaningful state. This does not concern constants (final static primitive or String fields) as they are replaced by their proper values and therefore will get initialized.
Question: How to report errors to you? What kind of information to include?
Answer:
-
Start your application with
-Drebel.log=trueand a jrebel.log file is generated to the same directory as JRebel.jar- The log file contains all the necessary system information. JDK version, operating system, properties passed to the application, classloading logic etc.
- If the file is too large, compress it with ZIP, GZip or your favorite compression algorithm.
- If for a reason the log is not generated or you don't have the time to generate it, please provide JDK, application server and any important library versions. Also knowing the operating system can help a lot!
- If you need private support just drop us an email at support@zeroturnaround.com with the information mentioned above.
Plugins/Extending
Question: What do I need plugins for?
Answer:
Question: How do I install plugins?
Answer:
If you happen to find a JRebel plugin that is not listed at the plugin page and there are no specific instructions on how to install then probably the solution is to drop the plugin in the WEB-INF/lib and check standard output for messages regarding the plugin.


