简体   繁体   English

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

[英]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.

相关问题 尝试启动springboot应用程序时获取服务器时区值“未知”错误 - Getting server time zone value 'unknown' error while trying to start springboot application 尝试在 Eclipse 中构建 Gradle 项目时出错 - Getting error while trying to build Gradle project in eclipse 运行springboot应用程序时出现错误 - Getting error while running springboot application 尝试使用 springboot 应用程序上传 5gb 文件时出现 memory 错误 - While trying to upload 5gb file using springboot application im getting out of memory error Springboot应用程序无法在现有的Tomcat上完全启动 - Springboot application not fully start on an existing tomcat 尝试在springboot中使用post方法时出错 - Error while trying to use post metod in springboot 尝试将 append 字符串作为 SpringBoot 应用程序的所有现有记录器的前缀 - Trying to append a string as prefix to all existing loggers for SpringBoot application 我在尝试更新用户时出错,但无法使用 SpringBoot 显示我的用户角色 - I getting an error while i am trying to update an user and not able to show my users roles using SpringBoot 我正在尝试使用 Java Gradle 应用程序(SpringBoot)的 GitHub 操作自动部署到 Heroku,但每次都会出错 - I am trying automatic deploy to Heroku using GitHub actions for java Gradle app (SpringBoot) but getting error every time 构建应用程序时出现 Gradle 错误 - Gradle error while building the application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM