简体   繁体   中英

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.

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

So first make sure that the User who is running the Springboot server (abhishek) has permission to create the dir.

This you can check by doing ls -ltra in ( /opt/, /opt/apps/ and sub dir if they are already existing)

eg

-rw-r--r-- 1 raviy raviy 655 Feb 25 2019.profile -rw-r--r-- 1 raviy raviy 220 Feb 25 2019.bash_logout

Here raviy is owner, if you are not owner then change permission(with sudo or ask admin)

chmod -R 777 /opt ( 777 should be avoided, its hustto run your program)

after that java should be able to create the dir

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM