欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決CentOS7中運(yùn)行jar包報(bào)錯(cuò):xxx(Permission?denied)

 更新時(shí)間:2024年02月02日 11:41:00   作者:愛北的琳兒  
在實(shí)際工作我們經(jīng)常會(huì)在linux上運(yùn)行Spring boot編寫的微服務(wù)程序,下面這篇文章主要給大家介紹了關(guān)于如何解決CentOS7中運(yùn)行jar包報(bào)錯(cuò):xxx(Permission?denied)的相關(guān)資料,需要的朋友可以參考下

場(chǎng)景說明:

在CentOS7中運(yùn)行jar包報(bào)錯(cuò),錯(cuò)誤代碼如下:

at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
2024-02-01 17:12:47.138 ERROR 17886 --- [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(null,true) call failed. java.io.FileNotFoundException: /logs/server/logs/2024-02-01.log (Permission denied)
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[alertFILE] - openFile(null,true) call failed. java.io.FileNotFoundException: /logs/server/alert/2024-02-01.log (Permission denied)

大致說明:

是在項(xiàng)目啟動(dòng)時(shí),創(chuàng)建日志,但是在訪問路徑時(shí)報(bào)錯(cuò)了,java.io.FileNotFoundException原因是:當(dāng)前登錄Linux的用戶對(duì)于訪問/logs/server路徑?jīng)]有權(quán)限。因此我將該路徑的權(quán)限設(shè)置為777(最高權(quán)限,示例為給所有用戶添加權(quán)限)就可以了。

方式一、下圖是用ftp工具更改權(quán)限

方式二、進(jìn)入Linux系統(tǒng)中,使用root權(quán)限對(duì)文件或文件夾進(jìn)行權(quán)限更改,命令如下:

chmod 777 /logs/server

注意:如果目錄下有多個(gè)文件或文件夾要賦予權(quán)限,需要循環(huán)賦值,可以執(zhí)行以下代碼

chmod -R 755 /logs/server

給指定用戶添加權(quán)限:示例表示給www用戶添加對(duì)文件夾‘/logs/server’

方式三、寶塔面板中修改權(quán)限

總結(jié) 

到此這篇關(guān)于解決CentOS7中運(yùn)行jar包報(bào)錯(cuò):xxx(Permission denied)的文章就介紹到這了,更多相關(guān)CentOS7運(yùn)行jar包報(bào)錯(cuò)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論