关于jfinal在idea中的部署问题

hikevin 发布于 2013/12/10 00:05
阅读 5K+
收藏 2

@JFinal 你好,想跟你请教个问题:

请问在intellij idea 里怎样使配置的路由立即生效?
我使用的是 idea + tomcat + jrebel,发现每次注册新的contrller都必须重启tomcat啊。

ps:刚刚看了一下手册并简单地跑进来了,用jfinal让我重回到了以前学习ROR的日子,感觉很好。


加载中
0
JFinal
JFinal
    jreble 貌似需要额外配置个东东才支持热加载,具体怎么配置忘记了。建议在开发的时候使用 JFinal 手册中建议的方法实现热加载
0
hikevin
hikevin

@JFinal 您说的应该是指jrebel.xml吧,我这边发布后,修改action里的东西都能够实现热部署了,只有在configRoute方法新加的controller不会生效,必须重启。

示例:

第一步:按如下配置启动tomcat,可以正常访问到/.

    /**
     * 配置路由
     */
    public void configRoute(Routes me) {
        me.add("/", CommonController.class);

第二步,添加一个新的login ctroller,

    /**
     * 配置路由
     */
    public void configRoute(Routes me) {
        me.add("/", CommonController.class);
        me.add("login", LoginController.class);

login controller必须重启tomcat才能访问。

JFinal
JFinal
我记得还不是 jreble.xml 的事,jreble需要在 jvm 启动参数中添加配置项
0
hikevin
hikevin

@JFinal 那你可能是指配置jvm参数:-javaagent:E:\iconfig\plugins\jr-ide-idea\lib\jrebel\jrebel.jar,好像一般这个不用配都是可以的,我在公司里的web项目都没有配一切都是ok的。

其实jrebel是工作了的,我用反编译工具查看里面确实是新加了controller了,只是获取路由的map里面始终没有新的url映射。

详细问题如图:

0
hikevin
hikevin

@JFinal 那你可能是指配置jvm参数:-javaagent:E:\iconfig\plugins\jr-ide-idea\lib\jrebel\jrebel.jar,好像一般这个不用配都是可以的,我在公司里的web项目都没有配一切都是ok的。

其实jrebel是工作了的,我用反编译工具查看里面确实是新加了controller了,只是获取路由的map里面始终没有新的url映射。

详细问题如图:

0
JFinal
JFinal

引用来自“hikevin”的答案

@JFinal 那你可能是指配置jvm参数:-javaagent:E:\iconfig\plugins\jr-ide-idea\lib\jrebel\jrebel.jar,好像一般这个不用配都是可以的,我在公司里的web项目都没有配一切都是ok的。

其实jrebel是工作了的,我用反编译工具查看里面确实是新加了controller了,只是获取路由的map里面始终没有新的url映射。

详细问题如图:

我也觉得很奇怪,是 JFinal 1.5 版本不? 另外,使用 jfinal 自带的 jetty-server 启动看看是否支持
0
hikevin
hikevin

@JFinal 谢谢你的回答,我是使用您的JFinal-bin-with-src-1.5.jar。

我按照你的启动说明文件运行(其实是使用的jrebel debug模式)了blog demo,当我新注册一个action后,编译代码就报错了,



0
hikevin
hikevin

附日志详情:

C:\Java\jdk1.7.0\bin\java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:2558,suspend=y,server=n -Drebel.env.ide=intellij -Drebel.notification.url=http://localhost:2303 -javaagent:e:\iconfig\plugins\jr-ide-idea\lib\jrebel\jrebel.jar -Dfile.encoding=UTF-8 -classpath "E:\jfinal_demo\WebRoot\WEB-INF\classes;C:\Java\jdk1.7.0\jre\lib\charsets.jar;C:\Java\jdk1.7.0\jre\lib\deploy.jar;C:\Java\jdk1.7.0\jre\lib\javaws.jar;C:\Java\jdk1.7.0\jre\lib\jce.jar;C:\Java\jdk1.7.0\jre\lib\jsse.jar;C:\Java\jdk1.7.0\jre\lib\management-agent.jar;C:\Java\jdk1.7.0\jre\lib\plugin.jar;C:\Java\jdk1.7.0\jre\lib\resources.jar;C:\Java\jdk1.7.0\jre\lib\rt.jar;C:\Java\jdk1.7.0\jre\lib\ext\dnsns.jar;C:\Java\jdk1.7.0\jre\lib\ext\localedata.jar;C:\Java\jdk1.7.0\jre\lib\ext\sunec.jar;C:\Java\jdk1.7.0\jre\lib\ext\sunjce_provider.jar;C:\Java\jdk1.7.0\jre\lib\ext\sunmscapi.jar;C:\Java\jdk1.7.0\jre\lib\ext\sunpkcs11.jar;C:\Java\jdk1.7.0\jre\lib\ext\zipfs.jar;E:\jfinal_demo\WebRoot\WEB-INF\lib\c3p0-0.9.1.2.jar;E:\jfinal_demo\WebRoot\WEB-INF\lib\log4j-1.2.16.jar;E:\jfinal_demo\WebRoot\WEB-INF\lib\freemarker-2.3.16.jar;E:\jfinal_demo\WebRoot\WEB-INF\lib\jetty-server-8.1.8.jar;E:\jfinal_demo\WebRoot\WEB-INF\lib\JFinal-bin-with-src-1.5.jar;E:\jfinal_demo\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.20-bin.jar;C:\Program Files\JetBrains\IntelliJ IDEA 13.0\lib\idea_rt.jar" com.demo.common.DemoConfig
Connected to the target VM, address: '127.0.0.1:2558', transport: 'socket'
2013-12-11 23:42:37 JRebel: 
2013-12-11 23:42:37 JRebel: #############################################################
2013-12-11 23:42:37 JRebel: 
2013-12-11 23:42:37 JRebel:  JRebel 5.4.2 (201311271505)
2013-12-11 23:42:37 JRebel:  (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
2013-12-11 23:42:37 JRebel: 
2013-12-11 23:42:37 JRebel:  Over the last 18 days JRebel prevented 
2013-12-11 23:42:37 JRebel:  at least 58 redeploys/restarts saving you about 2.4 hours.
2013-12-11 23:42:37 JRebel: 
2013-12-11 23:42:37 JRebel:  This product is licensed to www.sdandroid.com
2013-12-11 23:42:37 JRebel:  for unlimited number of developer seats on site.
2013-12-11 23:42:37 JRebel:   ####### Cracked by sdandroid (blog@sdandroid.com) ######
2013-12-11 23:42:37 JRebel: 
2013-12-11 23:42:37 JRebel:  The following plugins are disabled at the moment: 
2013-12-11 23:42:37 JRebel:  * Axis2 plugin (set -Drebel.axis2_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Camel plugin (set -Drebel.camel_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Click plugin (set -Drebel.click_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Deltaspike plugin (set -Drebel.deltaspike_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Eclipse RCP Plugin (set -Drebel.eclipse_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * JBoss7 EJB Plugin (set -Drebel.jboss7_ejb_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * JRuby Plugin (set -Drebel.jruby_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Jersey plugin (set -Drebel.jersey_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Log4j2 plugin (set -Drebel.log4j2_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Mustache Plugin (set -Drebel.mustache_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * RESTlet plugin (set -Drebel.restlet_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Spring Data Plugin (set -Drebel.spring_data_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Thymeleaf Plugin (set -Drebel.thymeleaf_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * VRaptor plugin (set -Drebel.vraptor_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * Vaadin CDI utils plugin (set -Drebel.vaadin_cdiutils_plugin=true to enable)
2013-12-11 23:42:37 JRebel:  * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
2013-12-11 23:42:37 JRebel: 
2013-12-11 23:42:37 JRebel: #############################################################
2013-12-11 23:42:37 JRebel: 
Starting JFinal 1.5
Starting scanner at interval of 5 seconds.
Starting web server on port: 80
2013-12-11 23:42:40 JRebel: Monitoring Log4j configuration in 'file:/E:/jfinal_demo/WebRoot/WEB-INF/classes/log4j.properties'.
Starting Complete. Welcome To The JFinal World :)


JFinal action report -------- 2013-12-11 23:42:59 ------------------------------
Controller  : com.demo.common.CommonController.(CommonController.java:1)
Method      : index
UrlPara     : gordon
--------------------------------------------------------------------------------


Loading changes ......
2013-12-11 23:43:09 JRebel: Reloading class 'com.demo.common.DemoConfig'.
2013-12-11 23:43:09 JRebel: ERROR Failed to start a plugin org.zeroturnaround.javarebel.integration.servlet.ServletIntegrationPlugin in com.jfinal.server.JFinalClassLoader@283198: java.lang.ClassCastException: org.zeroturnaround.javarebel.integration.servlet.ServletIntegrationPlugin cannot be cast to org.zeroturnaround.javarebel.Plugin
at com.zeroturnaround.javarebel.tN.a(JRebel:342)
at com.zeroturnaround.javarebel.tN.a(JRebel:458)
at com.zeroturnaround.javarebel.wZ.d(JRebel:130)
at com.zeroturnaround.javarebel.wZ.f(JRebel:151)
at com.zeroturnaround.javarebel.wZ.b(JRebel:274)
at com.zeroturnaround.javarebel.wz.a(JRebel:155)
at com.zeroturnaround.javarebel.ww.b(JRebel:29)
at com.zeroturnaround.javarebel.ww.a(JRebel:17)
at com.zeroturnaround.javarebel.wS.loadReloadableClass(JRebel:316)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.findReloadableClass(JRebel:85)
at com.zeroturnaround.javarebel.xi.findReloadableClass(JRebel:16)
at java.net.URLClassLoader.findClass(URLClassLoader.java)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at com.jfinal.server.JFinalClassLoader.loadClass(JFinalClassLoader.java:53)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1514)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1864)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1248)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


2013-12-11 23:43:09 JRebel: ERROR Failed to start a plugin org.zeroturnaround.javarebel.integration.jasper.JasperPlugin in com.jfinal.server.JFinalClassLoader@283198: java.lang.ClassCastException: org.zeroturnaround.javarebel.integration.jasper.JasperPlugin cannot be cast to org.zeroturnaround.javarebel.Plugin
at com.zeroturnaround.javarebel.tN.a(JRebel:342)
at com.zeroturnaround.javarebel.tN.a(JRebel:458)
at com.zeroturnaround.javarebel.wZ.d(JRebel:130)
at com.zeroturnaround.javarebel.wZ.f(JRebel:151)
at com.zeroturnaround.javarebel.wZ.b(JRebel:274)
at com.zeroturnaround.javarebel.wz.a(JRebel:155)
at com.zeroturnaround.javarebel.ww.b(JRebel:29)
at com.zeroturnaround.javarebel.ww.a(JRebel:17)
at com.zeroturnaround.javarebel.wS.loadReloadableClass(JRebel:316)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.findReloadableClass(JRebel:85)
at com.zeroturnaround.javarebel.xi.findReloadableClass(JRebel:16)
at java.net.URLClassLoader.findClass(URLClassLoader.java)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at com.jfinal.server.JFinalClassLoader.loadClass(JFinalClassLoader.java:53)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1514)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1864)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1248)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


2013-12-11 23:43:09 JRebel: ERROR Failed to start a plugin org.zeroturnaround.javarebel.integration.fileservlet.FileServletPlugin in com.jfinal.server.JFinalClassLoader@283198: java.lang.ClassCastException: org.zeroturnaround.javarebel.integration.fileservlet.FileServletPlugin cannot be cast to org.zeroturnaround.javarebel.Plugin
at com.zeroturnaround.javarebel.tN.a(JRebel:342)
at com.zeroturnaround.javarebel.tN.a(JRebel:458)
at com.zeroturnaround.javarebel.wZ.d(JRebel:130)
at com.zeroturnaround.javarebel.wZ.f(JRebel:151)
at com.zeroturnaround.javarebel.wZ.b(JRebel:274)
at com.zeroturnaround.javarebel.wz.a(JRebel:155)
at com.zeroturnaround.javarebel.ww.b(JRebel:29)
at com.zeroturnaround.javarebel.ww.a(JRebel:17)
at com.zeroturnaround.javarebel.wS.loadReloadableClass(JRebel:316)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.findReloadableClass(JRebel:85)
at com.zeroturnaround.javarebel.xi.findReloadableClass(JRebel:16)
at java.net.URLClassLoader.findClass(URLClassLoader.java)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at com.jfinal.server.JFinalClassLoader.loadClass(JFinalClassLoader.java:53)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1514)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1864)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1248)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


2013-12-11 23:43:09 JRebel: ERROR Failed to start a plugin org.zeroturnaround.javarebel.integration.servlet.base.BaseServletIntegrationPlugin in com.jfinal.server.JFinalClassLoader@283198: java.lang.ClassCastException: org.zeroturnaround.javarebel.integration.servlet.base.BaseServletIntegrationPlugin cannot be cast to org.zeroturnaround.javarebel.Plugin
at com.zeroturnaround.javarebel.tN.a(JRebel:342)
at com.zeroturnaround.javarebel.tN.a(JRebel:458)
at com.zeroturnaround.javarebel.wZ.d(JRebel:130)
at com.zeroturnaround.javarebel.wZ.f(JRebel:151)
at com.zeroturnaround.javarebel.wZ.b(JRebel:274)
at com.zeroturnaround.javarebel.wz.a(JRebel:155)
at com.zeroturnaround.javarebel.ww.b(JRebel:29)
at com.zeroturnaround.javarebel.ww.a(JRebel:17)
at com.zeroturnaround.javarebel.wS.loadReloadableClass(JRebel:316)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.findReloadableClass(JRebel:85)
at com.zeroturnaround.javarebel.xi.findReloadableClass(JRebel:16)
at java.net.URLClassLoader.findClass(URLClassLoader.java)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at com.jfinal.server.JFinalClassLoader.loadClass(JFinalClassLoader.java:53)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1514)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1864)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1248)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


2013-12-11 23:43:09 JRebel: ERROR Failed to start a plugin org.zeroturnaround.javarebel.integration.log4j.Log4jPlugin in com.jfinal.server.JFinalClassLoader@283198: java.lang.ClassCastException: org.zeroturnaround.javarebel.integration.log4j.Log4jPlugin cannot be cast to org.zeroturnaround.javarebel.Plugin
at com.zeroturnaround.javarebel.tN.a(JRebel:342)
at com.zeroturnaround.javarebel.tN.a(JRebel:458)
at com.zeroturnaround.javarebel.wZ.d(JRebel:130)
at com.zeroturnaround.javarebel.wZ.f(JRebel:151)
at com.zeroturnaround.javarebel.wZ.b(JRebel:274)
at com.zeroturnaround.javarebel.wz.a(JRebel:155)
at com.zeroturnaround.javarebel.ww.b(JRebel:29)
at com.zeroturnaround.javarebel.ww.a(JRebel:17)
at com.zeroturnaround.javarebel.wS.loadReloadableClass(JRebel:316)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.findReloadableClass(JRebel:85)
at com.zeroturnaround.javarebel.xi.findReloadableClass(JRebel:16)
at java.net.URLClassLoader.findClass(URLClassLoader.java)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at com.jfinal.server.JFinalClassLoader.loadClass(JFinalClassLoader.java:53)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1514)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1864)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1248)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


2013-12-11 23:43:09.921:WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at com.demo.common.DemoConfig.<clinit>(DemoConfig.java:50001)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:95)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: 
java.lang.NullPointerException
at com.zeroturnaround.javarebel.gen.RebelLocator$$283198.<clinit>(RebelLocator.java:9)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:95)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
2013-12-11 23:43:09.921:WARN:oejuc.AbstractLifeCycle:FAILED o.e.j.w.WebAppContext{/,file:/E:/jfinal_demo/WebRoot/}: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at com.demo.common.DemoConfig.<clinit>(DemoConfig.java:50001)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:95)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: 
java.lang.NullPointerException
at com.zeroturnaround.javarebel.gen.RebelLocator$$283198.<clinit>(RebelLocator.java:9)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:95)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "JFinal-Scanner" java.lang.ExceptionInInitializerError
at com.demo.common.DemoConfig.<clinit>(DemoConfig.java:50001)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:95)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.NullPointerException
at com.zeroturnaround.javarebel.gen.RebelLocator$$283198.<clinit>(RebelLocator.java:9)
... 19 more
2013-12-11 23:43:12 JRebel: Reloading class 'com.demo.common.DemoConfig'.


0
hikevin
hikevin

@JFinal 我用我之前部署的方式,跟踪了一下代码,效果如下(已经加了/gordon controller 的情况下)

jfinal 的mapping里始终不认识新加的/gondon,必须要重启tomcat才可以。

0
JFinal
JFinal

     知道原因了,jfinal routes是在系统启动时一次性调用 JFinalConfig中的 configRoute(Routes me)加载的,而你用了 jreble ,虽然是动态让新代码生效了,但并没有调用 JFinalConfig.configRoute(..)方法,新添加的路由当然会不起作用。

   一般来说添加Route到JFinalConfig中并不频繁,重启tomcat尚可接受。如果一定要让路由及时生效,建议开发环境使用 JFinal 推荐的方式。

    这本质上不是热加载的问题了,而是热加载以后还需要调用相关初始化方法的问题

0
hikevin
hikevin

@JFinal 我按照您的手册上的方式实践了一下,是使用的jetty的reload 模式,想请问一下,当jetty发现有类被修改后,它是重新加载整个应用的吧?这样configRoute就会被执行了。

用jrebel可以配置方式为如图所示也能达到相应的效果:


redeploy就可以实现,但是效率比起update classes and resources方式要慢很多。或者可以采取一个折衷的作法,添加新的controller时就用redeploy模式,其它场景就用update classes。

另外jrebel plugin貌似是支持update classes之后去特定执行某些方法,这个要麻烦一点,有找到一篇文章http://zeroturnaround.com/software/jrebel/learn/jrebel-plugins/

真心希望jfina可以在idea中很好的开发,jfinal + idea + jrebel 肯定可以使开发效率更极速的!

返回顶部
顶部