Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

How to use JRebel (Java Rebel) for a Java Web Application

In this article we will learn why the JRebel is needed and also how to configure and use JRebel for Eclipse IDE in Java Development.

Introduction

JRebel is a non-commercial development tool that is being used for web application deployment. It is auto web deployment tool that reduces the time consumption for web application deployment. JRelbel can be installed as a plugin for Java IDE or can be installed downloaded via available jar file. It can be used online or offline.

JRebel in Detail:

JRebel is the java Web development tool that helps us to save our time consumed in application deployment. JRebel automatically takes care of Java Web Application deployment. JRebel is available as IDE Plugin or as a bundled with jar file. A jar file can be downloaded from its official website: http://www.zeroturnaround.com/jrebel/current/

Or a plugin can be downloaded from IDE marketplace or via official website.

Once we have configured JRebel for our system or IDE, we will need to activate license for JRebel. There are two kinds of license available:

  • Social License or Non - Commercial
  • Commercial

Before using JRebel for our java project, we are required to activate the JRebel license. We are asked to place JRebel License key to be passed or place license url.

Now, let’s start with Eclipse IDE with JRebel. Before using JRebel in Eclipse, we are required to configure JRebel with following listed steps:

  • Open Eclipse Marketplaced using Help->Marketplace as shown in Figure1
JRebel for Eclipse

Figure 1: JRebel for Eclipse

The above figure shows list of plugins, click install button for “JRebel for Eclipse” plugin. If plugin is not listed in the list, the search for the keyword “JRebel for Eclipse” and press Install.

  • Now, It will search for required dependencies, then you will be asked to acep an agreement to install this plugin as shown in Figure 2
Eclipse search for requirements and dependencies to install JRebel Plugin

Figure 2: Eclipse search for requirements and dependencies to install JRebel Plugin

Once Eclipse search for requirements and dependencies, then press next button.

  • Now accept the agreement, then press finish to start installation as shown in Figure 3:
Accept terms of license agreement and finish to start installation

Figure 3: Accept terms of license agreement and finish to start installation

Once installation is being started, it can be moved to background installation. After JRebel plugin installation, we are asked to restart Eclipse IDE. We get a notification to activate JRebel plugin as shown in Figure 4:

JRebel Activation Notification

Figure 4: JRebel Activation Notification

Once Eclipse IDE has been restarted, we are asked to activate JRebel plugin. To open activation wizard, click on “Open Config Center”. To get JRebel activation license key, we have to register on URL: http://www.zeroturnaround.com/

Now to activate the license of JRebel, place the activation code into box as shown in Figure 5:

Activate JRebel License

Figure 5: Activate JRebel License

To activate JRebel license, there are three ways:

  • Using License Key File
  • Paste the license key nto the text box
  • Using License Server 2.x Access Token URL

After activation, Go to Project and choose Build Automatically. We also need to setup application or webserver for JRebel plugin. Open web server configuration panel and set publishing to “Never publish automatically”. JRebel Integration, Enable JRebel Agent.

Set up web server for JRebel plugin

Figure 6: Set up web server for JRebel plugin

The above figure shows, how do we setup web server for JRebel plugin. Now To set up JRebel with Java Web Project, we are required to set up rebel.xml file into our project. This file should be kept into the directory path:

WEB-INF/classes/rebel.xml
Or
Into src/ directory using eclipse IDE.

rebel.xml file is automatically generated using eclipse IDE. To generate rebel.xml file, right click on the project and go to JRebel -> Add JRebel Nature as shown in the below figure:

Add JRebel Nature to the web project using Eclipse IDE

Figure 7: Add JRebel Nature to the web project using Eclipse IDE

The above figure shows how to add JRebel nature to web application project. This will add rebel.xml file to the classpath of the project. We can also setup JRebel remote server for our web application. To set up JRebel Remote server, we are required to “Enable Remoting” as shown in Figure 8:

Enable JRebel Remoting

Figure 8: Enable JRebel Remoting

The above figure shows, how we enable JRebel Remoting for our web application. Once we have enabled remoting for our application, we are asked to place a remote url for its configuration as shown in Figure 9:

Deployment URL for JRebel Remoting

Figure 9: Deployment URL for JRebel Remoting

The above figure shows, how do we enable JRebel Remoting and place deployment url.

This file informs about the class and resource files using rebel.xml file. We are required to have rebel.xml file should be associated with each module. Hence rebel.xml file should be associated with EJB modules and web modules.

Once we have added JRebel Nature with the web project, rebel.xml file is added to the classpath of the project as shown below in Listing 1:

Listing 1: rebel.xml

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
	<classpath>
		<dir name="E:/Tutorial/EclipseWorkspace/webWorkplace/OnlineExamProject/build/classes">
		</dir>
	</classpath>

	<web>
		<link target="/">
			<dir name="E:/Tutorial/EclipseWorkspace/webWorkplace/OnlineExamProject/WebContent">
			</dir>
		</link>
	</web>
</application>

Listing 1 defines rebel.xml xml file which is generated by Eclipse IDE automatically for “OnlineExamProject”. It defines the classpath location and web content location to be uploaded, if required.

Once JRebel Remoting is enables for the web project a new xml configuration file is also generated by Eclipse IDE named rebel-remote.xml file as listed in Listing 2:

Listing 2: rebel-remote.xml

<?xml version="1.0" encoding="UTF-8"?>
<rebel-remote>
    <id>OnlineExamProject</id>
    <publicKey>308189028181008729cd067c6d858a857f886eb51c144b7ecbdaaccf0db80382041400e1717e8852c1474ea4a71db6abfe7d129a2aa7cdecc773b7bb2c1d882d933486a2f7cefab65e7114b0bbce40b419d455f21ad6df4f619f3060c4c51202ff1e0f73e095c89e7311814196fac44fb87ce129459c6c7e5d95cdb667c0816a4ff1e600c6dfbb0203010001</publicKey>
</rebel-remote>

Listing 2 defines the rebel-remote.xml xml configuration file which is generated by Eclipse IDE, while JRebel Remoting is enabled to the web application.

In this article, we define a OnlineExamProject Application that uses the JRebel Nature to save our development time consumed in Re-Deploying an application for instant changes without restarting container or redeploy an application. Once an application has been deployed with JRebel Nature, we are not required to worry about the taking care of redeployment our web application for instant changes.

To deploy our web application with the JRebel Nature, right click on the web application and go to Run As -> Run on Server. This will create deployment logs in the console window with server start and JRebel configuration as shown in Figure 10:

Created logs in console while deploying Web application with JRebel Nature

Figure 10: Created logs in console while deploying Web application with JRebel Nature

The above figure shows the logs created for web server and JRebel environment created to deploy a web application.

JRebel Working Cycle:

When We are required to update configuration for Java code, annotations, XML files , property files and so on. An application is redeployed. This configuration can easily achieved using JRebel. JRebel uses configuration specific plugin to reload these configurations instantly. JRebel integrates with JVM and application servers mainly at the class loader level. It means that it doesn’t create class loaders. It just extends the class loaders existing to manage reloading of classes. When a java class file is added to the application, JRebel looks for the .class file for the corresponding java class file. The JRebel will look into the rebel.xml for the classpath of the application like “WEB-INF/classes”.

If the .class file is located into the classpath, it will be associated with the found .class file and the .class file timestamp is then monitored for changes in the loaded class. The class file updates will be propagated by extending the class loader as updates. We can also define the jar file path into the rebel.xml JRebel configuration file so that a class file can be searched into the jar files. Required Tools and Application:

To create a JRebel based web application, we are required following set of tools:

  • Eclipse IDE (like Eclipse Juno)
  • JRebel Plugin (Configured using eclipse marketplace)
  • Database and database connector (if database is required for a web application)

Conclusion

In this article, we learn about JRebel development tool that helps us to save our development time. We learn, how we configure JRebel plugin into the Eclipse IDE. We also learn activation procedure for JRebel and integration of JRebel to our web application.



I am a software developer from India with hands on experience on java, html for over 5 years.

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login