gpt4 book ai didi

java - Maven 构建要求提供日志文件和(权限被拒绝)

转载 作者:行者123 更新时间:2023-12-01 09:18:06 25 4
gpt4 key购买 nike

我有一个从 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 构建引发了此错误,我无法继续进行。

有人可以帮我解决这个问题吗?

最佳答案

刚刚遇到了完全相同的问题,您可以进行以下检查:

  1. 确保路径正确 - 以/为前缀表示绝对路径;
  2. 当前用户具有写入文件的适当权限 - 使用 sudo ls -alh path_to_the_file 检查它,如果没有,则使用 sudo chown -R user:user the_parent_folder_name改变它;

我通过先删除整个文件夹然后使用正确的所有者创建一个新文件夹来修复它。

关于java - Maven 构建要求提供日志文件和(权限被拒绝),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40379603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com