94fzb / zrlog

ZrLog是使用 Java 开发的博客/CMS程序,具有简约,易用,组件化,内存占用低等特点。自带 Markdown 编辑器,让更多的精力放在写作上,而不是花费大量时间在学习程序的使用上。
http://www.zrlog.com
Apache License 2.0
370 stars 152 forks source link

搭建报错,IDEA + localhost:8080/install = 报错 #161

Closed Guo-Bill closed 11 months ago

Guo-Bill commented 11 months ago

static文件夹无法打包到生成的target中,关于target\classes\static\error\500.html,没有这个文件

2023-11-29 20:16:45 严重 handle error java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null at com.zrlog.business.service.TemplateHelper.getTemplatePath(TemplateHelper.java:245) at com.zrlog.business.service.TemplateHelper.fullTemplateInfo(TemplateHelper.java:258) at com.zrlog.blog.web.interceptor.BlogArticleInterceptor.doInterceptor(BlogArticleInterceptor.java:79) at com.zrlog.web.inteceptor.RouterInterceptor.doInterceptor(RouterInterceptor.java:43) at com.hibegin.http.server.handler.HttpRequestHandlerRunnable.run(HttpRequestHandlerRunnable.java:40) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842)

Exception in thread "http-nio-8080-exec-1" java.lang.RuntimeException: java.io.FileNotFoundException: D:\Javacms\zrlog-master\web\target\classes\static\error\500.html (系统找不到指定的路径。) at com.zrlog.web.config.ZrLogErrorHandle.doHandle(ZrLogErrorHandle.java:57) at com.hibegin.http.server.handler.HttpRequestHandlerRunnable.run(HttpRequestHandlerRunnable.java:50) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) Caused by: java.io.FileNotFoundException: D:\Javacms\zrlog-master\web\target\classes\static\error\500.html (系统找不到指定的路径。) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:216) at java.base/java.io.FileInputStream.(FileInputStream.java:157) at com.zrlog.web.config.ZrLogErrorHandle.doHandle(ZrLogErrorHandle.java:55) ... 4 more

Guo-Bill commented 11 months ago

这两个问题中的第二个勉强可以解决,把static文件夹复制到zrlog-master\web\target\classes\目录下;但是第一个问题,始终在报错:java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null

94fzb commented 11 months ago

使用的 application.java 启动的吧,看上去是 Windows 获取的 classpath 和 linux 不一致导致的, 你可以强制指定下程序运行目录为 当前项目的目录试下

94fzb commented 11 months ago

@Guo-Bill https://github.com/94fzb/zrlog/commit/09d2b8c3282f7ccf62ab1297a684aa9a4eb6cd43 最新的代码已经兼容 window 路径的判断了,理论上你还需要将 blog-web 里面的 install 的前端代码完成打包,才会有对应的 js 文件,运行一下 mvn clean package 先