[英]Getting error while trying to start springboot application on existing gradle project
I have cloned project from Git, but when I run the application class I get this error.我已经从 Git 克隆了项目,但是当我运行应用程序 class 时出现此错误。
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
From logs it seems the User (through which you are logged in eg abhishek) dont have permission to create the directory /opt/apps/aggregator/api/logs从日志看来,用户(通过它登录,例如 abhishek)没有创建目录 /opt/apps/aggregator/api/logs 的权限
So first make sure that the User who is running the Springboot server (abhishek) has permission to create the dir.所以首先要确保运行 Springboot 服务器的用户(abhishek)有创建目录的权限。
This you can check by doing ls -ltra in ( /opt/, /opt/apps/ and sub dir if they are already existing)您可以通过在(/opt/、/opt/apps/ 和子目录中执行 ls -ltra 来检查它们是否已经存在)
eg例如
-rw-r--r-- 1 raviy raviy 655 Feb 25 2019.profile -rw-r--r-- 1 raviy raviy 220 Feb 25 2019.bash_logout -rw-r--r-- 1 raviy raviy 655 2019 年 2 月 25 日.profile -rw-r--r-- 1 raviy raviy 220 2019 年 2 月 25 日.bash_logout
Here raviy is owner, if you are not owner then change permission(with sudo or ask admin)这里 raviy 是所有者,如果您不是所有者,则更改权限(使用 sudo 或询问管理员)
chmod -R 777 /opt ( 777 should be avoided, its hustto run your program) chmod -R 777 /opt ( 777 应该避免,它运行你的程序)
after that java should be able to create the dir之后 java 应该能够创建目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.