jrebel5 +tomcat 实现动态部署
JRebel是一套JavaEE开发工具 ,收费,网上有破解,就是一个jar 包,它是通过代理能重载java class 文件,来达到动态加载,不用重启服务器。
如果是在 eclipse 中集成 tomcat 的,则在配置tomcat时,在JVM中加一句:
-noverify -javaagent:f:\jrebel5.jar -Xms256m -Xmx1024m -Drebel.spring_plugin=true
--- Drebel.spring_plugin 这一句指 支持的项目,默认都支持,见jrebel.jar 中的 plugins下面 plugin.properties 这个文件里面都是一些配置参数 。
-Drebel.dirs=F:\Tomcat\apache-tomcat-6.0.32\webapps\ngrmqh\WEB-INF\classes --- 可要可不要,加上启动很慢,这个是指监控项目中的classess目录,
启动后会看到:
[2013-06-07 10:09:36] #############################################################
[2013-06-07 10:09:36]
[2013-06-07 10:09:36] JRebel 5.0.0 (201206080930)
[2013-06-07 10:09:36] (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
[2013-06-07 10:09:36]
[2013-06-07 10:09:36] Over the last 1 days JRebel prevented
[2013-06-07 10:09:36] at least 0 redeploys/restarts saving you about 0 hours.
[2013-06-07 10:09:36]
[2013-06-07 10:09:36] This product is licensed to Unlimited
[2013-06-07 10:09:36] For FUN! Unlimited! Enjoy!
[2013-06-07 10:09:36]
[2013-06-07 10:09:36] The following plugins are disabled at the moment:
[2013-06-07 10:09:36] * Apache MyFaces plugin (set -Drebel.myfaces_plugin=true to enable)
[2013-06-07 10:09:36] * Click plugin (set -Drebel.click_plugin=true to enable)
[2013-06-07 10:09:36] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable)
[2013-06-07 10:09:36] * Jersey plugin (set -Drebel.jersey_plugin=true to enable)
[2013-06-07 10:09:36] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable)
[2013-06-07 10:09:36] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable)
[2013-06-07 10:09:36] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
[2013-06-07 10:09:36] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
[2013-06-07 10:09:36]
[2013-06-07 10:09:36] #############################################################
表示成功。
如果是在 tomcat 中单独启动:则在 {tomcat}\bin\ catalina.bat,找到set JAVA_OPTS处, 在“=”右边添加如下代码:
-noverify -javaagent:d:\jrebel5.jar
设置后结果如下:
set JAVA_OPTS=-noverify -javaagent:d:\javarebel-2.0\javarebel.jar-Xms1024m -Xmx1024m
就可以了, 如在 weblogic 中 也可以设置代理 JAVA_OPTS 参数。
参考:
http://blog.youkuaiyun.com/xiaolang85/article/details/6748697
http://macrotea.iteye.com/blog/787015