1、Jrebel介绍:
我们通常做WEB开发的时候经常会修改java类,或者是工程配置文件,而每次修改后都需要将服务器重新启动,才能显示修改后的效果,而有些服务器 像 weblogic ,jboss 启动的时候非常慢,频繁的启动浪费了大量的时间,降低了开发效率。
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Jrebel(JavaRebel) 可以帮助解决频繁的重新启动服务器的问题,从而为开发节约了大量的时间。
Jrebel是一个JVM插件(-javaagent),能够即时重载java <?xml:namespace prefix = st1 ns = "Tencent" /><rtx w:st="on">cl</rtx>ass更改,因此不需要重新部署一个应用或者重启容器,节约开发者时间。它是一个Java EE和Java 独立应用的常用解决方案。
Jrebel可以和MyE<rtx w:st="on">cl</rtx>ipse,tomcat等快速的组装在一起,用语动态部署java文件而不用重启服务器,从而可解决大量的开发时间,提高开发效率。
只要配置了Jrebel,它可以监控你的编译文件存放目录,例如:APP_INF/<rtx w:st="on">cl</rtx>asses 或者 WEB-INF/<rtx w:st="on">cl</rtx>asses 。
然后在客户端发送页面请求时,关联到该类时,它会自动比较当前JVM中装载的该类是否有修改,如果有则重新装载该类文件。
2 、Jrebel使用介绍
下面以Jrebel + E<rtx w:st="on">cl</rtx>ipse,Jrebel+Jetty为例,介绍Jrebel的在项目开发,部署环境的搭建即使用。
配置方法:
3、在jetty的目录下找到etc目录下的webdefault.xml文件,只要把找到useFileMappedBuffer参数,把值设成fa<rtx w:st="on">ls</rtx>e。结果如下:
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>fa<rtx w:st="on">ls</rtx>e</param-value>
</init-param>
这样就完成了,重启Jetty,以后修改java文件就不需要重新启动了。
如果你看到服务器控制台上有如下或相似的提示,那么恭喜你成功了!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
JRebel: Please rename 'jrebel<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">4.0.2</chsdate>.jar' to 'jrebel.jar'
JRebel: or add '-Xboot<rtx w:st="on">cl</rtx>asspath/a:D:\so<rtx w:st="on">ft</rtx>\jrebel\jrebel<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">4.0.2</chsdate>.jar' to the command line!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#############################################################
JRebel <chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">4.0.2</chsdate> (<rtx w:st="on">2011</rtx>06<rtx w:st="on">2112</rtx>06)
with <place w:st="on"><city w:st="on">Enterprise</city></place> Add-On! (see http://jrebel.com/enterprise)
(c) Copyright ZeroTurnaround OU, <country-region w:st="on">Estonia</country-region>, <city w:st="on"><place w:st="on">Tartu</place></city>.
Over the last 1 days JRebel prevented
at least 0 redeploys/restarts saving you about 0 hours.
This product is licensed to Unlimited
For FUN! Unlimited! Enjoy!
The following plugins are disabled at the moment:
* <rtx w:st="on">Cl</rtx>ick plugin (set -Drebel.<rtx w:st="on">cl</rtx>ick_plugin=true to enable)
Reloads menu.xml menu definitions of Apa<rtx w:st="on">ch</rtx>e <rtx w:st="on">Cl</rtx>ick projects.
* <rtx w:st="on">Gl</rtx>assfish METRO plugin (set -Drebel.metro_plugin=true to enable)
Supports METRO JAX-WS <chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">2.2.3</chsdate> implementation of the JAX-WS standard
* JBoss AOP plugin (set -Drebel.jbossaop_plugin=true to enable)
Integration with jboss aop agent
* <city w:st="on"><place w:st="on">Jackson</place></city> plugin (set -Drebel.jackson_plugin=true to enable)
Supports reloading <place w:st="on"><city w:st="on">Jackson</city></place>'s <rtx w:st="on">Js</rtx>onSerializer ca<rtx w:st="on">ch</rtx>es.
* Li<rtx w:st="on">ft</rtx> plugin (set -Drebel.li<rtx w:st="on">ft</rtx>_plugin=true to enable)
Supports reloading sin<rtx w:st="on">gl</rtx>eton objects that extend RestHelper, MV<rtx w:st="on">CH</rtx>elper,
Li<rtx w:st="on">ft</rtx>Screen or Wizard.
* RESTEasy plugin (set -Drebel.resteasy_plugin=true to enable)
Supports adding/<rtx w:st="on">ch</rtx>anging methods with @Path annotation for RESTEasy application.
* Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
Integration with load time weaving seam annotations to wicket <rtx w:st="on">cl</rtx>asses
(-javaagent:<path-to-jboss-seam-wicket-jar>)
* WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
WebObjects JRebel Plugin
#############################################################
JRebel: Directory 'D:\workspace_helios\pmz\web\WEB-INF\<rtx w:st="on">cl</rtx>asses' will be monitored for <rtx w:st="on">cl</rtx>ass <rtx w:st="on">ch</rtx>anges.
看到上面标绿色的打出日志信息!