JRebel with JDeveloper and ADF¶
This tutorial has been created and hopefully provides input for JDeveloper and ADF users who might be struggling with JRebel.
ADF is supported with JRebel version 2022.1.2.
Things to consider¶
Working with JDeveloper and ADF follows its own peculiarities. For reloading to work, you must consider these simple guidelines:
Turn off fast swap when enabled.
Always make your project after modifying the code. JRebel reloads only compiled classes – and JDeveloper does not have an auto-compile function (whereas Eclipse does). Making the project is necessary for the changes in Java code to be reloaded. Changes in non-java files might or might not require making the project to be reloaded. This depends on the project structure and
Changes such as modifications of page definitions require a new JSF view to be created. The recommended and easiest method to achieve this is to reload the page URL without any GET parameters.
Avoid rebuilding projects when a container is running with JRebel enabled. Rebuilding modifies all files, causing JRebel to reload them which can be quite time-consuming.
Reloading does not work¶
Once you have successfully activated JRebel, generated a
rebel.xml, and the JRebel banner is shown in the console when starting WebLogic – but reloading does not work, there are several things you must check.
Enable JRebel log. You can find this under Tools > Preferences > JRebel. Choose debug level logging and enable request log.
After starting the application and opening a test page, open the JRebel log and search for
rebel.xml. You can view the
rebel.xmlfiles. If some of them are missing from the log, refer to the ‘’I cannot see my
rebel.xmlin JRebel log’’ section below. If you see the
rebel.xmlfiles, continue to the next step.
rebel.xmlis rather complex for ADF applications, so it is strongly recommended to start with an automatically generated
rebel.xml. Open Project Properties > JRebel > Generate now!
The automatically generated
rebel.xmlmust be tweaked manually. Some ADF projects that contain web resources are deployed as JARs. The “web” element in
rebel.xmldoes not work for JARs, so if your
rebel.xmlwas generated with this element, just move the “dir” element(s) from “web” to “classpath” and remove the “web” element.
If you follow all the JDeveloper specific rules and have gone through all the previous steps, but reloading still does not work, write to firstname.lastname@example.org. Provide a detailed description of your setup and the changes that you expect to be reloaded. Attach your JRebel log to the email. If possible, create and send a small application that can be used to reproduce the issue, which can be immensely helpful for bug fixing.
I cannot see my rebel.xml in JRebel log¶
JRebel is operating in the application server and not within the IDE. Therefore, it knows nothing about the IDE projects. What’s important is what the deployed application looks like. Usually you can find the deployed application in
In the case of JDeveloper, multiple projects are sometimes packaged into a single archive. In this case only one project can have
rebel.xmlin which resources from both or all projects are mapped.
If your project has separate folders for application and test sources (as is usually the case with Maven applications),
rebel.xmlmight be generated in the test folder. It will be ignored when packaging or deploying the application. In this case you simply need to move the file to the application sources folder and make sure that you do not include the folder containing test classes in the
Example of rebel.xml configuration for typical ADF application¶
Let us configure JRebel for a typical ADF application. Our application consists of 3 projects:
Model – includes a single deployment profile and is deployed as a JAR.
ViewController – includes a single deployment profile and is deployed as WAR.
CompanyViewController – includes a single deployment profile and is also deployed as a JAR.
However, if we created
rebel.xml files based on this information, we might encounter an unpleasant surprise. In reality only
Company_adflib.jar created from CompanyViewController is present in
WEB-INF/lib of the WAR module.
The Model project is configured as a dependency for both ViewController and CompanyViewController projects. Therefore, classes and resources from the Model project are included in both
WEB-INF/classes of the WAR module.
The whole WAR module is loaded by one classloader – as duplicate classes and resources do not cause any problem. Since there are two physical modules (WAR and
Company_adflib.jar) you may need two
rebel.xml files in ViewController and CompanyViewController projects respectively. The content of these files is shown in the following code block. Note that classes and resources from Model project are mapped in the
rebel.xml that is in ViewController (WAR module). Also notice that there is no element in the
rebel.xml that is inside CompanyViewController. The folder
public_html that contains web resources is mapped in classpath.
rebel.xml from ViewController project¶
<?xml version = '1.0' encoding = 'UTF-8'?> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd" xmlns="http://www.zeroturnaround.com"> <classpath> <dir name="C:\workspaces\jdev_ws1\184.108.40.206\JRebel\ViewController\adfmsrc"/> <dir name="C:\workspaces\jdev_ws1\220.127.116.11\JRebel\ViewController\classes"> <include name="**/*.class"/> <exclude name=".wlsjsps/**"/> </dir> <dir name="C:\workspaces\jdev_ws1\18.104.22.168\JRebel\ViewController\src"> <exclude name="**/*.java"/> </dir> <dir name="C:\workspaces\jdev_ws1\22.214.171.124\JRebel\Model\classes"> <include name="**/*.class"/> <exclude name=".wlsjsps/**"/> </dir> </classpath> <web> <link target="/"> <dir name="C:\workspaces\jdev_ws1\126.96.36.199\JRebel\ViewController\public_html"/> </link> </web> </application>
rebel.xml from CompanyViewController project¶
<?xml version = '1.0' encoding = 'UTF-8'?> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd" xmlns="http://www.zeroturnaround.com"> <classpath> <dir name="C:\workspaces\jdev_ws1\188.8.131.52\JRebel\CompanyViewController\adfmsrc"/> <dir name="C:\workspaces\jdev_ws1\184.108.40.206\JRebel\CompanyViewController\classes"> <include name="*.class"/> <exclude name=".wlsjsps/**"/> </dir> <dir name="C:\workspaces\jdev_ws1\220.127.116.11\JRebel\CompanyViewController\src"> <exclude name="*.java"/> </dir> <dir name="C:\workspaces\jdev_ws1\18.104.22.168\JRebel\CompanyViewController\public_html"/> </classpath> </application>