日期:2014-05-16  浏览次数:20497 次

Hot deployment in sandbox -- JRebel

If you want to change the java source code, and test the code in sandbox, you can take a look.

Generally, if we update the code, we need to rebuild it and restart the tomcat. It takes too much time. Here are the steps to make it more simple and efficient.
1)?Install Jrebel in eclipse (Click “Eclipse Marketplace…” -> search for Jrebel and install, then restart eclipse)
2)?Register Jrebel.
3)?Update tomcat configuration below in file “%TOMCAT_HOME%/bin/catalina.bat”. Also you can unshelved my CL #942380.
set Jrebel=-noverify -javaagent:"D:/dev/eclipse/plugins/org.zeroturnaround.eclipse.embedder_5.5.1.RELEASE-201402211559/jrebel/jrebel.jar" -Drebel.dirs=D:/dev/expweb/trunk/hotel.ui/src/com/expedia/www/hotel/ui -Drebel.log=true -Drebel.log.stdout=true

if not "%LOGGING_CONFIG%" == "" goto noJuliConfig
set LOGGING_CONFIG=-Dnop
if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig
set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
:noJuliConfig
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% %Jrebel%


if not "%LOGGING_MANAGER%" == "" goto noJuliManager
set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
:noJuliManager
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% %Jrebel%
4)?Start expweb: gradlew startExpweb –PJrebel
5)?Currently, we need to copy the class to the deployment directory: D:\dev\expweb\trunk\build\tomcat\webapps\ROOT. Then tomcat will reload the class and you can get the information in tomcat console.

Please let me know if you have any concerns and improvements.