开发者社区> 问答> 正文

JFinal启动报错,routes.autoScan(true)?报错

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

/**
* 配置路由
*/
@Override
public void configRoute(Routes me) {
AutoBindRoutes routes = new AutoBindRoutes();
routes.autoScan(true);
me.add(routes);
}

总是报错

严重: Exception starting filter jfinal
java.lang.NoClassDefFoundError: org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2479)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:880)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1294)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.jfinal.ext.kit.Reflect.forName(Reflect.java:692)
at com.jfinal.ext.kit.Reflect.on(Reflect.java:85)
at com.jfinal.ext.kit.ClassSearcher.extraction(ClassSearcher.java:38)
at com.jfinal.ext.kit.ClassSearcher.search(ClassSearcher.java:178)
at com.jfinal.ext.route.AutoBindRoutes.config(AutoBindRoutes.java:73)
at com.jfinal.config.Routes.add(Routes.java:40)
at com.consame.emoji.common.ConfigInit.configRoute(ConfigInit.java:62)
at com.jfinal.core.Config.configJFinal(Config.java:47)
at com.jfinal.core.JFinal.init(JFinal.java:67)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4603)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5210)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177)
... 31 more


展开
收起
爱吃鱼的程序员 2020-06-14 18:10:21 503 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests

    已经告诉你了缺少jar包哇

    这个是缺少jar包,应该不是jfinal的问题

    java.lang.NoClassDefFoundError:org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests

    这个异常说明是缺包

    找到原因了,是因为src/test/java/里的测试类也被jFinal扫描加载了,而测试包都不部署到tomcat里的,这是个问题啊
    2020-06-14 18:10:40
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Apache Wicket User Guide - Ref 立即下载
Apache Wicket User Guide-Refer 立即下载
In-Flux Limiting for a Multi-Tenant Logging Service 立即下载