【问题标题】:Wildfly CLI "resolve-parameter-values" does not work as expectedWildfly CLI“解析参数值”无法按预期工作
【发布时间】:2017-06-07 11:59:28
【问题描述】:

我正在使用 JBoss EAP 7.0.5,我想在我的standalone-ha.xml 中使用内部配置值,例如:

<property name="javax.net.ssl.trustStore" value="${jboss.server.config.dir}/stores/trustCA.jks"/>

我使用疯狂的 maven 插件 1.2.0 Alpha 5 和 CLI 命令添加了这个值:

/system-property=javax.net.ssl.trustStore:add(value="${jboss.server.config.dir}/stores/trustCA.jks")

遗憾的是它没有按预期进行:

<property name="javax.net.ssl.trustStore" value="/stores/trustCA.jks"/>

jboss-cli.xml 如下所示:

<?xml version='1.0' encoding='UTF-8'?>

<!--
   WildFly Command-line Interface configuration.
-->
<jboss-cli xmlns="urn:jboss:cli:2.0">

    <default-protocol use-legacy-override="true">http-remoting</default-protocol>

    <!-- The default controller to connect to when 'connect' command is executed w/o arguments -->
    <default-controller>
        <protocol>http-remoting</protocol>
        <host>localhost</host>
        <port>9990</port>
    </default-controller>

    <!-- Example controller alias named 'Test'  
    <controllers>
        <controller name="Test">
            <protocol>http-remoting</protocol>
            <host>localhost</host>
            <port>9990</port>
        </controller>
    </controllers>
    -->    

    <validate-operation-requests>true</validate-operation-requests>

    <!-- Command and operation history log configuration -->
    <history>
        <enabled>true</enabled>
        <file-name>.jboss-cli-history</file-name>
        <file-dir>${user.home}</file-dir>
        <max-size>500</max-size>
    </history>

    <!-- whether to resolve system properties specified as command argument or operation parameter values
                  in the CLI VM before sending the operation requests to the controller -->
    <resolve-parameter-values>false</resolve-parameter-values>


    <!-- Whether to write info and error messages to the terminal output -->
    <silent>false</silent>

    <!-- Whether to filter out commands and attributes based on user's permissions -->
    <access-control>false</access-control>
</jboss-cli>

我也尝试过使用这样的变量,但它仍然得到解决:

${jboss.server.config.dir:}

我只是用错了还是可能是 CLI 或 maven 插件错误?

【问题讨论】:

    标签: maven jboss wildfly


    【解决方案1】:

    此行为不是由 Wildfly 本身引起的,可能是由 Maven Wildfly 插件引起的。此插件不调用命令行本机管理界面,因此它忽略 &lt;resolve-parameter-values&gt; 值。它使用 jboss 客户端 java api 并且似乎执行表达式评估 - 参见 CommandExecutor.java#executeCommands。如果您尝试通过 jboss-cli.sh 直接执行您的 cli 命令,它将按您的预期工作,即不会对变量进行插值。

    【讨论】:

    • 其实是Maven本身造成的。在 POM 中,Maven 将尝试解析 ${jboss.server.config.dir}。它应该在 CLI 脚本中工作,但它看起来像在 1.2.0 中引入了一个错误,issues.jboss.org/browse/WFMP-79
    • 用 1.2.0 Alpha6 检查过。现在它按预期工作了!
    【解决方案2】:

    这行得通:

    $${jboss.server.config.dir}
    

    有人可以发布一个链接到记录的地方吗? :)

    【讨论】:

      猜你喜欢
      • 2012-04-20
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 2013-11-07
      • 1970-01-01
      • 1970-01-01
      • 2018-05-09
      相关资源
      最近更新 更多