用idea的mvn方式创建jfinal问什么报错 只做了个输出helloword

未命名1589341129.png未命名1589341151.png

"C:\Program Files\Java\jdk1.8.0_171\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2\lib\idea_rt.jar=59705:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_171\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\rt.jar;D:\myProject\test\target\classes;E:\apache-maven-3.5.0\repository\com\jfinal\jfinal\4.8\jfinal-4.8.jar;E:\apache-maven-3.5.0\repository\com\jfinal\jfinal-undertow\2.0\jfinal-undertow-2.0.jar;E:\apache-maven-3.5.0\repository\io\undertow\undertow-core\2.0.28.Final\undertow-core-2.0.28.Final.jar;E:\apache-maven-3.5.0\repository\org\jboss\logging\jboss-logging\3.4.0.Final\jboss-logging-3.4.0.Final.jar;E:\apache-maven-3.5.0\repository\org\jboss\xnio\xnio-api\3.3.8.Final\xnio-api-3.3.8.Final.jar;E:\apache-maven-3.5.0\repository\org\jboss\xnio\xnio-nio\3.3.8.Final\xnio-nio-3.3.8.Final.jar;E:\apache-maven-3.5.0\repository\io\undertow\undertow-servlet\2.0.28.Final\undertow-servlet-2.0.28.Final.jar;E:\apache-maven-3.5.0\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;E:\apache-maven-3.5.0\repository\org\slf4j\slf4j-nop\1.7.29\slf4j-nop-1.7.29.jar;E:\apache-maven-3.5.0\repository\org\slf4j\slf4j-api\1.7.29\slf4j-api-1.7.29.jar;E:\apache-maven-3.5.0\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;E:\apache-maven-3.5.0\repository\mysql\mysql-connector-java\8.0.16\mysql-connector-java-8.0.16.jar;E:\apache-maven-3.5.0\repository\com\google\protobuf\protobuf-java\3.6.1\protobuf-java-3.6.1.jar;E:\apache-maven-3.5.0\repository\com\alibaba\druid\1.0.29\druid-1.0.29.jar;E:\apache-maven-3.5.0\repository\com\jfinal\cos\2019.8\cos-2019.8.jar" io.jpress.l1.Starter

Starting JFinal 4.8 -> http://0.0.0.0:80

Info: jfinal-undertow 2.0, undertow 2.0.28.Final, jvm 1.8.0_171

log4j:WARN No appenders could be found for logger (org.jboss.logging).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

java.lang.RuntimeException: Can not create instance of class: HelloConfig.class

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

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

at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:111)

at io.undertow.servlet.core.ManagedFilter.createFilter(ManagedFilter.java:80)

at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:591)

at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:556)

at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)

at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:598)

at com.jfinal.server.undertow.UndertowServer.configHttp(UndertowServer.java:284)

at com.jfinal.server.undertow.UndertowServer.doStart(UndertowServer.java:262)

at com.jfinal.server.undertow.UndertowServer.start(UndertowServer.java:159)

at com.jfinal.server.undertow.UndertowServer.start(UndertowServer.java:96)

at io.jpress.l1.Starter.main(Starter.java:8)

Caused by: java.lang.ClassNotFoundException: HelloConfig.class

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

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)

at com.jfinal.server.undertow.hotswap.HotSwapClassLoader.loadClass(HotSwapClassLoader.java:106)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

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

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

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

... 13 more


Process finished with exit code 1


评论区

子睿

2020-05-13 12:30

UndertowServer.start(HelloConfig.class,80,true); 改成这个就对了

子睿

2020-05-13 12:30

UndertowServer.start(“HelloConfig.class”,80,true); 这个错

子睿

2020-05-13 12:31

为什么提示是String 类型 却不能加双引号呢?

子睿

2020-05-13 12:32

@JFinal 为什么提示是String 类型 却不能加双引号呢?

JFinal

2020-05-13 12:33

@子睿 可以用双引号,只不过你得是全路径,例如:
UndertowServer.start("xxx.yyy.zzz.HelloConfig", 80, true);

否则 jfinal 无法知道你的 HelloConfig 是在哪个 package 下面

子睿

2020-05-13 12:35