Wildfly 20无法在Ubuntu 20上“开箱即用”运行

huangapple go评论111阅读模式
英文:

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

问题

在在新安装了Wildfly 20到一个全新的Ubuntu 20系统后,我第一次尝试运行Wildfly时出现了一个错误:"无法创建服务器数据目录:/opt/wildfly-20.0.1.Final/standalone/data"。以下是完整的错误信息:

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

  JBoss引导环境

  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

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

无法读取或配置org.jboss.logmanager.LogManager
java.lang.IllegalArgumentException: 无法为处理程序"FILE"实例化类"org.jboss.logmanager.handlers.PeriodicRotatingFileHandler"
    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)
    ...

java.lang.IllegalStateException: WFLYSRV0124: 无法创建服务器数据目录:/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)
    ...

以下是从 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

有人能解释一下出了什么问题吗?

提前谢谢。

英文:

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 &quot;org.jboss.logmanager.handlers.PeriodicRotatingFileHandler&quot; for handler &quot;FILE&quot;
	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.&lt;init&gt;(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.&lt;init&gt;(FileHandler.java:119)
	at org.jboss.logmanager@2.1.15.Final//org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.&lt;init&gt;(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.&lt;init&gt;(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

得分: 1

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
英文:

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

huangapple
  • 本文由 发表于 2020年8月28日 01:46:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/63621565.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定