wildfly-maven-plugin deployment over SSL works onc

2019-08-22 17:35发布

问题:

I'm getting a weird behavior after securing Wildfly Admin console to use HTTPS, and configuring my pom.xml to deploy over https. (I tried on versions 8.2.1 and 10.1.0, standalone mode).

I can only (re)deploy once successfully. After that, I get the error below, and I have to restart the server to (re)deploy again:

Change in pom.xml:

    <plugin>
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin</artifactId>
        <version>1.0.2.Final</version>  
        <configuration>
            <protocol>https-remoting</protocol>
            <port>9993</port> 
        </configuration>        
    </plugin>

In my standalone-full-ha.xml, I added the server-identities and edited the socket-binding

    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <server-identities>
                    <ssl>
                        <keystore path="server-keystore.jks" relative-to="jboss.server.config.dir" keystore-password="mypassword"/>
                    </ssl>
                </server-identities>
...
        <management-interfaces>
            <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
                <socket-binding http="management-http" https="management-https"/>
            </http-interface>
        </management-interfaces>

I added the truststore, prior to executing mvn:

> set MAVEN_OPTS=-Djavax.net.ssl.trustStore=C:/pathto/client-truststore -Djavax.net.ssl.trustStorePassword=mypassword

The connection is timing out on succeeding executions. Here's the error:

    > mvn wildfly:deploy -e (OR mvn wildfly:redeploy -e)  

    [INFO] BUILD FAILURE
    ...
    [ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:redeploy (default-cli) on project xyz-project-web: Could not execute goal redeploy on C:\projects\abc\xyz-project\trunk\xyz-project-web\target\xyz-project-web-0-SNAPSHOT.war. Reason: I/O Error could not execute operation '{
    [ERROR] "operation" => "read-attribute",
    [ERROR] "address" => [],
    [ERROR] "name" => "launch-type"
    [ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to https-remoting://172.31.100.26:9993. 
The connection timed out
    [ERROR] -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:redeploy (default-cli) 
    on project xyz-project-web: Could not execute goal redeploy on C:\projects\abc\xyz-project\trunk\xyz-project-web\target\xyz-project-web-0-SNAPSHOT.war. Reason: I/O
    Error could not execute operation '{
        "operation" => "read-attribute",
        "address" => [],
        "name" => "launch-type"
    }'
    ...
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Could not execute goal redeploy on C:\projects\abc\xyz-project\trunk\xyz-project-web\target\
    test-project-web-0-SNAPSHOT.war. Reason: I/O Error could not execute operation '{
        "operation" => "read-attribute",
        "address" => [],
        "name" => "launch-type"
    }'
    ...
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
            ... 20 more
    Caused by: java.lang.IllegalStateException: I/O Error could not execute operation '{
        "operation" => "read-attribute",
        "address" => [],
        "name" => "launch-type"
    }'
    ...
            at org.wildfly.plugin.deployment.AbstractDeployment.doExecute(AbstractDeployment.java:136)
            ... 24 more
    Caused by: java.io.IOException: java.net.ConnectException: JBAS012144: Could not connect to https-remoting://172.31.100.26:9993. The connection timed out
            at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:129)
            ... 28 more
    Caused by: java.net.ConnectException: JBAS012144: Could not connect to https-remoting://172.31.100.26:9993. The connection timed out
            at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:119)
    ...
            at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:127)
            ... 30 more

I can't find anything relevant changing after the first execution.

回答1:

It looks like a bug in the older version. I upgraded to wildfly-maven-plugin 1.2.1.Final, and it works fine now.