maven nexus 私服搭建运行报错'Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied'

  造成错误的原因也是巧合,我第一次创建nexus时出于容器权限的问题采用临时关闭selinux的方法造成的遗留问题,第二次启动被锁了文件,报错信息如下

OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
nexus    | Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
nexus    | Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
nexus    | java.io.FileNotFoundException: ../sonatype-work/nexus3/tmp/i4j_ZTDnGON8hezynsMX2ZCYAVDtQog=.lock (Permission denied)
nexus    |     at java.io.RandomAccessFile.open0(Native Method)
nexus    |     at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
nexus    |     at java.io.RandomAccessFile.(RandomAccessFile.java:243)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.check(SingleInstance.java:72)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.checkForCurrentLauncher(SingleInstance.java:31)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.checkSingleInstance(UnixLauncher.java:88)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:67)
nexus    | Unable to delete file: /nexus-data/cache/bundle272/version0.0/revision.location
nexus    | Unable to update instance pid: /nexus-data/instances/instance.properties (Permission denied)
nexus    | Exception in thread "Thread-2" java.lang.SecurityException: Could not lock User prefs. Lock file access denied.
nexus    |     at java.util.prefs.FileSystemPreferences.checkLockFile0ErrorCode(FileSystemPreferences.java:949)
nexus    |     at java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:937)
nexus    |     at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:741)
nexus    |     at java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:836)
nexus    |     at java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:476)
nexus    |     at java.util.prefs.FileSystemPreferences.access$1200(FileSystemPreferences.java:50)
nexus    |     at java.util.prefs.FileSystemPreferences$4$1.run(FileSystemPreferences.java:454)
nexus    | Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
nexus    | Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
nexus    | OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
nexus    | java.io.FileNotFoundException: ../sonatype-work/nexus3/tmp/i4j_ZTDnGON8hezynsMX2ZCYAVDtQog=.lock (Permission denied)
nexus    |     at java.io.RandomAccessFile.open0(Native Method)
nexus    |     at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
nexus    |     at java.io.RandomAccessFile.(RandomAccessFile.java:243)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.check(SingleInstance.java:72)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.checkForCurrentLauncher(SingleInstance.java:31)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.checkSingleInstance(UnixLauncher.java:88)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:67)
nexus    | Unable to delete file: /nexus-data/cache/bundle272/version0.0/revision.location
nexus    | Unable to update instance pid: /nexus-data/instances/instance.properties (Permission denied)
nexus    | Exception in thread "Thread-2" java.lang.SecurityException: Could not lock User prefs. Lock file access denied.
nexus    |     at java.util.prefs.FileSystemPreferences.checkLockFile0ErrorCode(FileSystemPreferences.java:949)
nexus    |     at java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:937)
nexus    |     at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:741)
nexus    |     at java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:836)
nexus    |     at java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:476)
nexus    |     at java.util.prefs.FileSystemPreferences.access$1200(FileSystemPreferences.java:50)
nexus    |     at java.util.prefs.FileSystemPreferences$4$1.run(FileSystemPreferences.java:454)
nexus    | Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
nexus    | Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
nexus    | OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
nexus    | java.io.FileNotFoundException: ../sonatype-work/nexus3/tmp/i4j_ZTDnGON8hezynsMX2ZCYAVDtQog=.lock (Permission denied)
nexus    |     at java.io.RandomAccessFile.open0(Native Method)
nexus    |     at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
nexus    |     at java.io.RandomAccessFile.(RandomAccessFile.java:243)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.check(SingleInstance.java:72)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.checkForCurrentLauncher(SingleInstance.java:31)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.checkSingleInstance(UnixLauncher.java:88)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:67)
nexus    | Unable to delete file: /nexus-data/cache/bundle272/version0.0/revision.location
nexus    | Unable to update instance pid: /nexus-data/instances/instance.properties (Permission denied)
nexus    | Exception in thread "Thread-2" java.lang.SecurityException: Could not lock User prefs. Lock file access denied.
nexus    |     at java.util.prefs.FileSystemPreferences.checkLockFile0ErrorCode(FileSystemPreferences.java:949)
nexus    |     at java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:937)
nexus    |     at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:741)
nexus    |     at java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:836)
nexus    |     at java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:476)
nexus    |     at java.util.prefs.FileSystemPreferences.access$1200(FileSystemPreferences.java:50)
nexus    |     at java.util.prefs.FileSystemPreferences$4$1.run(FileSystemPreferences.java:454)
nexus    | OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
nexus    | Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
nexus    | Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
nexus    | java.io.FileNotFoundException: ../sonatype-work/nexus3/tmp/i4j_ZTDnGON8hezynsMX2ZCYAVDtQog=.lock (Permission denied)
nexus    |     at java.io.RandomAccessFile.open0(Native Method)
nexus    |     at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
nexus    |     at java.io.RandomAccessFile.(RandomAccessFile.java:243)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.check(SingleInstance.java:72)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.checkForCurrentLauncher(SingleInstance.java:31)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.checkSingleInstance(UnixLauncher.java:88)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:67)
nexus    | Unable to delete file: /nexus-data/cache/bundle272/version0.0/revision.location
nexus    | Unable to update instance pid: /nexus-data/instances/instance.properties (Permission denied)
nexus    | Exception in thread "Thread-2" java.lang.SecurityException: Could not lock User prefs. Lock file access denied.
nexus    |     at java.util.prefs.FileSystemPreferences.checkLockFile0ErrorCode(FileSystemPreferences.java:949)
nexus    |     at java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:937)
nexus    |     at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:741)
nexus    |     at java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:836)
nexus    |     at java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:476)
nexus    |     at java.util.prefs.FileSystemPreferences.access$1200(FileSystemPreferences.java:50)
nexus    |     at java.util.prefs.FileSystemPreferences$4$1.run(FileSystemPreferences.java:454)
nexus    | Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
nexus    | Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
nexus    | OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
nexus    | java.io.FileNotFoundException: ../sonatype-work/nexus3/tmp/i4j_ZTDnGON8hezynsMX2ZCYAVDtQog=.lock (Permission denied)
nexus    |     at java.io.RandomAccessFile.open0(Native Method)
nexus    |     at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
nexus    |     at java.io.RandomAccessFile.(RandomAccessFile.java:243)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.check(SingleInstance.java:72)
nexus    |     at com.install4j.runtime.launcher.util.SingleInstance.checkForCurrentLauncher(SingleInstance.java:31)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.checkSingleInstance(UnixLauncher.java:88)
nexus    |     at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:67)
nexus    | Unable to delete file: /nexus-data/cache/bundle272/version0.0/revision.location
nexus    | Unable to update instance pid: /nexus-data/instances/instance.properties (Permission denied)
nexus    | Exception in thread "Thread-2" java.lang.SecurityException: Could not lock User prefs. Lock file access denied.
nexus    |     at java.util.prefs.FileSystemPreferences.checkLockFile0ErrorCode(FileSystemPreferences.java:949)
nexus    |     at java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:937)
nexus    |     at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:741)
nexus    |     at java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:836)
nexus    |     at java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:476)
nexus    |     at java.util.prefs.FileSystemPreferences.access$1200(FileSystemPreferences.java:50)
nexus    |     at java.util.prefs.FileSystemPreferences$4$1.run(FileSystemPreferences.java:454)

关键是Could not lock User prefs. Lock file access denied.异常抛出在此,我使用的是docker-compose启动的容器,并将挂载目录放在/usr/local/docker/nexus/,我看了下在nexus目录下生成的data目录下有一lock文件(有内容),简单粗暴的删除了lock文件,问题解决.但是这应该不是正确的解决方式,怎么去释放锁?大神知道了评论说下吧,谢谢.

你可能感兴趣的:(nexus)