[英]Maven Build Asks for log file and (Permission Denied)
我有一個從GitHub下載的開源Maven項目,該項目稱為ElasticInbox( https://github.com/elasticinbox/elasticinbox.git )。
當我嘗試構建項目時,出現以下錯誤:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(/var/log/elasticinbox/elasticinbox.log,true) call failed. java.io.FileNotFoundException: /var/log/elasticinbox/elasticinbox.log (Permission denied)
at java.io.FileNotFoundException: /var/log/elasticinbox/elasticinbox.log (Permission denied)
at at java.io.FileOutputStream.open0(Native Method)
at at java.io.FileOutputStream.open(FileOutputStream.java:270)
at at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at at ch.qos.logback.core.recovery.ResilientFileOutputStream.<init>(ResilientFileOutputStream.java:28)
at at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:149)
at at ch.qos.logback.core.FileAppender.start(FileAppender.java:108)
at at ch.qos.logback.core.rolling.RollingFileAppender.start(RollingFileAppender.java:72)
at at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:318)
at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:197)
at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:183)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:157)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:143)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:106)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:56)
at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at at org.ops4j.pax.web.extender.war.internal.Activator.<clinit>(Activator.java:58)
at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at at java.lang.Class.newInstance(Class.java:442)
at at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:151)
at at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
at at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374)
at at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067)
at at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561)
at at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546)
at at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459)
at at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
at at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440)
at at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
at at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
最初,錯誤是找不到文件,然后我通過終端手動創建了此日志文件。 據我了解,這不是正在執行的項目代碼。 看來是Maven構建正在拋出此錯誤,我無法繼續進行下去。
有人可以幫我解決這個問題嗎?
因為未與他人共享對您的文件位置的訪問權限。 因此,您將獲得權限被拒絕的問題。
在logback.xml
文件中,已指定日志文件的位置https://github.com/elasticinbox/elasticinbox/blob/master/config/logback.xml 。 嘗試將其路徑更改為用戶目錄,它應該可以工作。
剛遇到完全相同的問題,您可以進行以下檢查:
path
正確-前綴/
表示絕對值; sudo ls -alh path_to_the_file
檢查,如果沒有,則使用sudo chown -R user:user the_parent_folder_name
進行更改; 我先刪除了整個文件夾,然后使用適當的所有者創建了一個新文件夾,以解決此問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.