JFinal程序启动报错,是什么原因

第一次使用JFinal,启动报错,按网上文档,搭建示例项目,运行报错,我用的开发工具是Spring tool suite3.9.4。


核心代码如下:

public class HelloController extends Controller {
    public void index() {
       renderText("Hello JFinal World.");
    }
}

public class DemoConfig extends JFinalConfig {
 

    public static void main(String[] args) {
        UndertowServer.start(DemoConfig.class, 8080, true);
    }

}

错误:

Exception in thread "main" java.lang.NoClassDefFoundError: io/undertow/server/HttpHandler
    at myjfinal01.demo.DemoConfig.main(DemoConfig.java:11)
Caused by: java.lang.ClassNotFoundException: io.undertow.server.HttpHandler
    at java.net.URLClassLoader$1.run(URLClassLoader.java:370)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method)
    at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
    at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:734)
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:434)
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
    at java.util.jar.Manifest$FastInputStream.fill(Manifest.java:441)
    at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:375)
    at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:409)
    at java.util.jar.Attributes.read(Attributes.java:376)
    at java.util.jar.Manifest.read(Manifest.java:199)
    at java.util.jar.Manifest.<init>(Manifest.java:69)
    at java.util.jar.JarFile.getManifestFromReference(JarFile.java:199)
    at java.util.jar.JarFile.getManifest(JarFile.java:180)
    at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:981)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:450)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    ... 7 more






评论区

xiuj

2020-03-30 10:11

缺少undertow的依赖包。

zzutligang

2020-03-30 11:09

明显缺少jar

JFinal

2020-04-01 16:24

按文档来一定可以的:https://jfinal.com/doc/1-2

热门反馈

扫码入社