由2.2升级到jfinal-4.9.06-bin-with-src.jar时出错

二月 15, 2021 4:48:00 下午 org.apache.catalina.core.StandardContext filterStart

严重: 启动过滤器异常

java.lang.RuntimeException: Can not create instance of class: hqzn.common.config.MainConfig

at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:129)

at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:61)

at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:102)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4533)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5172)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.startup.Catalina.start(Catalina.java:633)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)

Caused by: java.lang.ClassNotFoundException: hqzn.common.config.MainConfig

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:264)

at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:126)

... 34 more


评论区

SuperEric

2021-02-17 16:28

Caused by: java.lang.ClassNotFoundException: hqzn.common.config.MainConfig

敏毅

2021-02-18 09:17

我把 hqzn.common.config.MainConfig代码都注释了,仍旧报错

敏毅

2021-02-18 09:18

二月 18, 2021 9:17:17 上午 org.apache.catalina.core.StandardContext filterStart
严重: 启动过滤器异常
java.lang.RuntimeException: Can not create instance of class: hqzn.common.config.MainConfig
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:129)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:61)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:102)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4533)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5172)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:126)
... 34 more

二月 18, 2021 9:17:17 上午 org.apache.catalina.core.StandardContext startInternal
严重: 一个或多个筛选器启动失败。完整的详细信息将在相应的容器日志文件中找到
二月 18, 2021 9:17:17 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/dwrs] startup failed due to previous errors
二月 18, 2021 9:17:17 上午 org.apache.coyote.AbstractProtocol start
信息: 开始协议处理句柄["http-nio-8199"]
二月 18, 2021 9:17:17 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in [6,309] milliseconds

敏毅

2021-02-18 11:10

我Debug了,代码在jfinal的private void createJFinalConfig(String configClass) { temp = Class.forName(configClass).newInstance();}出错 configClass的代入值 “hqzn.common.config.MainConfig” 正常,再向下跟踪时,没有源码

敏毅

2021-02-19 10:03

@_'' 终于找到原因了,最笨的办法把继承类MainConfig代码删除后,add uImplemented methods 重构方法,最少不报错了。

敏毅

2021-02-19 10:13

粘贴入代码,并重命名onStart(),和onStop()能debug了,原来问题原因这么简单