12 Replies Latest reply on Dec 22, 2006 4:07 PM by siddharthags

    Deploy a web application on JBoss

    inderjeet

      Hi All

      I need to deploy a web application on JBoss. I know that i can deploy a web application by putting my war file in defauly/deploy folder of Jboss server.
      But I would like to know that can't I deploly a web application by simply giving the path of my war file somewhere in Jboss, as we do in weblogic or websphere?
      e.g. My war file is placed in one folder and JBoss is installed in some other folder. And instead of copying my war file to jboss. i should be simply able to give the path of my war file in JBoss?

      Thanks & Regards
      Inder Jeet Singh

        • 1. Re: Deploy a web application on JBoss
          visolvejboss

          Hello,

          There are two methods.

          After doing the modifications as said in the links, you can either restart the server or can simply do it in the jmx console for hot deployment at the run time.

          Refer the following links.

          http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfiguringTheDeploymentScannerInConfjbossSystem.xml

          http://wiki.jboss.org/wiki/Wiki.jsp?page=ManageTheDeploymentScannerWithTheJMXConsole

          This might help you.

          • 2. Re: Deploy a web application on JBoss
            inderjeet

            Thanks for your reply.........
            I am able to deploy application on JBoss from some other folder.
            Now i tried suing it from some remote machine as per the format given in the jboss-service.xml
            But it does not work. I have given something like http://www.localhost:7070/mywar/test.war

            Can someone tell me how to resolve this problem?

            Thanks & Regards
            Inder Jeet Singh

            • 3. Re: Deploy a web application on JBoss
              peterj

              First, did you change the default port from 8080 to 7070?

              Second, if your war file is named test.war, then the uRL should be http://localhost:7070/test (assuming that you defined a welcome page in web.xml).

              • 4. Re: Deploy a web application on JBoss
                inderjeet

                Yes budy, I did change the port from 808 to 7070. And the URL i have mentioned is not the URL I am using to access my web application from browser.
                It is the URL mentioned in the jboss-service.xml file to access the application(WAR) contents from there, instead of putting my WAR in deploy/ folder.

                I am still stuck with my problem, Please help me out...

                Thanks & Regards
                Inder Jeet Singh

                • 5. Re: Deploy a web application on JBoss
                  peterj

                  The URL in jboss-service.xml is only valid if it is accessible. In other words, you need to have an HTTP server (which could be JBoss) on localhost with port 7070 open and be able to access the indicated context (mywar/test.war) through that server. Why? Because JBoss uses the URL specified as the location of the war file and will attempt to access (read) it from there. If you can't access it from a browser using that URL, JBoss cannot access it either.

                  You might, instead, want to use a file URL, such as file:/home/foo/test/test.war, so that JBoss can access the war file from the file system.

                  Also, look at the jboss.system:server=MainDeployer MBean. It has variations on the invoke operation which accept a URL or a file name. You can use the invoke methods to deploy applications, even exploded directories. You can invoke the operation either through
                  the jmx-console or twiddle. Be warned, though, that applications deployed this way are 'lost' when you restart the server and thus need to be redeployed (though if you use twiddle to do the deploy, you could always write a script to start the server, wait 20 or 30 seconds, and then deploy the apps through twiddle).

                  • 6. Re: Deploy a web application on JBoss
                    inderjeet

                    Thanks Peter

                    I understood your explanation partially....
                    Actually my exact requirement is to deploy an application on JBoos server which is on my machine and the WAR file or the exploded war file which is there on some other machine on my network.
                    Now How to achieve this? Please help me out.

                    Thanks & Regards
                    Inder Jeet Singh

                    • 7. Re: Deploy a web application on JBoss
                      kennychaffin

                      Inderjeet, I would suggest you not do that (run a web app from a different machine) because then you are relying on network communications which is just another potential problem. Just deploy the webapp on jboss normally.

                      KAC

                      • 8. Re: Deploy a web application on JBoss
                        peterj

                        I already gave you the means to deploy a war file (or exploded directory) from a network location: use the invoke method on the jboss.system:server=MainDeployer MBean. The URL you pass to this method, whether an http: url or a file: url, must be valid to access the war file (try it using a browser first). As long as the URL is valid, the war file should deploy.

                        But as kennychaffin wrote, deploying an application from across a network is not a good idea because you are just adding yet one more point of failure.

                        • 9. Re: Deploy a web application on JBoss
                          inderjeet

                          Thanks to all of those who helped me to solve my problem.
                          Peter, I tried to search method by the name of "Invoke", but there is no invoke method in the MainDeployer MBean.
                          As per kennychaffin and your, suggestion, i am not going for application across network, but I just wanted to see this working once. Therefore i tried to search for the invoke method but could not fined out. I found methods like addDeployer(), removeDeployer(), deploy(), getDeployment(), getWatchUrl(), isDeployed(), listDeployed() etc...

                          Thanks & Regards
                          Inder Jeet Singh

                          • 10. Re: Deploy a web application on JBoss
                            peterj

                            My mistake, I meant the deploy method.

                            • 11. Re: Deploy a web application on JBoss
                              inderjeet

                              No probs.....
                              Thanks Peter....:-)

                              • 12. Re: Deploy a web application on JBoss
                                siddharthags

                                inderjeet I am trying something similar but not something in a differnt folder but putting in the delply folder of the default server. The problem I am facing and trying tos ee if you can give me some pointers is if once you give http://localhost:port/myapp, I am getting redirected to https://localhost:8443/myapp and getting a failure on this as 8443 conector is not configured. how did you prevent things to be served from http and the port you wanted to?

                                TIA for any pointers