问题描述
我试图在没有权限写入WildFly主目录及其子目录的用户下启动WildFly 8.2。为此,我已将 standalone
目录复制到用户主目录。下面是一个命令,用于在cygwin中启动WildFly:
$ / cygdrive / c / Program\ Files / wildfly .0.Final / bin / standalone.sh -Djboss.server.base.dir ='C:\Users\above_ mentioned_user\standalone'-c standalone.xml
这是命令的输出:
cygpath :不能转换为空路径
============================== ================================
JBoss Bootstrap环境
JBOSS_HOME:C:\Program Files\wildfly-8.2.0.Final
JAVA:/ cygdrive / c / Program Files / Java / jdk1.7.0_51 / bin / java
JAVA_OPTS:-server -Xms64m -Xmx512m -XX:MaxPermSize = 256m -Djava.net.preferIPv4Stack = true -Djboss.modules.system.pkgs = org.jboss.byteman -Djava.awt.headless = true
========================================== =============================
java.lang.IllegalArgumentException:无法实例化类 org.jboss.logmanager.handlers.PeriodicRotatingFileHandler处理程序FILE
at org.jboss.logmanager.config.AbstractPropertyConfiguration $ ConstructAction.validate(AbstractPropertyConfiguration.java:119)
at org.jboss.logmanager .config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:338)
at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:291)
at org.jboss.logmanager.config.LogContextConfigurationImpl .commit(LogContextConfigurationImpl.java:300)
在org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:542)
在org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97 )
在org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:300)
在org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:262)
在java。 util.logging.LogManager $ 2.run(LogManager.java:312)
在java.util.logging.LogManager $ 2.run(LogManager.java:310)
在java.security.AccessController.doPrivileged( Native方法)
在java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:310)
在java.util.logging.LogManager.getLogManager(LogManager.java:292)
at < init>(Logger.java:260)
在java中,在$ java.util.logging.Logger。< init>(Logger.java:264)
at java.util.logging.Logger。 util.logging.LogManager $ RootLogger。< init>(LogManager.java:1430)
at java.util.logging.LogManager $ RootLogger。< init>(LogManager.java:1428)
java.util.logging.LogManager $ 1.run(LogManager.java:196)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager。< clinit> (LogManager.java:173)
at org.jboss.modules.Main.main(Main.java:443)
引发者:java.lang.reflect.InvocationTargetException
at sun.reflect .NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
在java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.jboss.logmanager.config.AbstractPropertyConfiguration $ ConstructAction.validate(AbstractPropertyConfiguration.java:117)
... 20更多
原因:java.io.FileNotFoundException:C:\Program Files\wildfly-8.2.0.Final\standalone\log\server.log(系统找不到指定的路径)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream。< init>(FileOutputStream.java:221)
at org.jboss.logmanager.handlers。 FileHandler.setFile(FileHandler.java:154)
at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:105)
at org.jboss.logmanager.handlers.FileHandler.setFileName FileHandler.java:192)
at org.jboss.logmanager.handlers.FileHandler。< init>(FileHandler.java:122)
at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler。< init> ;(PeriodicRotatingFileHandler.java:73)
... 25 more
14:17:42,975 INFO [org.jboss.as.clustering.infinispan](ServerService线程池 - 32)JBAS010280:激活Infinispan子系统。
14:17:42,884 INFO [org.jboss.as.naming](ServerService线程池 - 40)JBAS011800:激活命名子系统
14:17:42,759 INFO [org.jboss.as.connector .subsystems.datasources](ServerService线程池 - 27)JBAS010403:部署JDBC兼容的驱动程序类org.h2.Driver(版本1.3)
14:17:42,882 INFO [org.jboss.as.jsf]服务线程池 - 38)JBAS012615:激活以下JSF实现:[main]
14:17:42,895 INFO [org.jboss.remoting](MSC服务线程1-8)JBoss Remoting版本4.0.6。最后
14:17:42,906 INFO [org.jboss.as.security](ServerService线程池 - 45)JBAS013171:激活安全子系统
14:17:42,919 WARN [org.jboss.as。 txn](ServerService线程池 - 46)JBAS010153:节点标识符属性设置为默认值。请确保它是唯一的。
14:17:42,935 INFO [org.jboss.as.connector.logging](MSC服务线程1-1)JBAS010408:启动JCA子系统(IronJacamar 1.1.9.Final)
14:17: WFLYIO001:根据您的4个可用处理器,工作程序'默认'自动配置为8个核心线程,有64个任务线程
14:17(服务线程池 - 31) :42,041 INFO [org.jboss.as.webservices](ServerService线程池 - 48)JBAS015537:激活WebServices扩展
14:17:42,953 INFO [org.jboss.as.connector.deployers.jdbc](MSC服务线程1-3)JBAS010417:使用driver-name = h2启动驱动程序服务
14:17:42,960 INFO [org.jboss.as.security](MSC服务线程1-3)JBAS013170:Current PicketBox version = 4.0.21.Final
14:17:42,967 INFO [org.jboss.as.naming](MSC服务线程1-2)JBAS011802:开始命名服务
14:17:42,970 INFO [ jboss.as.mail.extension](MSC服务线程1-5)JBAS015400:绑定邮件会话[java:jboss / mail / Default]
14:17:42,740 INFO [org.wildfly.extension.undertow] MSC服务线程1-3)JBAS017502:Undertow 1.1.0.Final启动
14:17:42,740 INFO [org.wildfly.extension.undertow](ServerService线程池 - 47)JBAS017502:Undertow 1.1.0。最后启动
14:17:43,489 INFO [org.wildfly.extension.undertow](ServerService线程池 - 47)JBAS017527:为路径C创建文件处理程序:\Program Files\wildfly-8.2.0。最后/欢迎内容
14:17:43,497 INFO [org.wildfly.extension.undertow](MSC服务线程1-1)JBAS017525:启动服务器默认服务器。
14:17:43,420 INFO [org.wildfly.extension.undertow](MSC服务线程1-1)JBAS017531:主机默认主机启动
14:17:43,672 INFO [org.wildfly.extension .undertow](MSC服务线程1-5)JBAS017519:Underheadw监听器默认侦听/127.0.0.1:8080
14:17:43919 INFO [org.jboss.as.server.deployment.scanner](MSC服务线程1-3)JBAS015012:为目录C启动FileSystemDeploymentService:\Users\tazi0514\projects\\\
fv\r2\wildfly\deployments
14:17:43,808 INFO [org.jboss。 as.connector.subsystems.datasources](MSC服务线程1-3)JBAS010400:绑定数据源[java:jboss / datasources / ExampleDS]
14:17:43,994 INFO [org.jboss.ws.common.management ](MSC服务线程1-7)JBWS022052:启动JBoss Web服务 - 堆栈CXF服务器4.3.2.Final
14:17:44,114 INFO [org.jboss.as](控制器引导线程)JBAS015961:Http管理接口监听http://127.0.0.1:9990/management
14:17:44,115 INFO [org.jboss.as](控制器启动线程)JBAS015951:管理控制台侦听http://127.0.0.1: 9990
14:17:44,116 INFO [org.jboss.as](控制器启动线程)JBAS015874:WildFly 8.2.0.FinalTweek开始于3294ms - 开始184的服务(82服务是惰性,被动或按需)
正如你可以在上面的日志中看到WildFly尝试写入 C:\Program Files \wildfly-8.2.0.Final \standalone\log\server.log
,即使有另一个目录在命令行中指出为服务器基本目录。
有没有办法让WildFly不尝试在默认服务器中写入日志基本目录?
看起来WildFly忽略一个值 jboss.server.base.dir
属性。但它仍然考虑 JBOSS_BASE_DIR
环境变量的值。所以我刚刚在BASH中创建了下面的别名,有一个简短的方法来启动WildFly:
别名wildfly_start ='JBOSS_BASE_DIR = $(realpath〜/ wildfly)/ bin / bash -c/ cygdrive / c / Program\ Files / wildfly-8.2.0.Final / bin / standalone.sh -c standalone.xml'
在我的情况下,cygwin中的用户主目录与Windows用户主目录一致。I'm trying to start WildFly 8.2 under a user that doesn't have permissions to write in a WildFly home directory and it's subdirectories. For this purpose I've copied standalone
directory to a user home directory. Here is a command I use to start WildFly in cygwin:
$ /cygdrive/c/Program\ Files/wildfly-8.2.0.Final/bin/standalone.sh -Djboss.server.base.dir='C:\Users\above_mentioned_user\standalone' -c standalone.xml
And here is an output of this command:
cygpath: can't convert empty path
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: C:\Program Files\wildfly-8.2.0.Final
JAVA: /cygdrive/c/Program Files/Java/jdk1.7.0_51/bin/java
JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
=========================================================================
java.lang.IllegalArgumentException: Failed to instantiate class "org.jboss.logmanager.handlers.PeriodicRotatingFileHandler" for handler "FILE"
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:119)
at org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:338)
at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:291)
at org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:300)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:542)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:300)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:262)
at java.util.logging.LogManager$2.run(LogManager.java:312)
at java.util.logging.LogManager$2.run(LogManager.java:310)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:310)
at java.util.logging.LogManager.getLogManager(LogManager.java:292)
at java.util.logging.Logger.<init>(Logger.java:264)
at java.util.logging.Logger.<init>(Logger.java:260)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1430)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1428)
at java.util.logging.LogManager$1.run(LogManager.java:196)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(LogManager.java:173)
at org.jboss.modules.Main.main(Main.java:443)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:117)
... 20 more
Caused by: java.io.FileNotFoundException: C:\Program Files\wildfly-8.2.0.Final\standalone\log\server.log (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:154)
at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:105)
at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:192)
at org.jboss.logmanager.handlers.FileHandler.<init>(FileHandler.java:122)
at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.<init>(PeriodicRotatingFileHandler.java:73)
... 25 more
14:17:42,875 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
14:17:42,884 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
14:17:42,859 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:17:42,882 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
14:17:42,895 INFO [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 4.0.6.Final
14:17:42,906 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
14:17:42,919 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
14:17:42,935 INFO [org.jboss.as.connector.logging] (MSC service thread 1-1) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
14:17:42,938 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
14:17:42,941 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
14:17:42,953 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010417: Started Driver service with driver-name = h2
14:17:42,960 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.21.Final
14:17:42,967 INFO [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service
14:17:42,970 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:17:43,040 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017502: Undertow 1.1.0.Final starting
14:17:43,040 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
14:17:43,489 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path C:\Program Files\wildfly-8.2.0.Final/welcome-content
14:17:43,497 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017525: Started server default-server.
14:17:43,520 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017531: Host default-host starting
14:17:43,672 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080
14:17:43,719 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\tazi0514\projects\nfv\r2\wildfly\deployments
14:17:43,808 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
14:17:43,994 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
14:17:44,114 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
14:17:44,115 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
14:17:44,116 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 3294ms - Started 184 of 234 services (82 services are lazy, passive or on-demand)
As you can see in the log above first WildFly tries writing to C:\Program Files\wildfly-8.2.0.Final\standalone\log\server.log
even though there is another directory pointed out in the command line as a server base directory. Having failed to write there because of lack of permissions WildFly goes on starting a server normally.
Is there a way to make WildFly not to try writing a log in a default server base directory?
解决方案 It seems like WildFly ignores a value of jboss.server.base.dir
property. But it still takes into account a value of JBOSS_BASE_DIR
environment variable. So I've just made the following alias in BASH to have a short way to start WildFly:
alias wildfly_start='JBOSS_BASE_DIR="$(realpath ~/wildfly)" /bin/bash -c "/cygdrive/c/Program\ Files/wildfly-8.2.0.Final/bin/standalone.sh -c standalone.xml"'
In my case a user home directory in cygwin coincides with a Windows user home directory.
这篇关于在具有有限权限的用户下启动WildFly 8.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!