问题求助: git clone git@github.com:halo-dev/halo.git,下载到本地的文件夹,在ubuntu 18.04 下,用intellij idea import project 打开。build成功,但点击运行application 显示如下错误信息:
halo logo 正确显示:
/ / / /___ / /__
/ // / __ `/ / __ \
/ __ / // / / // /
// //_,//____/
onfigReactiveWebServerApplicationContext 有异常:
Version:
2023-01-19T20:54:27.492-05:00 INFO 25439 --- [ restartedMain] run.halo.app.Application : Starting Application using Java 17.0.6 with PID 25439 (/media/alexz/GodinHeart/DDDD/myGit/code/halo/build/classes/java/main started by alexz in /media/alexz/GodinHeart/DDDD/myGit/code/halo)
2023-01-19T20:54:27.493-05:00 INFO 25439 --- [ restartedMain] run.halo.app.Application : No active profile set, falling back to 1 default profile: "default"
2023-01-19T20:54:27.553-05:00 INFO 25439 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-01-19T20:54:27.553-05:00 INFO 25439 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-01-19T20:54:28.282-05:00 INFO 25439 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-01-19T20:54:28.283-05:00 INFO 25439 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
2023-01-19T20:54:28.396-05:00 INFO 25439 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 111 ms. Found 1 R2DBC repository interfaces.
2023-01-19T20:54:28.946-05:00 INFO 25439 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2023-01-19T20:54:29.057-05:00 INFO 25439 --- [ restartedMain] org.pf4j.DefaultPluginStatusProvider : Enabled plugins: []
2023-01-19T20:54:29.058-05:00 INFO 25439 --- [ restartedMain] org.pf4j.DefaultPluginStatusProvider : Disabled plugins: []
2023-01-19T20:54:29.059-05:00 INFO 25439 --- [ restartedMain] org.pf4j.DefaultPluginManager : PF4J version 3.8.0 in 'deployment' mode
2023-01-19T20:54:29.101-05:00 WARN 25439 --- [ restartedMain] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'trackerEndpoint' defined in file [/media/alexz/GodinHeart/DDDD/myGit/code/halo/build/classes/java/main/run/halo/app/core/extension/endpoint/TrackerEndpoint.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'visitLogWriter' defined in file [/media/alexz/GodinHeart/DDDD/myGit/code/halo/build/classes/java/main/run/halo/app/metrics/VisitLogWriter.class]: Failed to instantiate [run.halo.app.metrics.VisitLogWriter]: Constructor threw exception
2023-01-19T20:54:29.119-05:00 INFO 25439 --- [ restartedMain] .s.b.a.l.ConditionEvaluationReportLogger :
提示有错误,o.s.boot.SpringApplication : Application run failed. 应用运行失败:
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-01-19T20:54:29.128-05:00 ERROR 25439 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
提示:Error creating bean with Error creating bean with name 'trackerEndpoint' defined.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'trackerEndpoint' defined in file [/media/alexz/GodinHeart/DDDD/myGit/code/halo/build/classes/java/main/run/halo/app/core/extension/endpoint/TrackerEndpoint.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'visitLogWriter' defined in file [/media/alexz/GodinHeart/DDDD/myGit/code/halo/build/classes/java/main/run/halo/app/metrics/VisitLogWriter.class]: Failed to instantiate [run.halo.app.metrics.VisitLogWriter]: Constructor threw exception
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:245) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-6.0.3.jar:6.0.3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.3.jar:6.0.3]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-3.0.1.jar:3.0.1]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.1.jar:3.0.1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.1.jar:3.0.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.1.jar:3.0.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.1.jar:3.0.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.1.jar:3.0.1]
at run.halo.app.Application.main(Application.java:25) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.1.jar:3.0.1]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'visitLogWriter' defined in file [/media/alexz/GodinHeart/DDDD/myGit/code/halo/build/classes/java/main/run/halo/app/metrics/VisitLogWriter.class]: Failed to instantiate [run.halo.app.metrics.VisitLogWriter]: Constructor threw exception
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:324) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:312) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-6.0.3.jar:6.0.3]
... 24 common frames omitted
intellij 提示错误原因: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'visitLogWriter':
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [run.halo.app.metrics.VisitLogWriter]: Constructor threw exception
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:223) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:110) ~[spring-beans-6.0.3.jar:6.0.3]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:321) ~[spring-beans-6.0.3.jar:6.0.3]
... 38 common frames omitted
Caused by: java.lang.RuntimeException: java.nio.file.AccessDeniedException: /home/alexz/.halo2/logs/visits.log
at run.halo.app.metrics.VisitLogWriter$AsyncLogWriter.<init>(VisitLogWriter.java:117) ~[main/:na]
at run.halo.app.metrics.VisitLogWriter.<init>(VisitLogWriter.java:50) ~[main/:na]
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:210) ~[spring-beans-6.0.3.jar:6.0.3]
... 40 common frames omitted
6: 提示如下错误原因:Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [run.halo.app.metrics.VisitLogWriter]: Constructor threw exception
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:223) ~[spring-beans-6.0.3.jar:6.0.3]
Caused by: java.nio.file.AccessDeniedException: /home/alexz/.halo2/logs/visits.log
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[na:na]
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[na:na]
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[na:na]
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218) ~[na:na]
at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484) ~[na:na]
at java.base/java.nio.file.Files.newOutputStream(Files.java:228) ~[na:na]
at run.halo.app.metrics.VisitLogWriter$AsyncLogWriter.<init>(VisitLogWriter.java:113) ~[main/:na]
... 47 common frames omitted
我在build.gradle, 增加导入:
implementation 'org.springframework:spring-beans:3.0.1.RELEASE'
implementation 'org.springframework:spring-context:3.0.1.RELEASE'
implementation 'org.springframework.boot:spring-boot:3.0.1'
build通过,但显示如下错误:
/media/alexz/GodinHeart/DDDD/myGit/code/halo/src/main/java/run/halo/app/plugin/PluginRequestMappingHandlerMapping.java:33: error: cannot access EmbeddedValueResolverAware
public class PluginRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
^
class file for org.springframework.context.EmbeddedValueResolverAware not found.
我该如何解决这个问题,多谢各位指教。非常感谢!