[halo-dev/halo]从2.9.0升级到2.10.0后,博客所有前台页面状态码为500,但console可以正常访问

2024-02-20 628 views
2
是什么版本出现了此问题?

halo:2.10.0-alpha.1

使用的什么数据库?

H2

使用的哪种方式运行?

Docker

在线站点地址

https://blog.chiyustudio.link/

发生了什么?

从2.9.0升级到2.10.0后,博客所有前台页面状态码为500,但console可以正常访问。 从Docker的日志看,好像和SLF4J有关。

相关日志输出
……
SLF4J: A SLF4J service provider failed to instantiate:
org.slf4j.spi.SLF4JServiceProvider: ch.qos.logback.classic.spi.LogbackServiceProvider not a subtype
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
……
org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'run.halo.app.theme.dialect.GlobalHeadInjectionProcessor' (template: "layout" - line 3, col 3)
……
Caused by: java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to class com.fasterxml.jackson.databind.JsonNode (com.fasterxml.jackson.databind.node.ObjectNode is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @87aac27; com.fasterxml.jackson.databind.JsonNode is in unnamed module of loader org.pf4j.PluginClassLoader @742ba594)
……
2023-09-29T14:34:31.265+08:00 ERROR 7 --- [oundedElastic-2] o.t.spring6.SpringWebFluxTemplateEngine  : [THYMELEAF][boundedElastic-2] Exception processing template "index": Error during execution of processor 'run.halo.app.theme.dialect.GlobalHeadInjectionProcessor' (template: "layout" - line 3, col 3)
……
org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'run.halo.app.theme.dialect.GlobalHeadInjectionProcessor' (template: "layout" - line 3, col 3)
……
Caused by: java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to class com.fasterxml.jackson.databind.JsonNode (com.fasterxml.jackson.databind.node.ObjectNode is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @87aac27; com.fasterxml.jackson.databind.JsonNode is in unnamed module of loader org.pf4j.PluginClassLoader @742ba594)
……
2023-09-29T14:34:31.356+08:00 ERROR 7 --- [oundedElastic-2] a.w.r.e.AbstractErrorWebExceptionHandler : [619d0223-3]  500 Server Error for HTTP GET "/"

org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'run.halo.app.theme.dialect.GlobalHeadInjectionProcessor' (template: "layout" - line 3, col 3)
    at org.thymeleaf.processor.element.AbstractElementModelProcessor.process(AbstractElementModelProcessor.java:141) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
    *__checkpoint ⇢ Handler run.halo.app.theme.router.factories.IndexRouteFactory$$Lambda$2429/0x00007f819fa98450@291be803 [DispatcherHandler]
    *__checkpoint ⇢ run.halo.app.cache.PageCacheWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ run.halo.app.security.InitializeRedirectionWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ run.halo.app.security.authentication.login.UsernamePasswordLogoutHandler [DefaultWebFilterChain]
    *__checkpoint ⇢ run.halo.app.security.authentication.login.DelegatingLogoutPageGeneratingWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ run.halo.app.security.authentication.login.UsernamePasswordAuthenticator [DefaultWebFilterChain]
    *__checkpoint ⇢ AuthorizationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ ExceptionTranslationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ LogoutWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ ServerRequestCacheWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ HaloAnonymousAuthenticationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ ReactorContextWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ CsrfWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ HttpHeaderWriterWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.web.filter.reactive.ServerHttpObservationFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ HTTP GET "/" [ExceptionHandlingWebHandler]
Original Stack Trace:
        at org.thymeleaf.processor.element.AbstractElementModelProcessor.process(AbstractElementModelProcessor.java:141) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.util.ProcessorConfigurationUtils$ElementModelProcessorWrapper.process(ProcessorConfigurationUtils.java:649) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1510) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.Model.process(Model.java:290) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.GatheringModelProcessable.process(GatheringModelProcessable.java:78) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement(ProcessorTemplateHandler.java:1640) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.CloseElementTag.beHandled(CloseElementTag.java:139) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1587) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:661) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.thymeleaf.spring6.SpringWebFluxTemplateEngine.lambda$createFullStream$0(SpringWebFluxTemplateEngine.java:198) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:58) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4495) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) ~[reactor-core-3.5.10.jar:3.5.10]
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
        at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
Caused by: java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to class com.fasterxml.jackson.databind.JsonNode (com.fasterxml.jackson.databind.node.ObjectNode is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @87aac27; com.fasterxml.jackson.databind.JsonNode is in unnamed module of loader org.pf4j.PluginClassLoader @742ba594)
    at java.base/java.lang.Iterable.forEach(Unknown Source) ~[na:na]

回答

3

这个问题我会尝试复现并解决。

另外,2.10.0 只发布了 alpha 版本,不建议在生产环境下使用,建议先撤回到 2.9.2。

9

修正一下,数据库使用的是PostgreSQL 15.3,不是H2

9

我这里无法正常复现。从日志中看,可能是因为某些插件引起的问题,可能还需要提供一下当前安装的插件以复现这个问题。

同时,期望能够提供更完整的日志。

5

应该是使用了 Live2d 插件导致的,但目前不知道什么原因,正在排查