JRebel cache not synchronizing

If you are the happy user of JRebel you may not be quite happy for 2 reasons:

  • you 14-day trial licence will expire soon (here I can’t help)
  • JRebel is not working

There are common issues about JRebel discussed like rebel.xml and rebel-remote.xml location, JVM property for remoting set, but nothing is said about my problem with caches so here I’ll try to describe it.

The problem is that local JRebel cache classes are used instead of my IDE compiled classes.

I don’t know why; I will investigate. For now I have a quick fix…

I’m using the following tools:

  • Weblogic 12c with jrockit 1.6
  • IDEA 12.1.0
  • Maven

For JRebel configuration I’m using the following config line:

-javaagent:C:/dev/tools/jrebel-5.3.2-nosetup/jrebel/jrebel.jar -Drebel.remoting_plugin=true -Drebel.log=true -Drebel.resource_cache=false -Drebel.remoting.cacheDir=C:\dev\MVNecare\jrebel_cache

As you can see I’m using JRebel remote feature but for local development (server runs on my local machine). My application is build with maven to the very different folder

C:\dev\MVNecare\exploded

My server domain is pre-configured to deploy application from this exploded folder on startup.

So what I want from JRebel is to monitor this place, and reload / redeploy classes that have changed.

But JRebel have a cache folder

C:\dev\MVNecare\jrebel_cache

Default location is

C:\Users\amatveev\.jrebel\cache

you can override location with property

-Drebel.remoting.cacheDir=<location>

In this folder JRebel is storing all my application classes that I expect to be monitored.

And the point is that this cache is not updated when I click on “Synchronize” button in JRebel plugin!

So if there are changes after my Maven build, classes will still be looked up from this cache and nothing will be redeployed. If I manually copy compiled output into this cache JRebel will work, but this is a pain. Also if I delete some class or static resource as *.xhtml page from this cache, server will not return it, as there is no such page at all!

Another thing is resources. JRebel provide a JVM flag

-Drebel.resource_cache=false

From different forum threads I discovered that with this flag JRebel should not cache the static resources as *.jsp or *.xhtml or *.properties. But actually it does. If I try to modify resource in 

C:\dev\MVNecare\exploded

there will be no effect untill I change it in

C:\dev\MVNecare\jrebel_cache

I think you get the point – caching is everywhere.

I need to copy paste my compiled classes to this cache folder in order to make JRebel know about changes.

Maybe it’s only me having this problem but I’m confused not be able to discover the solution in the internet.

Anyway, here is my quick fix

As I’m using IDEA 12.1.0, I just tell the IDE compiler to output files in JRebel cache directory, so I don’t need to copy them myself.

After that of course I can see that JRebel is working

Hope this will help someone. Don’t hesitate to ask questions.




UPD: 


I figured out what the problem was. It was JRebel remoting.

Once I turned it off, JRebel start taking classes and resources from the paths declared in rebel.xml.


It seems that all this caching stuff is about remoting to reduce the network load during reloading classes from remote host.


Maybe that’s why it’s not good to use remoting during local development. To say the truth, now I even don’t know why I turned it on.


So in the end to fix the cache hell:

  • delete rebel-remote.xml from source paths and deployed application
  • delete remoting related JVM properties from server startup
  • disable remoting in IDE plugin

to reload classes you don’t need to click on “Synchronize” button any more, just be sure that new files are updated in rebel.xml paths and request you server

Leave a Reply

Your email address will not be published.