How to use DCEVM a alternative of JRebel with Hybris ? Step by step to configure DCEVM with Hybris

                                                         DCEVM + Hybris
Those of you who work with hybris development on a daily basis know very well that application build and server restarting is annoying. when you make just a small change in your Java class, it still takes at least a 3-5 minutes for the change to be reflected because the whole application will need to be build and restart server.
Dynamic Code Evolution Virtual Machine (DCEVM) is fast tracks Java application development by skipping the time consuming build and server restart steps in the development process. DCEVM makes developers more productive since they can view code changes in real time.
DCEVM can use in two mode with hybris. You can use any one of below for your Hybris project
1.  Only using DCEVM patch. -No require any configuration in hybris's Local.properties file
2.  DCEVM patch + Hotsawp agent. - require configuration in hybris's Local.properties file.

DCEVM patch
Below steps you need to require to run your hybris project  with DCEVM patch
1.  Before download check your java version installed in your system ( JDK 8 or JDK 7) and set
     JAVA_HOME
    

2. Now download DCEVM patch ( version according to your system's JDK)
    https://github.com/dcevm/dcevm/releases

Now run DCEVM installer and install "Install DCEJVM as altjvm" as below


3.  Now start your eclipse and do your eclipse workspace setting
     windows > preferences > workspace  check as below


Now import your Hybris project in workspace
After import your project,  make sure that your eclipse's build automatically is enable  and it should successfully  build the hybris project.

So for successfully eclipse build you need to import all extension in your workspace which is require to make the build successfully.
After import all your require extension, your workspace looks lot of extension but your's project specific you need only few extension only then you can use one of eclipse features "Working Set"
4. Now start your hybris server in debug mode
   > hybrisserverstsrt.bat debug
   After that start your eclipse in debug mode
 Now you can do change in your java file and save (because of your eclipse "build automatically" is  enable  so it will start your project build automatically just after save) then you can check you .class file changes.
Note: -  So DCEVM patch only work in DEBUG mode so always you need to make sure your server and eclipse is running in debug mode.
                                                   
                                            DCEVM patch + Hotswap
Below steps you need to require to run your hybris project  with DCEVM patch + hotswap
1.  Apart from above setting means install correct DCEVM installer + JAVA_HOME setting  , You need  download  hotswap agent
https://github.com/HotswapProjects/HotswapAgent/releases

2.  In this mode there is no require your eclipse's "build automatically " enable  so you disable these feature form your eclipse workspace as below

only Refresh will check box will checked because of in this mode build will do from outside of your eclipse so your eclipse workspace should refresh if any file changing from outside .

3. Now start your eclipse and import your hybris project into workspace . In this mode you can import your's require extension only because in this mode project will build form outside , Not from your eclipse's "build automatically" features.
4. Now you need to configure your Hotswap agent in your Local.properties file as below
tomcat.debugjavaoptions=-XXaltjvm=dcevm -javaagent:E:/hotswapagent/hotswap-agent-1.1.0-SNAPSHOT.jar=autoHotswap=true,disablePlugin=hibernate,disablePlugin=jetty,disablePlugin=JSF,disablePlugin=ZK,disablePlugin=Weld,disablePlugin=Seam -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
in above you refer location of Hotsawp Jar file as above
5. Now start your hybris server in debug mode
   > hybrisserverstart.bat debug

you can check your hybris log to start hybris server with hotswap

6. After start your hybris server , You can make change your in java file then you need to build your project by opening new command prompt and do build as below
   > ant build

 then after you can see your change of .class file
after ant build , If hotswap do successfully that can check your server log as below
Note :-  In second mode it is not mandatory to run your eclipse in debug mode 






9 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Unable to run the installer as its saying could not find the main class : com.github.dcevm.installer.Main.Program will exit

    ReplyDelete
  3. I have integrated DCEVM + HOTSWAP successfully but after doing any build the hotswap rebelpoy re-starts the server again instead of only deploying the changes. Please guide. Is this the behavior of hotswap redeploy.

    ReplyDelete
    Replies
    1. Can you please tell what is version of jdk you using .basically with java 8 it is unstable you need to check manualy yout hotswap plugin and make it disable

      Delete
    2. if you are using "ant all" it will restart your server. Use "ant build" and it should do the trick. I noticed that if you are building an "addon" project it may not work because it may require copying of the build files into correct locations.

      Delete
  4. Hi,

    when i tried in my system then i was facing below issue, could please guide me on this?

    JVM exited while loading the application.
    Reloading Wrapper configuration...
    Launching a JVM...
    Invalid layout of java.lang.Thread at name
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # Internal Error (javaClasses.cpp:127), pid=14256, tid=2376
    # fatal error: Invalid layout of preloaded class
    #
    # JRE version: (8.0_144-b01) (build )
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.51-b03 mixed mode windows-amd64 compressed oops)
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # D:\Mohawk_Project\hybris\bin\platform\tomcat\bin\hs_err_pid14256.log
    #
    # If you would like to submit a bug report, please visit:
    # http://bugreport.java.com/bugreport/crash.jsp
    #
    JVM exited while loading the application.
    There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up.
    There may be a configuration problem: please check the logs.
    <-- Wrapper Stopped
    An error occurred in the process.

    ReplyDelete
    Replies
    1. Did you get the solution for issue. I am also facing same issue.

      Delete
  5. Any one able to solve this issue?

    ReplyDelete