Jrebel 基于TOMCAT实现项目修改热部署
2016-12-19 09:54
471 查看
http://showlike.iteye.com/blog/1680034
你是否有过为修改后台代码,项目重部署而出现的漫长等待而烦恼,JRebel就是这样一套解决修改后台代码快速实现热部署的开发工具,节省了大量重启时间,提高了个人开发效率。JRebel是收费软件,用户可以在JRebel官方站点下载30天的评估版本。网上可搜索到破解版,闲话就不说了,直接进入正题。
应用环境:
JDK: 1.6.0_26 + Tomcat6 + eclipse3.7.2 + JRebel5.0.1
系统架构
struts2 + spring3 + ibaits2.3
配置步骤:
1、下载JRebel工具包(本文附件),把此包放置至Tomcat lib目录下(应该可放置其他目录,大家可自已试下,后续会配置指向此路径)
2、打开Tomcat配置页面,如下图:
3、配置VM arguments参数,在已有参数后增加如下代码
Java代码
-javaagent:E:\work\64\apache-tomcat-6.0.35\lib\jrebel.jar
-noverify
如下图:
4、修改需热部署项目原有的部署参数,如下图:
5、在需热部署的项目src目录下添加名称为rebel.xml的配置文件(可在附件中下载),内容如下:
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
//项目源代码class路径,有些为项目名\bin
<dir name="F:\workspace\rom\build\classes">
</dir>
</classpath>
<web>
<link target="/">
<dir name="F:\workspace\rom\WebContent">
</dir>
</link>
</web>
</application>
至此配置完成,启动项目,控制台打印如下信息未出现异常,即说明配置成功:
Java代码
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] #############################################################
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] JRebel 5.0.0 (201206080930)
[2012-09-17 20:57:25] (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] Over the last 1 days JRebel prevented
[2012-09-17 20:57:25] at least 9 redeploys/restarts saving you about 0.4 hours.
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] This product is licensed to Unlimited
[2012-09-17 20:57:25] For FUN! Unlimited! Enjoy!
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] The following plugins are disabled at the moment:
[2012-09-17 20:57:25] * Apache MyFaces plugin (set -Drebel.myfaces_plugin=true to enable)
[2012-09-17 20:57:25] * Click plugin (set -Drebel.click_plugin=true to enable)
[2012-09-17 20:57:25] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable)
[2012-09-17 20:57:25] * Jersey plugin (set -Drebel.jersey_plugin=true to enable)
[2012-09-17 20:57:25] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable)
[2012-09-17 20:57:25] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable)
[2012-09-17 20:57:25] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
[2012-09-17 20:57:25] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] #############################################################
[2012-09-17 20:57:25]
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] JRebel: A newer version '5.0.1' is available for download
[2012-09-17 20:57:25] JRebel: from http://www.zeroturnaround.com/jrebel/upgrade/
[2012-09-17 20:57:25]
当修改代码保存后,控制台会打印如下信息,即说明配置已生效,不需再等待重部署就可以看到修改后的效果,是不是感觉很爽,^-^
[2012-09-17 21:04:57] JRebel: Reloading class 'com.alili.rom.action.system.admin.UserAction'.
注: 经实际项目中应用,只有当修改Spring配置文件时,才需重新部署项目,而修改struts、ibatis等配置文件会自动热部署。
你是否有过为修改后台代码,项目重部署而出现的漫长等待而烦恼,JRebel就是这样一套解决修改后台代码快速实现热部署的开发工具,节省了大量重启时间,提高了个人开发效率。JRebel是收费软件,用户可以在JRebel官方站点下载30天的评估版本。网上可搜索到破解版,闲话就不说了,直接进入正题。
应用环境:
JDK: 1.6.0_26 + Tomcat6 + eclipse3.7.2 + JRebel5.0.1
系统架构
struts2 + spring3 + ibaits2.3
配置步骤:
1、下载JRebel工具包(本文附件),把此包放置至Tomcat lib目录下(应该可放置其他目录,大家可自已试下,后续会配置指向此路径)
2、打开Tomcat配置页面,如下图:
3、配置VM arguments参数,在已有参数后增加如下代码
Java代码
-javaagent:E:\work\64\apache-tomcat-6.0.35\lib\jrebel.jar
-noverify
如下图:
4、修改需热部署项目原有的部署参数,如下图:
5、在需热部署的项目src目录下添加名称为rebel.xml的配置文件(可在附件中下载),内容如下:
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
//项目源代码class路径,有些为项目名\bin
<dir name="F:\workspace\rom\build\classes">
</dir>
</classpath>
<web>
<link target="/">
<dir name="F:\workspace\rom\WebContent">
</dir>
</link>
</web>
</application>
至此配置完成,启动项目,控制台打印如下信息未出现异常,即说明配置成功:
Java代码
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] #############################################################
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] JRebel 5.0.0 (201206080930)
[2012-09-17 20:57:25] (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] Over the last 1 days JRebel prevented
[2012-09-17 20:57:25] at least 9 redeploys/restarts saving you about 0.4 hours.
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] This product is licensed to Unlimited
[2012-09-17 20:57:25] For FUN! Unlimited! Enjoy!
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] The following plugins are disabled at the moment:
[2012-09-17 20:57:25] * Apache MyFaces plugin (set -Drebel.myfaces_plugin=true to enable)
[2012-09-17 20:57:25] * Click plugin (set -Drebel.click_plugin=true to enable)
[2012-09-17 20:57:25] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable)
[2012-09-17 20:57:25] * Jersey plugin (set -Drebel.jersey_plugin=true to enable)
[2012-09-17 20:57:25] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable)
[2012-09-17 20:57:25] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable)
[2012-09-17 20:57:25] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
[2012-09-17 20:57:25] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] #############################################################
[2012-09-17 20:57:25]
[2012-09-17 20:57:25]
[2012-09-17 20:57:25] JRebel: A newer version '5.0.1' is available for download
[2012-09-17 20:57:25] JRebel: from http://www.zeroturnaround.com/jrebel/upgrade/
[2012-09-17 20:57:25]
当修改代码保存后,控制台会打印如下信息,即说明配置已生效,不需再等待重部署就可以看到修改后的效果,是不是感觉很爽,^-^
[2012-09-17 21:04:57] JRebel: Reloading class 'com.alili.rom.action.system.admin.UserAction'.
注: 经实际项目中应用,只有当修改Spring配置文件时,才需重新部署项目,而修改struts、ibatis等配置文件会自动热部署。
相关文章推荐
- 菜鸟教程之工具使用(四)——借助JRebel使Tomcat支持热部署
- tomcat自定义Web部署文件中docBase和workDir的区别介绍
- terracotta + tomcat + nginx集群
- JavaWeb学习之——Tomcat篇之Container
- Tomcat源码分析(三)Container容器
- The server does not support version 3.0 of the J2EE Web module specification
- Tomcat Manager用户配置详解
- Tomcat 优化 java.lang.OutOfMemoryError: Java heap space 的解决方法
- Tomcat初探(二)
- 如何设置tomcat虚拟主机
- eclipse中Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds
- apache和tomcat有什么不同,为什么要整合apache 和tomcat?
- tomcat配置文件server.xml含义说明
- eclipse下新建maven web工程(是web工程!)以及部署maven web工程到tomcat服务器
- 把Tomcat设置为Windows服务
- 安装tomcat步骤
- 利用ansible-playbook从测试环境获取tomcat中java项目新版本发布到生产环境 推荐
- tomcat7关键配置和线程
- Ubuntu 14.04 Web 程序开发(5)Ubuntu为Tomcat启用80端口
- Java-CentOS下Nginx+Tomcat