Tool usage for cainiao tutorial (iv) -- use jrebel to enable tomcat to support hot deployment

Source: Internet
Author: User
JRebel是一个J2EE热部署的工具。使用它可以减少浪费8-18%的开发时间在项目的构建和部署上。虽然Java也提供了HotSpot的JVM,但是如果你修改的类中有方法名称变动的话,HotSpot就无能为力了,必须要重要启动应用服务器。JRebel则可以动态监视class文件及配置文件,如果有文件更新,被调用时就会被JRebel重新加载,达到热部署的目的。

JRebel不仅可以在开发阶段实现热部署来提高开发效率,在项目部署投入使用以后也支持动态的加载,从而可以帮助程序完成一些特殊的功能,让程序变得更加灵活。下面我们一起来看看它到底怎么用吧。

开发阶段:

JRebel支持Eclipse、MyEclipse、IntelliJ、NetBeans等众多IDE,我们以Eclipse为例,在Eclipse中想要使用JRebel,我们需要安装一个插件,可以在Eclipse Marketplace中搜索安装,也可以使用install new software通过URL来安装。url为:http://www.zeroturnaround.com/update-site/。具体怎么安装插件就不赘述了,不知道的自己百度一下。

安装完插件,Eclipse重启,然后按照下面的步骤配置即可:

Window——>Preferences——>JRebel



点击“JRebel Config Center”按图勾选,并添加自己下载的JRebel的jar包以及lic文件。



最后配置Tomcat的属性,按勾选相应属性即可。


部署后的动态加载:

配置很简单,只需要设置两个环境变量即可,

环境变量名:JAVA_OPTS环境变量值:-javaagent:%REBEL_HOME%\jrebel.jar -Drebel.hibernate_plugin=true -Drebel.spring_plugin=true -Drebel.struts2_plugin=true环境变量名:REBEL_HOME环境变量值:D:\jrebel-5.6.3-crack(这个路径就是你JRebel的解压目录)

 


接下来运行Tomcat的startu.bat,在开头会出现以下信息:
2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel: #############################################################2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel:  JRebel 5.6.3 (201409050929)2014-10-08 21:22:08 JRebel:  (c) Copyright ZeroTurnaround OU, Estonia, Tartu.2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel:  Over the last 2 days JRebel prevented2014-10-08 21:22:08 JRebel:  at least 43 redeploys/restarts saving you about 1.7 hours.2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel:  This product is licensed to anonymous-user2014-10-08 21:22:08 JRebel:  for unlimited number of developer seats on site.2014-10-08 21:22:08 JRebel:  ####### Cracked by anonymous-user, For FUN! Unlimited! Enjoy! ######2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel:  The following plugins are disabled at the moment:2014-10-08 21:22:08 JRebel:  * Axis2 WAS plugin (set -Drebel.axis2_was_plugin=true to enable)2014-10-08 21:22:08 JRebel:2014-10-08 21:22:08 JRebel: #############################################################2014-10-08 21:22:08 JRebel:

 


ok这样表示已经配置成功了,如果环境变量不起作用,可以在Tomcat的startup.bat的开头加入如下代码:

@echo offset JAVA_OPTS=-javaagent:[path/to/]jrebel.jar %JAVA_OPTS%call "%~dp0\catalina.bat" %*

 


[path/to/]为你的JRebel解压目录。

好了,这样就都配置好了,快快感受一下吧!

附JRebel破解版:jrebel-5.6.3-crack 破解版

菜鸟教程之工具使用(四)——借助JRebel使Tomcat支持热部署

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.