ITeye博客

Jrebel + eclipse + tomcat 用于热部署 的实践总结

ernestyoung · 2014-11-20 16:54 · IDE 插件 · 开源软件 · Markdown

1、用eclipse 下载 http://update.zeroturnaround.com/update-site

2、接着替换 your eclipse location\plugins\org.zeroturnaround.eclipse.embedder_6.0.0.RELEASE-201410311652\jrebel ,即eclipse所在目录的plugins 替换jrebel里面的jar包。

3、去eclipse 中注册jrebel ,替换文件是jrebel.lic,提示注册成功

以上部分是注册部分

1、双击servers 下面的某个tomcat服务,点击overview,需要配置如下参数:

a、 Server Locations选择 User Tomcat installation

b、 Publishing中选择 Never publish automatically

c、 Timeouts中 Start设置成 1000或更大

d、 JRebel Integration中两个复选框都选中

e、选择Open lauch configuration,在(x)=Arguments选项卡中增加 配置VM arguments参数:

-noverify

-Drebel.struts2-plugin=true

-Drebel.spring_plugin=true

-Xms256m -Xmx256m -XX:MaxNewSize=256m -XX:MaxPermSize=256m

2、双击servers中下面某个tomcat服务,点击modules,添加你需要的module。 需要add external web module.注意document base 需要填写的是程序的webapp的位置,而非tomcat下编译的位置。如:

your project location\xxxxxx\WebApps

Path为要访问的程序web名

3、其次程序上右击选择jrebel,advanced properties.当然了,需要enable 一下jrebel。可以重新生成一下rebel文件。

4、至此,程序可以达到热部署了。

以上是使用插件模式。(一般没什么用)

-noverify -javaagent:D:\xxxx\xxxxx\jrebel.jar -Drebel.dirs=your project location\xxxx\WebApps\WEB-INF\classes,your project location\xxxx\WebApps\WEB-INF\classes\config,your project location\xxxxx\WebApps -Drebel.spring_plugin=true -Drebel.aspectj_plugin=true -Drebel.struts2_plugin=true -Drebel.hibernate_plugin=true -Drebel.hibernate_validator_plugin=true

或者把这些加到tomcat的启动参数里面

最后要注意的是tomcat的modules中的某个module 的auto reload参数要配置成disabled

此方法经实践可用

评论(2)

  1. #2 楼 · ernestyoung · 2015-01-07 10:42

    string2020 writes:

    [code=java] JRebel: Class 'java.io.ObjectStreamClass$FieldReflector' could not be processed: java.lang.RuntimeException: java.io.IOException: invalid constant type: 15 at org.zeroturnaround.bundled.javassist.CtClassType.getClassFile2(JRebel:203) at org.zeroturnaround.bundled.javassist.CtClassType.subtypeOf(JRebel:303) at org.zeroturnaround.bundled.javassist.CtClassType.subtypeOf(JRebel:318) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.TypeData$TypeName.update(JRebel:274) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.TypeData$TypeName.setType(JRebel:203) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.TypeData.setType(JRebel:46) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.Tracer.doInvokeMethod(JRebel:825) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.Tracer.doOpcode148_201(JRebel:620) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.Tracer.doOpcode(JRebel:102) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:182) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192) at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192)

    启动一直报错 [/code] 这个问题应该是: META-INF/INDEX.LIST 在你的jar列表中有一些是无效的。

  2. #1 楼 · string2020 · 2014-11-20 23:44
    
    JRebel: Class 'java.io.ObjectStreamClass$FieldReflector' could not be processed:
    java.lang.RuntimeException: java.io.IOException: invalid constant type: 15
    	at org.zeroturnaround.bundled.javassist.CtClassType.getClassFile2(JRebel:203)
    	at org.zeroturnaround.bundled.javassist.CtClassType.subtypeOf(JRebel:303)
    	at org.zeroturnaround.bundled.javassist.CtClassType.subtypeOf(JRebel:318)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.TypeData$TypeName.update(JRebel:274)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.TypeData$TypeName.setType(JRebel:203)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.TypeData.setType(JRebel:46)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.Tracer.doInvokeMethod(JRebel:825)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.Tracer.doOpcode148_201(JRebel:620)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.Tracer.doOpcode(JRebel:102)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:182)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192)
    	at org.zeroturnaround.bundled.javassist.bytecode.stackmap.MapMaker.make(JRebel:192)
    
    
    
    
    启动一直报错
    
    

评论功能维护中,当前仅展示历史评论。