![]() ![]() How to cope with reloading problems?įrom time to time JRebel will spit out an error that it could not reload the classes. IncompatibleClassChangeError : Class C does not implement the requested interface BĪs you can see JRebel is not a silver bullet and before buying it you should test it on your production projects first and learn about its limitations. and tweak our code a little bit: B c = new C () Lets start with this set of classes: class A This is quite reasonable, as such reloading feature should be placed in the server logic, which is unreachable from java agents.īesides this problems there are two well documented cases where your classes cannot be reloaded (for details check here): Reloading web.xml is not supported, which was confirmed by the JRebel support team. The next problem I had with JRebel was web.xml. JRebel support team suggested writing a JiBX plugin myself (more info about creating plugins can be found here), but unfortunately JiBX does not provide incremental builds, so it would not add much value anyway. It troubled me quite a lot, because it is heavily used in my current company. What canNOT be reloaded?įrom the major problems I encountered, the first one was the lack of JiBX plugin. Personally, I used the Maven, Eclipse, IntelliJ, Spring, Struts and EJB plugins with minor issues. For example, if you change your Spring XML configuration file, you would also like to inform the Spring container that a class definition is outdated. The main idea behind plugins is that sometimes you may want to reload more files after compiling a class or changing a resource file. In addition to class reloading, JRebel provides a large variety of plugins that alter the way reloading works for different languages and libraries. Drebel.properties="/absolute_path_to_your_home_folder/.jrebel/jrebel.properties"Īgain, remember to specify absolute paths. ="/absolute_path_to_your_home_folder/.jrebel/jrebel.log" javaagent:"/absolute_path_to_jrebel_installation/jrebel/jrebel.jar" In the simplest case you have to add the -javaagent parameter either to your launch script or to the server start script: java Next thing is the JVM launch configuration. The web/link element is for the web resources that you would like to have reloaded, i.e.: JSPs, image files, CSS files, JavaScript files, etc. Then JRebel will find out that the class is changed and reload it. If you use Eclipse and have ticked the option Project/Build Automatically, after you save the source file Eclipse will automatically compile your code and overwrite the class file. The classpath element is used for the path to your compiled classes. ![]() You should put absolute paths, not relative ones, as the working directory from which JRebel will run may be hard to specify. Here is an example of the rebel.xml file: run your application or start your server with the -javaagent parameter specifying the path to the jar with JRebel.place rebel.xml in the main folder of the package (jar/ear/war, etc.) that will be run as a standalone application or will be deployed to server.Then at the bytecode level it adds/removes/replaces fields/method bodies/etc. If you compile a class, JRebel notices the change and compares the differences between class definitions. It looks for changes in the folder with your compiled classes. It works as a java agent on top of the JVM. JRebel instantly reloads changes to Java code. I think JRebel is cool, but as everything it is not perfect, so before buying it you should learn how it works. I tried to be honest and not to force any opinions. All the information is based on my personal experience after using JRebel for the last 10 months. ![]()
0 Comments
Leave a Reply. |