Wildfly 20 fails to run “out-of-the-box” on Ubuntu 20

∥☆過路亽.° 提交于 2021-02-11 17:39:16

问题


Immediately after installing Wildfly 20 on a fresh Ubuntu 20 system my 1st attempt to run Wildfly crashes with a "Could not create server data directory: /opt/wildfly-20.0.1.Final/standalone/data" error. Here is the full dump:

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

  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 org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:117)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:336)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:289)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:298)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:546)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:170)
    at org.jboss.logmanager@2.1.15.Final//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 org.jboss.logmanager@2.1.15.Final//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 org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:151)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:104)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:189)
    at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.handlers.FileHandler.<init>(FileHandler.java:119)
    at org.jboss.logmanager@2.1.15.Final//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 org.jboss.as.server@12.0.3.Final//org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:463)
    at org.jboss.as.server@12.0.3.Final//org.jboss.as.server.Main.determineEnvironment(Main.java:388)
    at org.jboss.as.server@12.0.3.Final//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)

Here are the installation steps from 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

Can anyone explain what has gone wrong here?

Thank you in advance.


回答1:


Wildfly doesn't have permission to write to /opt/wildfly-20.0.1.Final/standalone/log/server.log because you extracted it with sudo so the directories and files are all owned by root.

If this is running in a development type environment, run:

sudo chown -R $USER /opt/wildfly-20.0.1.Final

This will change all files and directories to be owned by you. If, instead, you run as a generic user (say wildfly) just change to:

sudo chown -R wildfly /opt/wildfly-20.0.1.Final


来源:https://stackoverflow.com/questions/63621565/wildfly-20-fails-to-run-out-of-the-box-on-ubuntu-20

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!