jboss-as-maven-plugin can't deploy to remote JBoss AS7?

25,808

Solution 1

It is definitely not a security issue.

The plugin you are referring uses the JBoss AS7 ability to deploy applications using the Server Deployment Manager (this is new feature in AS7). Previously the deployment was only possible via JMX console, which required the deployment artifact to be reachable by server (local file or URL).

You need to make sure:

  • 192.168.1.104 is running JBoss AS7 with Server Deployment Manager listening on port 9999.
  • The port should not be bound to localhost iface (not 127.0.0.0:9999 but *:9999).
  • There is no firewall between you and 192.168.1.104 rejecting packets to port 9999.

Solution 2

what worked for me was to change from jboss-as plugin to wildfly plugin:

 <plugin>
   <groupId>org.wildfly.plugins</groupId>
   <artifactId>wildfly-maven-plugin</artifactId>
   <version>1.1.0.Alpha8</version>
 </plugin>

and then using the maven command:

mvn wildfly:deploy

reference: https://issues.jboss.org/browse/WFLY-3684

Solution 3

Remote deployment definitely works.

  1. Be sure that management port (native) is bound to *.9999, as mentioned above .

    <socket-binding name="management-native" interface="management" port="${*:9999}"/>
    
  2. Be sure that you added user to management realm. Also, I noticed that password was cached the first time I ran plugin, so later on it keep using stale password (from first run) instead of new one. I notice this using mvn -X option.

  3. I also turned off firewall on jboss server host machine. At least ports 8787, 4447, 8080, 9990 must be opened.

Here is complete plugin declaration

<plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.6.Final</version>
    <executions>
        <execution>
            <goals>
                <goal>deploy</goal>
            </goals>
            <phase>install</phase>
        </execution>
    </executions>
    <configuration>
        <force>true</force>
        <hostname>IP</hostname>
        <port>9999</port>
        <username>mvndeploy</username>
        <password>pa##word1.</password>
        <filename>${project.build.finalName}</filename>
    </configuration>
</plugin>

Test everyting with :

mvn package jboss-as:deploy

Solution 4

For me it worked when configuring the plugin with the hostname parameter "127.0.0.1" as the server seems to bind to that IP by default:

        <plugin>
            <groupId>org.jboss.as.plugins</groupId>
            <artifactId>jboss-as-maven-plugin</artifactId>
            <version>7.3.Final</version>
                <configuration>
                  <hostname>127.0.0.1</hostname>
                </configuration>
        </plugin>
    </plugins>
</build>

Solution 5

I solved this problem, using the last version of plugin:

<plugin>
  <groupId>org.jboss.as.plugins</groupId>
  <artifactId>jboss-as-maven-plugin</artifactId>
  <version>7.5.Final</version>
</plugin>
Share:
25,808
Junv
Author by

Junv

A full stack developer who likes Java, JavaScript and Ruby on Rails.

Updated on April 09, 2020

Comments

  • Junv
    Junv about 4 years

    I've tried for days to use jboss-as-maven-plugin to deploy web projects to remote JBoss AS7, but it didn't work.

    Here is my pom.xml:

    <!-- JBoss Application Server -->
    <plugin>
        <groupId>org.jboss.as.plugins</groupId>
        <artifactId>jboss-as-maven-plugin</artifactId>
        <version>7.1.0.CR1b</version>
        <executions>
            <execution>
                <phase>install</phase>
                <goals>
                    <goal>deploy</goal>
                </goals>
                <!-- Only remote server needs -->
                <configuration>
                    <hostname>192.168.1.104</hostname>
                    <port>9999</port>
                    <username>admin</username>
                    <password>admin123</password>
                </configuration>
            </execution>    
        </executions>
    </plugin>
    

    Using this configuration I can deploy to localhost without <configuration>, even no <username> and <password>.

    To deploy to my real IP address, I modified ${JBOSS_HOME}/configuration/standlone.xml, by changing jboss.bind.address from 127.0.0.1 to 0.0.0.0 (to unbind JBoss address), so I can deploy projects by using:

    <configuration>
        <!-- 192.168.1.106 is my ip -->
        <hostname>192.168.1.06</hostname>
        <port>9999</port>
    </configuration>
    

    It works too, but by changing <hostname> to point to my other computer (in the same router) it doesn't work but that computer receives a request, and the request is cut by something. (I thought it may be JBoss)

    The error message in Maven console is as follows:

     INFO: JBoss Remoting version 3.2.0.CR8
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 30.572s
    [INFO] Finished at: Fri Feb 10 23:41:25 CST 2012
    [INFO] Final Memory: 18M/170M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.1.0.
    CR1b:deploy (default) on project MessagePushX-RELEASE: Could not execute goal de
    ploy on MessagePush.war. Reason: java.net.ConnectException: JBAS012144: Could no
    t connect to remote://192.168.1.104:9999. The connection timed out -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    ch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    

    Who can tell me is JBoss as 7.1.0 is not allowed remote deploy?

    For some security issues?

  • Junv
    Junv over 12 years
    Tank you,finally I found something solved my problem.Jboss AS 7 use JMX to deploy application.So we should open ${JBOSS_HOME}/standalone/configuration/standalone.xml ,and locate this <subsystem xmlns="urn:jboss:domain:jmx:1.1"> and add <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server"/> in it.It can make jboss-as-maven-plugin works.
  • LegionDev
    LegionDev over 8 years
    solution in the comment above didn't work for me, just got parse errors when adding it to my standalone.xml
  • Adrian
    Adrian over 7 years
    with the actual version
  • sarath
    sarath over 4 years
    Actually this is the solution