LoginSignup
0
0

More than 3 years have passed since last update.

java.nio.file.AccessDeniedException: glassfish/domains/domain1/logs/server.log.lckとなった時の対応方法

Posted at
  • 環境
    • CentOS Linux release 7.8.2003 (Core)
    • Payara Server 5.194
    • openjdk version "11.0.7"

事象 : Payaraを起動しようとしたら怒られた

$ asadmin start-domain domain1
java.nio.file.AccessDeniedException: /opt/payara5/glassfish/domains/domain1/logs/server.log.lck
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:182)
    at java.base/java.nio.channels.FileChannel.open(FileChannel.java:292)
    at java.base/java.nio.channels.FileChannel.open(FileChannel.java:345)
    at java.logging/java.util.logging.FileHandler.openFiles(FileHandler.java:511)
    at java.logging/java.util.logging.FileHandler.<init>(FileHandler.java:341)
    at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:114)
    at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:227)
    at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:250)
    at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:142)
    at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:340)
    at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:360)
    at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:294)
    at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:

Launching Payara Server on Felix platform
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
    at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:235)
    at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:338)
    at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:90)

原因 : glassfishディレクトリに権限がないから

problem to start GlassFish server - Ask Ubuntu

対応 : glassfishディレクトリの権限を変更する

# ディレクトリ配下まで再帰的(-R)に権限を変更する
$ sudo chmod -R 777 /opt/payara5/glassfish
[sudo] password for ponsuke: 

# もう一度起動したら起動した
$ asadmin start-domain domain1
Waiting for domain1 to start .......
Successfully started the domain : domain1
domain  Location: /opt/payara5/glassfish/domains/domain1
Log File: /opt/payara5/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0