刚开始装上eclipse的时候,没有问题,但好象最近eclipse做了一些更新,出现热加载报错的问题,尝试了很多方法还是没有解决,看看其它人有没有这个问题:
环境:
系统:Mac OS High Serria 10.13.1
eclipse:Oxygen.1a Release (4.7.1a)
jfinal:jfinal-3.2-bin.jar
jetty:8.1.8
druid:1.0.23(以前用的1.0.5,出问题后做了很多版本的尝试,发现1.0.23之后的版本直接就起不来)
数据库:sql server 2008 r2
报错信息如下:
正在加载变更 ...... 2017-11-30 22:14:15,201 [JFinal-Scanner] INFO [com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed 2017-11-30 22:14:15.908:WARN:oejuc.AbstractLifeCycle:FAILED sx_system: java.lang.NullPointerException java.lang.NullPointerException at com.jfinal.config.Routes$Route.processControllerKey(Routes.java:156) at com.jfinal.config.Routes$Route.<init>(Routes.java:146) at com.jfinal.config.Routes.add(Routes.java:61) at com.jfinal.config.Routes.add(Routes.java:71) at com.dream.app.AppRoute.config(AppRoute.java:32) at com.jfinal.config.Routes.add(Routes.java:49) at com.dream.app.AppConfig.configRoute(AppConfig.java:48) at com.jfinal.core.Config.configJFinal(Config.java:51) at com.jfinal.core.JFinal.init(JFinal.java:63) at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49) 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:137) at com.jfinal.server.Scanner.compare(Scanner.java:88) at com.jfinal.server.Scanner.working(Scanner.java:57) at com.jfinal.server.Scanner.access$000(Scanner.java:31) at com.jfinal.server.Scanner$1.run(Scanner.java:94) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) 2017-11-30 22:14:15.909:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/Users/huahua/eclipse-workspace/sx_system/WebContent/} java.lang.NullPointerException at com.jfinal.config.Routes$Route.processControllerKey(Routes.java:156) at com.jfinal.config.Routes$Route.<init>(Routes.java:146) at com.jfinal.config.Routes.add(Routes.java:61) at com.jfinal.config.Routes.add(Routes.java:71) at com.dream.app.AppRoute.config(AppRoute.java:32) at com.jfinal.config.Routes.add(Routes.java:49) at com.dream.app.AppConfig.configRoute(AppConfig.java:48) at com.jfinal.core.Config.configJFinal(Config.java:51) at com.jfinal.core.JFinal.init(JFinal.java:63) at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49) 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:137) at com.jfinal.server.Scanner.compare(Scanner.java:88) at com.jfinal.server.Scanner.working(Scanner.java:57) at com.jfinal.server.Scanner.access$000(Scanner.java:31) at com.jfinal.server.Scanner$1.run(Scanner.java:94) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) 2017-11-30 22:14:15.909:WARN:oejuc.AbstractLifeCycle:FAILED o.e.j.w.WebAppContext{/,file:/Users/ java.lang.NullPointerException at com.jfinal.config.Routes$Route.processControllerKey(Routes.java:156) at com.jfinal.config.Routes$Route.<init>(Routes.java:146) at com.jfinal.config.Routes.add(Routes.java:61) at com.jfinal.config.Routes.add(Routes.java:71) at com.dream.app.AppRoute.config(AppRoute.java:32) at com.jfinal.config.Routes.add(Routes.java:49) at com.dream.app.AppConfig.configRoute(AppConfig.java:48) at com.jfinal.core.Config.configJFinal(Config.java:51) at com.jfinal.core.JFinal.init(JFinal.java:63) at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49) 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:137) at com.jfinal.server.Scanner.compare(Scanner.java:88) at com.jfinal.server.Scanner.working(Scanner.java:57) at com.jfinal.server.Scanner.access$000(Scanner.java:31) at com.jfinal.server.Scanner$1.run(Scanner.java:94) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) Error reconfiguring/restarting webapp after change in watched files 2017-11-30 22:14:15,910 [JFinal-Scanner] ERROR [com.jfinal.kit.LogKit] - java.lang.NullPointerException at com.jfinal.config.Routes$Route.processControllerKey(Routes.java:156) at com.jfinal.config.Routes$Route.<init>(Routes.java:146) at com.jfinal.config.Routes.add(Routes.java:61) at com.jfinal.config.Routes.add(Routes.java:71) at com.dream.app.AppRoute.config(AppRoute.java:32) at com.jfinal.config.Routes.add(Routes.java:49) at com.dream.app.AppConfig.configRoute(AppConfig.java:48) at com.jfinal.core.Config.configJFinal(Config.java:51) at com.jfinal.core.JFinal.init(JFinal.java:63) at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49) 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:137) at com.jfinal.server.Scanner.compare(Scanner.java:88) at com.jfinal.server.Scanner.working(Scanner.java:57) at com.jfinal.server.Scanner.access$000(Scanner.java:31) at com.jfinal.server.Scanner$1.run(Scanner.java:94) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505)
尝试了很多种方法,都没有解决,因为本身对jfinal也只是了解了皮毛,所以想请大家提供帮助。
对jfinal中的 JettyServer.java 做过如下的改动:
//only need to change classloader when scanIntervalSeconds > 0 webApp.setParentLoaderPriority(true);//增加了这句,这是参考波总的3.3版本修改的,如果不加这句,同样启动时就报错;但波总后来更新时又去掉了 // changeClassLoader(webApp);//这句话好象以前就有
----------------
其它尝试过的方法有:
使用更高版本的jetty
使用jfinal3.3(最早安装的2.2,出错后,开始更新版本)3.3版本因为错误信息看起来更复杂,所以没有再尝试。至少3.2版本现在能正常启动,程序也可以正常运行;但需要在每次修改java代码后,重启一下。
项目:JFinal