1 2 Previous Next 25 Replies Latest reply on Sep 25, 2013 5:34 PM by apanag

    How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?

    connie.yang

      Hi,

       

      I'm trying to use jboss-as maven plugin to deploy a WAR to a JBoss AS 7.1.1.Final standalone server running on a remote endpoint (rather than localhost).  I've tried using the following command with no success (see exception below).  It seems that it tries to connect to localhost even though hostname parametner is used.

       

           mvn jboss-as:deploy -Dhostname=my-remote-host-name

       

      [INFO] ------------------------------------------------------------------------

      [INFO] BUILD FAILURE

      [INFO] ------------------------------------------------------------------------

      [INFO] Total time: 23.449s

      [INFO] Finished at: Tue Oct 30 17:55:14 PDT 2012

      [INFO] Final Memory: 13M/128M

      [INFO] ------------------------------------------------------------------------

      [ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.3.Final:deploy (default-cli) on project mds-parent: Could not execute goal deploy on /Users/cyang/projects/AST-409-CY/mds-parent/target/mds-parent-1.0.0-SNAPSHOT.maven-project. Reason: Error could not execute operation '{

      [ERROR] "address" => [],

      [ERROR] "operation" => "read-attribute",

      [ERROR] "name" => "launch-type"

      [ERROR] }'. java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out

      [ERROR] -> [Help 1]

       

      Thanks for the help!

      Connie

        • 1. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
          maderhan

          Hi,

           

          if you are deploying to a remote host you have to specify the hostname!

          Your error look like that you try to deploy on localhost "Could not connect to remote://localhost:9999".

          • 2. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
            connie.yang

            Yes, I did use -Dhostname in my mvn command

             

                 mvn jboss-as:deploy -Dhostname=my-remote-host-name

             

            And yet, the plugin tries to deploy to localhost.  What am I missing?

            • 3. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
              nickarls

              Hmm, tried -Dhostname=foo -Djboss-as.hostname=foo and -Djboss-as.jboss-as.hostname=foo but it still hit localhost. The code says

               

              @Parameter(defaultValue = "localhost", property = "jboss-as.hostname")

               

              so I thought it would "just work". Perhaps Jamez P can shed some light on the issue when he wakes up. You could of course try a plugin configure in pom.xml as a workaround.

              • 4. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                connie.yang

                Thanks for the reply.  Do you have an example of the configuration usage?  This is what I have in my pom,

                 

                        <plugin>

                                <groupId>org.jboss.as.plugins</groupId>

                                <artifactId>jboss-as-maven-plugin</artifactId>

                                <version>7.3.Final</version>

                                <executions>

                                    <execution>

                                        <phase>install</phase>

                                        <goals>

                                            <goal>deploy</goal>

                                        </goals>

                                    </execution>

                                </executions>

                            </plugin>

                • 5. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                  nickarls

                  Try

                       <configuration>
                           
                  <hostname>thehost</hostname>
                           
                  <port>9999</port>
                            <username>user</username>
                            <password>password</password>
                       </configuration>

                   

                  in the execution

                  • 6. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                    jamezp

                    Using -Djboss-as.hostname=foo seems to work for me. At least on Linux and OS X it does.

                     

                     

                    mvn jboss-as:deploy -Djboss-as.hostname=foo
                    ...
                    [ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.3.Final:deploy (default-cli) on project jboss-as-helloworld: Could not execute goal deploy on /home/jperkins/projects/jboss/jdf/quickstart/helloworld/target/jboss-as-helloworld.war. 
                    Reason: Host name 'foo' is invalid. Unknown host foo -> [Help 1]
                    

                     

                    --

                    James R. Perkins

                    • 7. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                      connie.yang

                      Thanks.

                       

                      I got through that point, but came across another problem...

                       

                      Deployment seems to hang with the following messages and I eventually have to quit it.

                       

                      [INFO] >>> jboss-as-maven-plugin:7.3.Final:deploy (default-cli) @ mds-parent >>>

                      [INFO]

                      [INFO] >>> maven-source-plugin:2.2:jar (attach-sources) @ mds-parent >>>

                      [INFO]

                      [INFO] <<< maven-source-plugin:2.2:jar (attach-sources) @ mds-parent <<<

                      [INFO]

                      [INFO] --- maven-source-plugin:2.2:jar (attach-sources) @ mds-parent ---

                      [INFO]

                      [INFO] <<< jboss-as-maven-plugin:7.3.Final:deploy (default-cli) @ mds-parent <<<

                      [INFO]

                      [INFO] --- jboss-as-maven-plugin:7.3.Final:deploy (default-cli) @ mds-parent ---

                      Oct 31, 2012 10:57:18 AM org.xnio.Xnio <clinit>

                      INFO: XNIO Version 3.0.7.GA

                      Oct 31, 2012 10:57:18 AM org.xnio.nio.NioXnio <clinit>

                      INFO: XNIO NIO Implementation Version 3.0.7.GA

                      Oct 31, 2012 10:57:18 AM org.jboss.remoting3.EndpointImpl <clinit>

                      INFO: JBoss Remoting version 3.2.12.GA

                      Authenticating against security realm: ManagementRealm

                      • 8. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                        nickarls

                        Did you use the add-user script for adding a user to be used in deployment?

                        • 9. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                          connie.yang

                          Yes, I did.  I created a management user using the add-user when I brought up the admin console.

                           

                          Here's the mvn command I use

                           

                          mvn jboss-as:deploy -Djboss-as.hostname=<my-remote-host-name> -Djboss-as.username=<my-management-realm-user> -Djboss-as.password=<my-management-realm-password> -Djboss-as.deployment.filename=<my-war>

                           

                          Also, another interesting behavior I see is that the plugin assumes the war file sits under the target folder of the maven project that the plugin definition exists.  In my case, since I have all my dependencies and build plugins defined in a master/parent pom, the plugin expects to find the war there and it can't find the war file because the only thing I have where my parent pom reside is the the pom itself.  Is there  a way to work around this?

                           

                          Thanks,

                          Connie

                          • 10. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                            nickarls

                            Must be an old issue since I didn't see those @Parameter annotations on the source for the 7.1.1 AbstractServerConnection

                            • 11. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                              nickarls

                              Wonder if this can be applied?

                               

                              /**

                                   * The target directory the application to be deployed is located.

                                   */

                                  @Parameter(defaultValue = "${project.build.directory}/", property = "jboss-as.deployment.targetDir")

                                  private File targetDir;


                              • 12. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                                jamezp

                                As Nicklas suggests you can use the jboss-as.deployment.targetDir property as well. Another option is to define the plugin in both POM's and have it skip the parent POM.

                                 

                                Parent POM definition:

                                 

                                <plugin>
                                    <groupId>org.jboss.as.plugins</groupId>
                                    <artifactId>jboss-as-maven-plugin</artifactId>
                                    <version>${version.org.jboss.as.plugins.maven.plugin}</version>
                                    <configuration>
                                        <skip>true</skip>
                                    </configuration>
                                </plugin>
                                

                                 

                                 

                                WAR POM definition:

                                 

                                <plugin>
                                    <groupId>org.jboss.as.plugins</groupId>
                                    <artifactId>jboss-as-maven-plugin</artifactId>
                                    <version>${version.org.jboss.as.plugins.maven.plugin}</version>
                                    <configuration>
                                        <filename>jboss-as-ejb-in-ear.ear</filename>
                                        <skip>false</skip>
                                    </configuration>
                                </plugin>
                                
                                

                                 

                                --

                                James R. Perkins

                                • 13. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                                  connie.yang

                                  Thank Nicholas and James for your replies.  I will give those maven configuration a try.  What you suggested makes sense.

                                   

                                  WRT jboss-as.deployment.targetDir, is it a URL or a relative path?


                                  Also, do you any suggestion to the appear-to-be hanging war deployment to a remote endpoint?  The deployment was successful in the end even though it appears to be "hanging" from the CLI.

                                  • 14. Re: How to deploy a WAR to AS 7.1.1-Final running on a remote endpoint?
                                    jamezp

                                    We had an issue with a hang deploying from 7.2.Final to upstream versions of JBoss AS and JBoss EAP, but I haven't seen any issues with 7.3.Final. I'll give it a shot though and see what happens.

                                     

                                    --

                                    James R. Perkins

                                    1 2 Previous Next