[JavaWeb]_[初级]_[Jfinal使用时的常见错误]*持续更新*

唐弘厚
2023-12-01

Jfinal 编译运行问题

1. undertow如何配置静态资源映射

  1. Windows下的路径必须是/,不能是\.
undertow.resourcePath=src/main/webapp,C:/Users/apple/image_resources,classpath:webapp`

2. 新建模块运行报错: 需要重载包含该模块的主pom.xml文件

Connected to the target VM, address: '127.0.0.1:26427', transport: 'socket'
Starting JFinal 4.9.15 -> http://127.0.0.1:8080
Info: jfinal-undertow 2.5, undertow 2.0.34.Final, jvm 11.0.11
java.lang.ClassNotFoundException: com.xxx.module.article.ArticleProxy

...
java.lang.NullPointerException
    at com.jfinal.plugin.activerecord.Model.findAll(Model.java:766)

3. 部署后外网无法问题

undertow.host=0.0.0.0

4. DemoConfig运行出错

  1. pom.xml里添加对servelt.api的依赖和部署打包.
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
</dependency>
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/ServletException
    at com.demo.common.DemoConfig.main(DemoConfig.java:31)
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 1 more

参考

  1. jfinal-undertow 常见问题
 类似资料: