JavaRebel Brings Class Reloading to Java

Home

News: JavaRebel Brings Class Reloading to Java

  1. JavaRebel Brings Class Reloading to Java (58 messages)

    JavaRebel reloads changes to Java classes on-the-fly without redeploy or restart including new methods and fields. It is a generic solution that works for standalone Java applications as well as application servers. For the impatient: watch the demonstration screencast (~5 mins) and download. Ever since HotSwap support has been introduced in Java 1.4 people have been craving for more. As witnessed by this bug in the Sun database and numerous other discussions changing method bodies was just not enough. Dynamic languages like Ruby were quick enough to capitalize on this lack, touting Java EE development as slow and cumbersome. As time passed by, people have tried to work around the limitation by reloading classes along with their classloader. However since this requires reconstruction of the object state, it will only work in a controlled and limited environment — e.g. that of a web framework like RIFE, Tapestry 5 and so on. Just as many others, we were working on a workaround. However, instead of limiting ourselves to the facilities provided by the Java platform, we devised a whole new approach. Using bytecode modification and a little bit of magic, JavaRebel extends the JVM with the 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. Watch the demonstration screencast (~5 mins), read the feature list or just download JavaRebel from ZeroTurnaround.com and give it a try. Disclaimer: JavaRebel is commercial software with a free trial for 14 days and developer seat cost at 99$.

    Threaded Messages (58)

  2. this cant be true right?
  3. Just try it :) It's available for download. Not a scam or vaporware.
  4. um trying with tomcat but I get Unrecognized option: -Xbootclasspath/c:/javarebel.jar, adding as JAVA_OPTS to tomcat does nothing.
  5. The option is wrong, don't know where you got it from. Install.html is distributed with JavaRebel. Try this (exactly): -noverify -javaagent:javarebel.jar -Xbootclasspath/a:javarebel.jar
  6. The option is wrong, don't know where you got it from. Install.html is distributed with JavaRebel.

    Try this (exactly):
    -noverify -javaagent:javarebel.jar -Xbootclasspath/a:javarebel.jar
    when I do so , I get Error occurred during initialization of VM agent library failed to init: instrument Error opening zip file: javarebel.jar so I thought a:javarebel.jar should be c:javarebel.jar since I have no a: drive, I also have the javarebel.jar in my classpath
  7. when I do so , I get

    Error occurred during initialization of VM
    agent library failed to init: instrument
    Error opening zip file: javarebel.jar

    so I thought a:javarebel.jar should be c:javarebel.jar since I have no a: drive, I also have the javarebel.jar in my classpath
    A: is not a drive, -Xbootclasspath/a: adds a JAR to the JVM boot classpath. You have to have the javarebel.jar in the same directory (bin/) for this to work.
  8. same error[ Go to top ]

    I also got the same error. I tried it in weblogic 9.2. I saved the jar file in bin/ and added the java option in startWeblogic.cmd file. Any idea what whould have gone wrong? Thanks,
  9. Re: same error[ Go to top ]

    I also got the same error. I tried it in weblogic 9.2.
    I saved the jar file in bin/ and added the java option in startWeblogic.cmd file.

    Any idea what whould have gone wrong?

    Thanks,
    That error means that the jar file cannot be found on the path where it should be. As far as I remember in WL9 your working directory is the domain, while the script is in a subdirectory. If you put javarebel.jar into the domain directory, it should work.
  10. Re: same error[ Go to top ]

    System.err.println( new File("").getAbsolutePath()) shows you the right directory when your server is running
  11. Got it worked[ Go to top ]

    Thanks for the response, I got the stuff worked, I love it. But there is problems with debugger I guess, Eclipse is not able to setup the break points any idea why? any resolution? Thanks for the help
  12. Re: Got it worked[ Go to top ]

    Thanks for the response, I got the stuff worked, I love it. But there is problems with debugger I guess, Eclipse is not able to setup the break points any idea why? any resolution?

    Thanks for the help
    Could you post this question to ZeroTurnaround forum? And perhaps elaborate a bit?
  13. If you haven't seen the screencast yet, try following the same instructions as there. The installation is in the first minute or so: http://www.zeroturnaround.com/docs/javarebel-jpetstore-screencast.
  14. If you haven't seen the screencast yet, try following the same instructions as there. The installation is in the first minute or so:
    http://www.zeroturnaround.com/docs/javarebel-jpetstore-screencast.
    Still no such luck, I will try out later at home. Thanks anyway.
  15. One word, sweet! This is what java has needed for way too long!
  16. I am experimenting with JavaRebel and I am getting a lot of java.lang.IncompatibleClassChangeError from a sample Struts app. All I'm doing is just adding a system.out statement in an Action class. Any clues as to why it's doing this?
  17. Re: java.lang.IncompatibleClassChangeError[ Go to top ]

    I am experimenting with JavaRebel and I am getting a lot of java.lang.IncompatibleClassChangeError from a sample Struts app. All I'm doing is just adding a system.out statement in an Action class. Any clues as to why it's doing this?
    I forgot to mention that it's a Struts/Spring app if that gives any clue. Can JavaRebel interoperate with Spring-proxied beans?
  18. Could we take it to ZeroTurnaround support forums (http://www.zeroturnaround.com/forum/)? We'll be sure to help you.
  19. Can JavaRebel interoperate with Spring-proxied beans?
    Well the screencast uses good old Spring jPetStore
  20. Integrating this back into OpenJDK?[ Go to top ]

    Is there anything preventing one from integrating this back into OpenJDK?
  21. Re: Integrating this back into OpenJDK?[ Go to top ]

    Is there anything preventing one from integrating this back into OpenJDK?
    I hardly believe that this technology is free. They try to sell it, dont they?
  22. I hardly believe that this technology is free. They try to sell it, dont they?
    Is that evil? If it works i'd be happy to pay for it.
  23. Is that evil? If it works i'd be happy to pay for it.
    Not even close to evil. Innovative things is what our economy is all about after all. I just wanted to say that I dont believe it to be part of OpenJDK anytime soon.
  24. I just wanted to say that I dont believe it to be part of OpenJDK anytime soon.
    point taken ;)
  25. Re: Integrating this back into OpenJDK?[ Go to top ]

    Is there anything preventing one from integrating this back into OpenJDK?
    Since Sun requires the author of any OpenJDK contribution to give Sun co-ownership, it's up to the author of JavaRebel to consider trying to contribute this to OpenJDK. Considering the the fact that JavaRebel is something if a hacked solution, I can't see it getting accepted into OpenJDK anyway. I hope that JavaRebel will provide the impetus to finally get Java bug 4910812 fixed. Not being able to hot swap classes with a changed signature has been an issue with Java for far too long. I'm using JavaRebel now and it is a HUGE productivity boost for me. I can't figure out how I've gone so long without it. It's no wonder there are so many Java haters in the Ruby camp.
  26. If this software does what it is supposed to do, I think it will be a cash machine. Java is so popular, it has so many developers who have been praying for such a functionality for so many years now. We dont even need this thing to be perfect. Just make it do the dynamic class reloading in a develoment environment. Man I would love to have that in the JDK right NOW. But nooooo we must have Beans Binding, new Property Accesors and three approaches to closures instead. :(
  27. Man I would love to have that in the JDK right NOW. But nooooo we must have Beans Binding, new Property Accesors and three approaches to closures instead. :(
    Exactly. Seems to me that the people at Sun do not have the Smalltalk/Ruby/Groovy thinking. If you look at eclipse you see the Smalltalk IDE behind it. If you look at NetBeans you see VisualStudio behind it ... So what can you expect from these people. Looks like the only thing that Sun took over from the David Ungar/Self people were the technologies like the HotSpot optimizer and the train GC. But the approach towards development they brough in was not understood. Cheers, Oliver
  28. Hmm I really really wanted this to be true but this little snippet is taken from the site "Reloads all changes to classes except extends and implements clause changes." Thats a pretty big gotcha
  29. Choose the point in time very wisely! You have only 14 days of being productive 4 free ! ;)
  30. Hmm I really really wanted this to be true but this little snippet is taken from the site

    "Reloads all changes to classes except extends and implements clause changes."

    Thats a pretty big gotcha
    We are not really hiding this. It is written in the post as well, if you read it through. It is still a huge advantage, since you can do everything inside classes and create new classes as long as you don't change the inheritance/realization relationship after creating classes. Our shop has been using this for several months and it reduces redeploy count at least by four fifths.
  31. It's a BETA[ Go to top ]

    Haven't mentioned it in the post, but this release (1.0 M2) is still a BETA, so some smoothing out is expected. Don't be put off by problems some of you may encounter, we are working to solve them :)
  32. Why not with the debugger[ Go to top ]

    When I remote debug my application deployed on app server with eclipse, a simple save file compile and updates the class on the server, as long as I don't touch the class signature. Your product bypass this leak, but is it possible to work with it the same way using the debugger instead of making the output of the compile on the directory where the application is deployed?
  33. Re: Why not with the debugger[ Go to top ]

    When I remote debug my application deployed on app server with eclipse, a simple save file compile and updates the class on the server, as long as I don't touch the class signature. Your product bypass this leak, but is it possible to work with it the same way using the debugger instead of making the output of the compile on the directory where the application is deployed?
    No, sorry. It uses a completely different updating mechanism, which is at least at the moment not possible over the wire. In development it is mostly not a problem to set up compilation this way.
  34. Pretty cool stuff. I like the usability of it. Kinks will be fixed up, I'm sure. We have developed our own peer class loading and I can attest that this stuff is very hard to get right from the beginning. Anyways, JavaRebel looks really neat! Best, Nikita Ivanov. GridGain - Grid Computing Made Simple
  35. Hi, I am curious to know how JavaRebel handles a change that spans multiple class files such as the removal of a public method or field from one class that is called by another class file that is also changed. I suspect removal is not that common but I am interested to know whether this is indeed supported. How does it handle in concurrent executions across multiple code bases and object state? Are threads suspended? Can you please list any code related gotchas as well as the additional memory requirements if any for tracking objects (and state). regards, William
  36. Another question I have relates to how this handles reflection (class meta-data) caches held by many frameworks including persistence and aspect oriented interfaces even those proxy based. The problem here is that we are not only talking about code changes here but also configuration files. I suppose this solution is geared toward development and were the developers understand the implications of code changes in relates systems and components. I have not downloaded it yet but I am really curious about what this can and cannot do and how it is implemented in a safe manner to ensure the cycle of debugging (or testing) is not completely broken. I will have download the tool and fire up my runtime class meta-data explorer to see what is going in under the hood. regards, William
  37. Another question I have relates to how this handles reflection (class meta-data) caches held by many frameworks including persistence and aspect oriented interfaces even those proxy based. The problem here is that we are not only talking about code changes here but also configuration files. I suppose this solution is geared toward development and were the developers understand the implications of code changes in relates systems and components.
    Caches are a problem, a lot of developers assume reflection will always return the same methods, although Java spec doesn't really say that. We'll just have to work with the frameworks at some point. Same goes to configuration, JavaRebel only handles class reloading.
  38. Have you thought about...[ Go to top ]

    Wiring this up to Terracotta? One technology pulls the state out of the running object instances. The other allows you to change the class definition on the fly. Could be interesting... Hmmm. --Ari
  39. Another question I have relates to how this handles reflection (class meta-data) caches held by many frameworks including persistence and aspect oriented interfaces even those proxy based. The problem here is that we are not only talking about code changes here but also configuration files. I suppose this solution is geared toward development and were the developers understand the implications of code changes in relates systems and components.

    Caches are a problem, a lot of developers assume reflection will always return the same methods, although Java spec doesn't really say that. We'll just have to work with the frameworks at some point. Same goes to configuration, JavaRebel only handles class reloading.
    It looks like there are some issues with reflection even without framework caching. If I add a public method to a class, after the class gets reloaded the added method doesn't show up via reflections. I'm guessing this should be fixable. I'll try and log an example case in the forums. Regardless, JavaRebel is awesome. Even with its quirks, my productivity has increased. I'll be buying a license.
  40. Hi,

    I am curious to know how JavaRebel handles a change that spans multiple class files such as the removal of a public method or field from one class that is called by another class file that is also changed. I suspect removal is not that common but I am interested to know whether this is indeed supported. How does it handle in concurrent executions across multiple code bases and object state? Are threads suspended?
    First of all there is no real problems with multiple modifications. E.g. I've been doing method rename refactors over a large code base. There are some quirks with concurrency at the moment, but mostly connected to reloading classes before compiler finished writing them and similar. The core logic should be fine. You should also remember that the tool is only targeted for development (at least at the moment), so if a border case comes up very rarely it is not really a problem to restart the server. I know of a number of border cases that won't be reloaded now, but they will be fixed by the final release.
  41. Nice[ Go to top ]

    Now Java will be almost as interactive and productive as Smalltalk, Ruby, Groovy, and ... I just wonder why this doesn't come from Sun. Instead of improving their hot code replacement feature they put loads of all other kinds of things into every new JDK ... Regards, Oliver
  42. Re: Nice[ Go to top ]

    Now Java will be almost as interactive and productive as Smalltalk, Ruby, Groovy, and ... I just wonder why this doesn't come from Sun. Instead of improving their hot code replacement feature they put loads of all other kinds of things into every new JDK ...

    Regards, Oliver
    Good question, my personal guess is they simply couldnt pull it off in a safe manner, and sun has the habit of trying to make things 100% save. The main problem I see is, that a dynamic class reloader while having its merits in a production system is most important in development systems where you dont need 100% safety but you need everything in your hands to keep useless development downtimes at a minimum. I think the guys who programmed this have a much saner approach to the problem by just telling, dont use it in production and there are some cases which cannot workout fully, but then simply restart the webapp/server.
  43. Re: Nice[ Go to top ]

    I am amazed that it can be done in Java. I thought it could only be done in the C code of the VM.
  44. Re: Nice[ Go to top ]

    I am amazed that it can be done in Java. I thought it could only be done in the C code of the VM.
    Did you get it to work with Tomcat in the end?
  45. Re: Nice[ Go to top ]

    I am amazed that it can be done in Java. I thought it could only be done in the C code of the VM.


    Did you get it to work with Tomcat in the end?
    I visited my mom after work and there was no more time left to try it out, I have my hopes set on tonight ;)
  46. Re: Nice[ Go to top ]

    I am amazed that it can be done in Java. I thought it could only be done in the C code of the VM.


    Did you get it to work with Tomcat in the end?


    I visited my mom after work and there was no more time left to try it out, I have my hopes set on tonight ;)
    If you'll still have any trouble let us know via support (at) zeroturnaround (dot) com.
  47. You are my personal Jesus Christ the Saviour. Trying this out right now. If it works i would had been ready to pay much more. /Henkka Karapuu
  48. User experience[ Go to top ]

    I am not completely neutral in the topic as I work within the company who invented JavaRebel, but we as a regular Java shop are currently using it in all our projects (30+) and all developers are really happy with it.
  49. other agents[ Go to top ]

    How does this work when other agents (e.g. Toplink) are active?
  50. Apache Commons JCI has been providing a reloading classloader for some time and the Apache Cocoon project has been using it. Since this year there is also an official release of the JCI library. Using the reloading classloader for development is really awesome. For Cocoon 2.2 we provide a Maven 2 plugin that does almost all the configuration for you by weaving in the reloading classloader support. And yes, if you use frameworks like Spring it isn't enough to just reload classes because e.g. once a bean is loaded into the singleton scope, the class definition isn't required anymore. Also, XML bean definition files can change. The Cocoon integration takes care for this by resetting the Spring application context if required. Find more information at http://www.indoqa.com/en/people/reinhard.poetz/blog/560
  51. Well, JavaRebel updates not only class definitions, but also all of the object state so there is no need to reload Spring context. Solutions like JCI have existed for some time and just are not enough (we did even more for Aranea by also serializing/deserializing object state, but that still wasn't enough).
  52. The manipulation of the object state sounds nice :-) But this still doesn't solve the problem if e.g. a Spring application context is setup using an XML file and there is a change in the dependency graph, a bean added/deleted etc. Do you provide any hooks so that you can react on a changing resource?
  53. The manipulation of the object state sounds nice :-) But this still doesn't solve the problem if e.g. a Spring application context is setup using an XML file and there is a change in the dependency graph, a bean added/deleted etc. Do you provide any hooks so that you can react on a changing resource?
    JavaRebel only solves class reloading while preserving object instances. We realize that it doesn't solve all problems, but it solves a lot of annoying problems, where small changes take a lot of time. We have some ideas for other changes as well.
  54. I have got it working, it is hard to express how this makes me feel, liberated comes close
  55. The location of classes[ Go to top ]

    How exactly the location of classes is determined? We don't place our classes under WEB-INF/classes. Instead, we have a custom ClassLoader that loads classes from multiple locations which helps us support our multi-project application structure. I've tried JavaRebel, but it wasn't able to location our classes as far as I can tell. The custom ClassLoader is a subclass of URLClassLoader so it should be possible to determine the URLs with class locations from it...
  56. Re: The location of classes[ Go to top ]

    How exactly the location of classes is determined? We don't place our classes under WEB-INF/classes. Instead, we have a custom ClassLoader that loads classes from multiple locations which helps us support our multi-project application structure.

    I've tried JavaRebel, but it wasn't able to location our classes as far as I can tell. The custom ClassLoader is a subclass of URLClassLoader so it should be possible to determine the URLs with class locations from it...
    Sorry, custom classloaders are not supported at the moment. If you post a feature request at ZeroTurnaround forum we might work something out in some time.
  57. Re: The location of classes[ Go to top ]

    How exactly the location of classes is determined? We don't place our classes under WEB-INF/classes. Instead, we have a custom ClassLoader that loads classes from multiple locations which helps us support our multi-project application structure.

    I've tried JavaRebel, but it wasn't able to location our classes as far as I can tell. The custom ClassLoader is a subclass of URLClassLoader so it should be possible to determine the URLs with class locations from it...


    Sorry, custom classloaders are not supported at the moment. If you post a feature request at ZeroTurnaround forum we might work something out in some time.
    Just out of curiosity: How does JavaRebel work with application servers then? At least WebLogic and JBoss do use custom classloaders. Regards, Dirk
  58. my valuation of JavaReble[ Go to top ]

    I tried JavaRebel to help me save time when deploy application into tomcat.my application is using spring. as some above comments say, JavaRebel not only reloads the class definition but also keeps the object states.that sounds really cool. 1. However actually every time I changed a java file, JavaRebel still triggered reloading spring context. is it supposed? 2. normally for a deployment without JavaRebel, my tomcat takes 28 seconds to make it ready for service. however with JavaRebel, it takes 49 seconds for the first deployment and about 31 seconds for redeployment. 3.my application includes class A, and A depends on javax.jms.MessageListener, if I deploy this application in JBoss, this application will use class A, while in Tomcat it never uses class A. if I use JavaRebel in tomcat,JavaRebel throws java.lang.NoClassDefFoundError unless I copy JBoss-j2ee.jar to tomcat. Hope JavaRebel can conquer these problems.
  59. my mistake.[ Go to top ]

    "1. However actually every time I changed a java file, JavaRebel still triggered reloading spring context." not the problem from JavaRebel, I should have disabled "reloadable" for tomcat configuration file "server.xml" now happy to use JavaRebel although the first deployment becomes slow and I have to copy some unnecessary jar files to my application.