We're going to walk through the installation of JRebel on a Wildfly/JBoss server.
If you need a primer on Wildfly first, check out our What Is Wildfly? blog.
Step 1: Download and Install JRebel
To install JRebel for your application, first, you will need to install the JRebel plugin for your respective IDE. For this example, I'm using IntelliJ. To download the plugin, please go to the plugins tab in the preference/settings and search for JRebel and hit install. Once installed, we are going to enable JRebel for your project.
Step 2: Configuring JRebel for Wildfly with Intellij
We are first going to enable each project or module in your workspace with JRebel by checking the left check box within the JRebel panel located on the bottom left corner of my IntelliJ window. Checking that box will add an XML file to each module. After checking each module, I'm going to run a build so the application will include the new XML file.
Enable JRebel on the Wildfly Server
While the application is building, I am now going to enable JRebel on my Wildfly server. Proceed to the JRebel configuration window, click on the dropdown and select JRebel startup. Within the startup section, JRebel provides you three options for your application deployment. These include an internal IntelliJ deployment, run via command line option and remote deployment. The run via IntelliJ provides two new buttons that will look like the icon shown here. By using these buttons to run your application, JRebel will immediately be added to your existing IntelliJ run configurations.
Step 2a: Configuring JRebel for Wildfly via Commmand Line
Today, I will be covering the run via command line option. To do this, we are going to first select run via command line and change our target server to Wildfly. Next, the following instructions will appear. From here, we are going to copy the following lines to our clipboard by hitting this button. Next, we are going to create a new file by pasting the copied text and creating the file standalonejrebel.sh within the bin folder of our Wildfly server or the same location of your standalone .sh file.
Now the application has been built and the server is updated with the JRebel agent path argument, I'm going to run the application with JRebel to reflect changes at runtime. To run the application, we are going to use the standalone-JRebel.sh instead of the standalone.sh. After starting the application you will know that you have properly added JRebel if you were able to see the following JRebel banner.
Now the application is deployed, we are now going to add a new method to the application that will change the request from a remote request to an internal database. To do this, I'm going to open IntelliJ and uncomment the run, get local command and comment out the get remote command. Now that the change has been made, I'm going to save and compile this application using the IntelliJ compiler. Once I return to the application, I can refresh the page and now I can see showing JRebel within the table and I know that the changes are reflected instantly.
Want to try JRebel on your Wildfly/JBoss project? Try it free for 10 days with a free JRebel trial.