在新的Ubuntu 20系统上安装Wildfly 20之后,我第一次尝试运行Wildfly时崩溃,并出现“无法创建服务器数据目录:/opt/wildfly-20.0.1.Final/standalone/data”错误。这是完整的转储:

=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/wildfly-20.0.1.Final

  JAVA: java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true  --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED

=========================================================================

Failed to read or configure the org.jboss.logmanager.LogManager
java.lang.IllegalArgumentException: Failed to instantiate class "org.jboss.logmanager.handlers.PeriodicRotatingFileHandler" for handler "FILE"
    at [email protected]//org.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:117)
    at [email protected]//org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:336)
    at [email protected]//org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:289)
    at [email protected]//org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:298)
    at [email protected]//org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:546)
    at [email protected]//org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)
    at [email protected]//org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:170)
    at [email protected]//org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:132)
    at java.logging/java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:445)
    at java.logging/java.util.logging.LogManager$2.run(LogManager.java:394)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.logging/java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:382)
    at java.logging/java.util.logging.LogManager.getLogManager(LogManager.java:430)
    at org.jboss.modules.Main.main(Main.java:457)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at [email protected]//org.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:115)
    ... 13 more
Caused by: java.io.FileNotFoundException: /opt/wildfly-20.0.1.Final/standalone/log/server.log (No such file or directory)
    at java.base/java.io.FileOutputStream.open0(Native Method)
    at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
    at [email protected]//org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:151)
    at [email protected]//org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:104)
    at [email protected]//org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:189)
    at [email protected]//org.jboss.logmanager.handlers.FileHandler.<init>(FileHandler.java:119)
    at [email protected]//org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.<init>(PeriodicRotatingFileHandler.java:72)
    ... 18 more
java.lang.IllegalStateException: WFLYSRV0124: Could not create server data directory: /opt/wildfly-20.0.1.Final/standalone/data
    at [email protected]//org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:463)
    at [email protected]//org.jboss.as.server.Main.determineEnvironment(Main.java:388)
    at [email protected]//org.jboss.as.server.Main.main(Main.java:96)
    at org.jboss.modules.Module.run(Module.java:352)
    at org.jboss.modules.Module.run(Module.java:320)
    at org.jboss.modules.Main.main(Main.java:617)
以下是https://docs.wildfly.org/20/Getting_Started_Guide.html#installation的安装步骤:
sudo apt install openjdk-11-jdk

sudo apt-get update

Version_Number=20.0.1.Final

wget https://download.jboss.org/wildfly/$Version_Number/wildfly-$Version_Number.tar.gz -P /tmp

sudo tar xf /tmp/wildfly-$Version_Number.tar.gz -C /opt/

cd /opt/wildfly-$Version_Number/bin

./standalone.sh
谁能解释这里出了什么问题?
先感谢您。

最佳答案

Wildfly没有写/opt/wildfly-20.0.1.Final/standalone/log/server.log的权限,因为您是使用sudo提取它的,因此目录和文件均归root所有。
如果它在开发类型环境中运行,请运行:

sudo chown -R $USER /opt/wildfly-20.0.1.Final
这将更改您拥有的所有文件和目录。相反,如果您以普通用户身份运行(例如wildfly),只需更改为:
sudo chown -R wildfly /opt/wildfly-20.0.1.Final

10-08 20:22