Wildfly 服务器在非 windows 环境中失败并出现错误 WFLYCTL0017 && WFLYCTL0013

Wildfly Server is failing in non windows environment and with error WFLYCTL0017 && WFLYCTL0013

我正在使用 ProcessBuilder(JAVA) 将一些命令传递给 standalone.sh。 当我 运行 在 windows 环境中使用 standalone.bat 使用相同的参数时,只需要注意路径就可以 运行 in Windows.

但是当我用 mac 或 RedHat Linux 尝试相同的代码时,它失败了。

而且我无法在日志文件中看到它,因为它在启动服务器之前就失败了。

我试过比较 windows 和 MAC 中的 standalone.xml 两者是相同的。

对于 Mac 它失败了


  JBOSS_HOME: /Applications/CA/10.5SQLSERVER/IdentityAccessManager

  JAVA: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/bin/java

  JAVA_OPTS:  -server -Diam.keystore.password=${VAULT::IAM::IAM_KEYSTORE_PASSWORD::1} -DIAM_HOME=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/ -Diam.db.password=${VAULT::IAM::IAM_DB_PASSWORD::1} -Diam.db.jdbc.driver.path=/Users/ajay/driveD/software/jars/sqljdbc4-4.0.jar -Diam.vault.enc.iteration.count=120 -Diam.db.vendor=mssql -Diam.vault.keystore.password.masked=MASK-7DscHYCAzRJgjgpBba72IwRGfBaq4CFF70uETVutVDX -Diam.truststore.password=${VAULT::IAM::IAM_TRUSTSTORE_PASSWORD::1} -Diam.db.url=jdbc:sqlserver://ibndev000608.bpc.broadcom.net:1433;databaseName=IAM105_VAULT -Diam.keystore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/webreckeys.ks -Diam.vault.keystore.salt=6zqH6N6p -Diam.truststore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/iam-truststore.ks -Diam.vault.enc.file.dir=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/vault/ -Diam.vault.keystore.alias=vault -Diam.vault.keystore.url=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/vault/vault.keystore -Diam.db.user=sa -Djboss.http.port=51112 -Djboss.https.port=51111 -Djboss.bind.address.management=0.0.0.0 -Djboss.bind.address=0.0.0.0 -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=iam-updater -Dkeycloak.migration.dir=../realms-to-import -Dkeycloak.migration.strategy=IGNORE_EXISTING -Diam.version=1.2.1-SNAPSHOT -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n

我得到的错误是 ./standalone.sh:第 311 行:-Diam.keystore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/webreckeys.ks:没有那个文件或目录

甚至 webreckeys.ks 这个文件已经到位并且所有权限都在那里。

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

Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32      use a 32-bit data model if available
    -d64      use a 64-bit data model if available
    -server   to select the "server" VM
                  The default VM is server,
                  because you are running on a server-class machine.


    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
./standalone.sh: line 311: -Diam.keystore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/webreckeys.ks: No such file or directory

对于windows,可以运行

 JBoss Bootstrap Environment

  JBOSS_HOME: "C:\PROGRA~1\CA\IAM_10_5\IDENTI~1"

  JAVA: "C:\Program Files\Java\jdk1.8.0_221\jre\bin\java"

  JAVA_OPTS: "-Dprogram.name=standalone.bat  -Diam.keystore.password=${VAULT::IAM::IAM_KEYSTORE_PASSWORD::1} -DIAM_HOME=C:\PROGRA~1\CA\IAM_10_5\IDENTI~1\ -Diam.db.password=${VAULT::IAM::IAM_DB_PASSWORD::1} -Diam.db.jdbc.driver.path=D:\setups.5\sqljdbc4-4.0.jar -Diam.vault.enc.iteration.count=120 -Diam.db.vendor=mssql -Diam.vault.keystore.password.masked=MASK-7DscHYCAzRJgjgpBba72IwRGfBaq4CFF70uETVutVDX -Diam.truststore.password=${VAULT::IAM::IAM_TRUSTSTORE_PASSWORD::1} -Diam.db.url=jdbc:sqlserver://ibndev000608.bpc.broadcom.net:1433;databaseName=LocalWindowsIAM10_5 -Diam.keystore=C:\PROGRA~1\CA\IAM_10_5\IDENTI~1\certs/webreckeys.ks -Diam.vault.keystore.salt=6zqH6N6p -Diam.truststore=C:\PROGRA~1\CA\IAM_10_5\IDENTI~1\certs/iam-truststore.ks -Diam.vault.enc.file.dir=C:\PROGRA~1\CA\IAM_10_5\IDENTI~1\vault/ -Diam.vault.keystore.alias=vault -Diam.vault.keystore.url=C:\PROGRA~1\CA\IAM_10_5\IDENTI~1\vault/vault.keystore -Diam.db.user=sa -Djboss.http.port=51112 -Djboss.https.port=51111 -Djboss.bind.address.management=0.0.0.0 -Djboss.bind.address=0.0.0.0 -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=iam-updater -Dkeycloak.migration.dir=../realms-to-import -Dkeycloak.migration.strategy=IGNORE_EXISTING -Diam.version=1.2.1-SNAPSHOT -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true"

启用日志记录级别为 DEBUG 后

我几乎看不到错误

2019-09-23 12:18:55,175 DEBUG [org.jboss.as.controller.management-operation] (main) WFLYCTL0017: Operation ("read-resource") failed - address: ([
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "mssql")
]) - failure description: "WFLYCTL0216: Management resource '[
    (\"subsystem\" => \"datasources\"),
    (\"jdbc-driver\" => \"mssql\")
]' not found"

另一个是

2019-09-17 17:06:00,607 ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Operation ("list-resource-loader-paths") failed - address: ([("core-service" => "module-loading")]) - failure description: "com.microsoft.sqlserver.jdbc"

这是 standalone.xml

中的子系统标签

<subsystem xmlns="urn:jboss:domain:datasources:5.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>${iam.db.url}</connection-url>
                    <driver>mssql</driver>
                    <pool>
                        <flush-strategy>IdleConnections</flush-strategy>
                    </pool>
                    <security>
                        <user-name>${iam.db.user}</user-name>
                        <password>${iam.db.password}</password>
                    </security>
                    <validation>
                        <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                        <background-validation>true</background-validation>
                        <background-validation-millis>60000</background-validation-millis>
                    </validation>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="mssql" module="com.microsoft.sqlserver.jdbc">
                        <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

其他文件如 truststore 怎么样,如果是这样,那么密钥库文件位置一定有问题,或者可能是它的名称。为了进行验证,您可以通过将密钥库文件放在 jboss-home 的位置并在 JAVA_OPTS 中提供该特定路径来检查您的密钥库文件,如果它有效,那么肯定是文件位置或文件路径有问题。使用“/”符号时也要小心。

我找到了答案,为什么它会失败并误导错误消息。

原因是 - Diam.db.url=jdbc:sqlserver://ibndev000608.bpc.broadcom.net:1433;databaseName=IAM105_VAULT

中的值-Diam.db.url是有分号的jdbc:sqlserver://ibndev000608.bpc.broadcom.net:1433;databaseName=IAM105_VAULT

分号后 databaseName=IAM105_VAULT

然后是 keystore 命令之后

-databaseName=IAM105_VAULT -Diam.keystore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/webreckeys.ks

所以变成了

databaseName=IAM105_VAULT -Diam.keystore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/webreckeys.ks

并且在 Linux 和 Mac 环境中,分号表示两个命令之间的分隔符。

我是如何解决问题的

我打开 standalone.sh 并放在第一行 set -x 这意味着跟踪 shell 脚本。

它显示了两个命令,所以我确定了 JDBC URL 并将其括在双引号 (" ")

-Diam.db.url="jdbc:sqlserver://ibndev000608.bpc.broadcom.net:1433;databaseName=IAM105_VAULT" -Diam.keystore=/Applications/CA/10.5SQLSERVER/IdentityAccessManager/certs/webreckeys.ks

这对我有用... 感谢大家的努力。