3 Replies Latest reply on Jul 27, 2009 11:07 AM by peterj

    Need to hot deploy static content from WAR file

      I have my project configured and deployed in eclipse + JBoss 5.1.0.GA. Everything looks good. The problem is every time I make a static content change I have to deploy the WAR file which restarts the project. This takes too much time for such a small change.

      I have been researching this issue on google for hours and have come up with some vague ideas but nothing solid.

      Currently I am using the default instance of JBoss AS. When I do a hot deploy to the default/deploy directory it moves the WAR file into default/tmp/{someRandomHexValue}/mywar.war

      It seems like I could use the FileSync plugin for eclipse if the war deployment directory didn't change every deployment.

      Thanks for your help.

        • 1. Re: Need to hot deploy static content from WAR file
          peterj

          See this: http://www.jboss.org/community/wiki/ExplodedDeployment. With an exploded deployment you can change static content without having to redeploy.

          It sounds like you are not using the JBoss Tools Eclipse plugin because it does exploded deployment.

          • 2. Re: Need to hot deploy static content from WAR file

            Thanks for the direction. I have worked on it for quite a few more hours with still little luck. I looked at that Exploded Deployment page and it seems so simple but doesn't really have clearly defined steps.

            I also tried to install JBoss tools about 10 times - each getting some dependency error. I installed about 4 other different projects to resolve the dependencies but still couldn't get JBoss Tools to install.

            Is there perhaps a step by step guide to getting exploded deployment to work?

            I tried copying the war directory out of the temp folders into the deploy folder similar to the jmx-console.war folder but now I get an exception at deployment:

            Unable to register deployment mbean jboss.web.deployment:war=/myapp
            javax.management.InstanceAlreadyExistsException: jboss.deployment:id="jboss.web.deployment:war=/myapp",type=Component already registered.

            Here is my deployment descriptor. I don't know if I need to make changes to that as well:

            <?xml version="1.0" encoding="UTF-8"?>
            <application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
             <display-name>myapp</display-name>
             <module id="WebModule_1247710630169">
             <web>
             <web-uri>myapp.war</web-uri>
             <context-root>/myapp</context-root>
             </web>
             </module>
            </application>
            


            • 3. Re: Need to hot deploy static content from WAR file
              peterj

               

              I looked at that Exploded Deployment page and it seems so simple but doesn't really have clearly defined steps.


              You'll find that 99% if the wiki pages assume you are doing things manually, only the JBoss Tools-related wiki pages or docs will have Eclipse-related directions. In general, I never let Eclipse compile, package or build anything - I delegate that to either Ant or Maven (depending on my mood). And even in Ant I follow the Maven steps - gather all files to place into the WAR into a single directory, and the jar that directory. Then I can easily deploy the WAR file, or the corresponding directory by using Ant's copy task.

              I also tried to install JBoss tools about 10 times - each getting some dependency error


              If you downloaded Eclipse for Java EE Developers, then for JBoss Tools you can select everything except the BIRT tools. Then there should be no missing dependencies. (I haven't had a need for BIRT and so haven't bothered to figure out how to get it installed.) Also, you probably don't need all of the tools. Usually selecting just JBossAS Tools, and then optionally tools for technologies yoiu are using (HIbernate Tools, JBoss Tools RichFaces, SEam Tools, etc) is all you really need.

              I tried copying the war directory out of the temp folders into the deploy folder


              Don't do that. Instead take your WAR file and unpack it. What I usually do is rename xxx.war to xxx.war.zip and then use the Extract capability on the file manager to extract the contents to the xxx.war directory. Then I copy the xxx.war directory to server/xxx/deploy.