尝试在现有gradle项目上启动springboot应用程序时出错

svujldwt  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(663)

我已经从git克隆了project,但是当我运行应用程序类时,我得到了这个错误。

Logging system failed to initialize using configuration from 'classpath:logback-spring.xml'
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[rollingfileSync] - Failed to create parent directories for [/opt/apps/aggregator/api/logs/Duke-service.log]
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[rollingfileSync] - openFile(/opt/apps/aggregator/api/logs/Duke-service.log,true) call failed. java.io.FileNotFoundException: /opt/apps/aggregator/api/logs/Duke-service.log (No such file or directory)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
    at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:67)
    at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:57)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
    at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:298)
    at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:266)
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:229)
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:202)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
    at Application.main(Application.java:26)
2020-08-21 09:35:31.400 ERROR 21323 --- [           main] o.s.boot.SpringApplication               : Application run failed
xkrw2x1b

xkrw2x1b1#

从日志来看,用户(通过它登录,例如阿披实)似乎没有创建目录/opt/apps/aggregator/api/logs的权限
因此,首先确保运行springboot服务器(abhishek)的用户有创建dir的权限。
您可以通过在中执行ls-ltra(/opt/、/opt/apps/和sub-dir,如果它们已经存在的话)来检查这一点
例如
-rw-r--r--1 raviy raviy 655 2019年2月25日。简介-rw-r--r--1 raviy raviy 220 2019年2月25日。bash\u注销
这里raviy是所有者,如果您不是所有者,则更改权限(与sudo或ask admin一起)
chmod-r 777/opt(应避免使用777,其hustto运行您的程序)
之后,java应该能够创建dir

相关问题