在java web项目中,经常需要在web服务器启动之后再更改java类。这样会导致服务器自动重新加载更改的java类,自动重新加载的时间需要等待,然后还导致session失效,需要重新登录。
现在 我们考虑用JRebel来实时加载部分更改类,这样就无需服务器重新加载了,无需等待,session也不会消失。即时更改,即时生效。
步骤如下:
1.下载javaRebel
http://www.zeroturnaround.com/jrebel/current/
我选择的是jrebel-3.0.1-setup.zip,解压之后在控制台执行java -jar jrebel-setup.jar,进行安装。
[img]http://dl.iteye.com/upload/attachment/249564/2cccb9b8-0e3a-3251-9858-499d430308b1.jpg[/img]
2.采用eclipse3.3以上版本,我目前用的是eclipse3.5
javaRebel的eclipse在线更新地址:
http://www.zeroturnaround.com/update-site/
[img]http://dl.iteye.com/upload/attachment/249566/b2fccd38-7e8c-3b5e-a7ca-7167c91c6471.jpg[/img]
3.
window-preferences-JRebel 指定JRebel的安装目录中的jar,如:E:\JRebel\jrebel.jar
[img]http://dl.iteye.com/upload/attachment/249568/5120052b-07c5-32ab-a5e4-5c3d093d0c79.jpg[/img]
4.配置tomcat
Run-Run configurations
在JRebel标签上 勾上Enable JRebel agent.
[img]http://dl.iteye.com/upload/attachment/249572/7e7bf1c0-5a07-3f2f-895f-e7785fe09e9e.jpg[/img]
5.在项目数据源连接配置中(我的是在META-INF\context.xml中)
<Context antiResourceLocking="false" reloadable="false">
设置reloadable="false"
或者在tomcat的server.xml的context里面加上reloadable="false"
这是取消tomcat的自动重载.
我的eclipse版本为:eclipse-jee-galileo-SR2-win32.zip 这是eclipse3.5 自带wtp插件
下面上传一个破解的jrebel,也是在网上找的.
现在 我们考虑用JRebel来实时加载部分更改类,这样就无需服务器重新加载了,无需等待,session也不会消失。即时更改,即时生效。
步骤如下:
1.下载javaRebel
http://www.zeroturnaround.com/jrebel/current/
我选择的是jrebel-3.0.1-setup.zip,解压之后在控制台执行java -jar jrebel-setup.jar,进行安装。
[img]http://dl.iteye.com/upload/attachment/249564/2cccb9b8-0e3a-3251-9858-499d430308b1.jpg[/img]
2.采用eclipse3.3以上版本,我目前用的是eclipse3.5
javaRebel的eclipse在线更新地址:
http://www.zeroturnaround.com/update-site/
[img]http://dl.iteye.com/upload/attachment/249566/b2fccd38-7e8c-3b5e-a7ca-7167c91c6471.jpg[/img]
3.
window-preferences-JRebel 指定JRebel的安装目录中的jar,如:E:\JRebel\jrebel.jar
[img]http://dl.iteye.com/upload/attachment/249568/5120052b-07c5-32ab-a5e4-5c3d093d0c79.jpg[/img]
4.配置tomcat
Run-Run configurations
在JRebel标签上 勾上Enable JRebel agent.
[img]http://dl.iteye.com/upload/attachment/249572/7e7bf1c0-5a07-3f2f-895f-e7785fe09e9e.jpg[/img]
5.在项目数据源连接配置中(我的是在META-INF\context.xml中)
<Context antiResourceLocking="false" reloadable="false">
设置reloadable="false"
或者在tomcat的server.xml的context里面加上reloadable="false"
这是取消tomcat的自动重载.
我的eclipse版本为:eclipse-jee-galileo-SR2-win32.zip 这是eclipse3.5 自带wtp插件
下面上传一个破解的jrebel,也是在网上找的.