JBoss EAP 7 java.lang.IllegalArgumentException通过Gradle脚本配置JBoss EAP 7数据源时出现问题

时间:2018-12-20 17:01:09

标签: java gradle jboss jboss-eap-7

在Ansible设置JBoss EAP之后,我很难过配置它。

添加数据源gradle任务失败,并出现java.lang.IllegalArgumentException。该脚本适用于其他环境,但是我已经花了几天的时间才能弄清楚我们出了什么问题。

下面是gradle任务:

    // Adds data source config to JBoss EAP 7

    def addDatasourcesSingleStack(def config, def hostName, def serverName, def mySQLURL) {
        def username = getMysqlDatasourceUsername();
        def password = getMysqlDatasourcePassword();

//This is the command failing
executeCliCommandHostSingleStack("""/profile=${config.server_profile_single_stack_name}/subsystem=datasources/data-source=MySqlDS:add(
            jndi-name=${config.mysql_jndi_name},
            connection-url=\"${mySQLURL}\",
            driver-name=com.mysql,
            user-name=${username},
            password=${password},
            transaction-isolation=TRANSACTION_READ_COMMITTED,
            min-pool-size=10,
            max-pool-size=${config.mysql_max_connections},
            pool-prefill=true,
            prepared-statements-cache-size=32,
            share-prepared-statements=true,
            valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker,
            validate-on-match=true,
            background-validation=false,
            exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter,
            statistics-enabled=true)""".stripIndent());
        executeCliCommandHostSingleStack("/profile=${config.server_profile_single_stack_name}/subsystem=datasources/data-source=MySqlDS:enable");   
    }

执行上述操作时产生的错误消息如下:

Caused by: java.lang.RuntimeException: Error Occurred Creating Server Group in 1-1. Run 'remove-server-group' command to remove incomplete group, and then r
un 'create-server-group' again
        at build_aant4k1fpdt1r8vajv7zpx6zd$_run_closure11.doCall(C:\Users\IN_XXXX\releases\release-1.0\build.gradle:3111)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:558)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:539)
        at org.gradle.api.internal.tasks.TaskMutator$1.execute(TaskMutator.java:77)
        at org.gradle.api.internal.tasks.TaskMutator$1.execute(TaskMutator.java:73)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 46 more
Caused by: java.lang.IllegalArgumentException: Command '/profile=dms-server-profile-single-stack/subsystem=datasources/data-source=MySqlDS:add(
                jndi-name=java:/jdbc/dms,
                connection-url="jdbc:mysql://host1:3306/dms_db?socketTimeout=60000",
                driver-name=com.mysql,
                user-name=dms_app,
                password=xxxxxxxxx,
                transaction-isolation=TRANSACTION_READ_COMMITTED,
                min-pool-size=10,
                max-pool-size=200,
                pool-prefill=true,
                prepared-statements-cache-size=32,
                share-prepared-statements=true,
                valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker,
                validate-on-match=true,
                background-validation=false,
                exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter,
                statistics-enabled=true)' is invalid. {
    "outcome" => "failed",
    "result" => undefined,
    "failure-description" => {"WFLYDC0074: Operation failed or was rolled back on all servers. Server failures:" => {"server-group" => {"dms-server-group-single
-stack" => {"host" => {"host1" => {"dms-server-instance-single-stack" => {"WFLYCTL0288: One or more services were unable to start due t
o one or more indirect dependencies not being available." => {
        "Services that were unable to start:" => ["org.wildfly.data-source.MySqlDS"],
        "Services that may be the cause:" => ["org.wildfly.network.interface.public"]
    }}}}}}}},
    "rolled-back" => true,
    "server-groups" => {"ams-server-group-single-stack" => {"host" => {"host1" => {"dms-server-instance-single-stack" => {"response" =>
 {
        "outcome" => "failed",
        "failure-description" => {"WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => {
            "Services that were unable to start:" => ["org.wildfly.data-source.MySqlDS"],
            "Services that may be the cause:" => ["org.wildfly.network.interface.public"]
        }},
        "rolled-back" => true,
        "response-headers" => {"process-state" => "reload-required"}
    }}}}}}
}

当我尝试通过JBoss管理控制台手动添加数据源时,出现以下错误:

无法创建JDBC连接。 发生了内部错误。 详细信息

意外的HTTP响应:500

Request
{
    "address" => [],
    "operation" => "composite",
    "steps" => [{
        "operation" => "test-connection-in-pool",
        "address" => [
            ("host" => "host1"),
            ("server" => "dms-server-instance-single-stack"),
            ("subsystem" => "datasources"),
            ("data-source" => "MySqlDS")
        ]
    }]
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "result" => {"step-1" => {
        "outcome" => "failed",
        "result" => undefined,
        "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: java:/jdbc/dms",
        "response-headers" => {"process-state" => "reload-required"},
        "rolled-back" => true
    }},
    "failure-description" => {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: java:/jdbc/dms"}},
    "rolled-back" => true
} 

任何帮助,评论和参考将不胜感激。

谢谢。

1 个答案:

答案 0 :(得分:0)

您可以检查两件事:

  1. 检查是否启用了数据源。

  2. 在主机配置中配置了
  3. 检查公共不安全接口。