Hello Guys ,
Before go to configuration of JRebel with Hybris we
need to understand about use of JRebel
and Purpose of use of JRebel with Hybris.
So What is JRebel
?
JRebel is a JVM Java Agent that integrates with application servers, making classes
reloadable with existing class loaders. Only changed classes are recompiled
and instantly reloaded in the running application.
JRebel plugs into IDEs and build systems. Classes and static
resources are loaded straight from the workspace.
Now How to Use JRebel in your Hybris project
So follow below steps to configure JRebel in your Hybris project
1. Download JRebel
from https://zeroturnaround.com/software/jrebel/download/
now unzip JRebel
. Lets i have unzip in c:\jrebel
2. Now create conf folder into c:\jrebel as below
3. Create jrebel.properties
into conf folder
4. Now set environment variable REBEL_HOME
5. After finish all
these setting open your Hybris's
Local.properties file put below line into there
tomcat.javaoptions=-Xverify:none -javaagent:"C:/jrebel/jrebel.jar=de.hybris.tomcat.HybrisWebappClassLoader60"
tomcat.debugjavaoptions=-Xverify:none -javaagent:"C:/jrebel/jrebel.jar=de.hybris.tomcat.HybrisWebappClassLoader60" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
6. Now you test whether JRebel
successfully configure in your hybris
run hybrisserver.bat and check your console with below
7. Now after successful test create jrebel.xml file into your extension (extension that you want to monitor
.class file ) as below . I have added into yacceleratorstorefront
extension
in this file we have to give location of your .class file which create after build .
<?xml version="1.0"
encoding="UTF-8"?>
<application generated-by="eclipse"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="E:/HybrisDevelopment23032016/hybrisnew/hybris-commerce-suite-5.1.0.0/hybris/bin/ext-template/yacceleratorstorefront/web/webroot/WEB-INF/classes">
</dir>
</classpath>
</application>
8. Now your JRebel is ready for use
So now how it works lets in login page of your storefront it
call LoginPageController.java where i will put a console message
System.out.println("JRebel Test -- Java file change ");
and will test without
restart server
now put below line in your controller
after you need to open another
cmd and do only ant build
> ant build
after did if you see your hybris running server console you can see the change JRebel message of .class file as below
Now after hit your login url you can see your SOP
message will print in console as below
Im thankful for the article post.Thanks Again. Fantastic.
ReplyDeletedot net online course
. net online training