6 Replies Latest reply on Sep 29, 2011 11:02 AM by Konrad Wolski

    JBoss AS7 webapp development

    Konrad Wolski Newbie

      Hi,

       

      Our team wants to switch to JBoss 7 as a development platform on a regular day to day basis. Currenly we use Tomcat 7. We want to use JBoss Tools and have tested current development version.

       

      Is there an article explaining how incremental publishing works ?

       

      We want to achive same setup as with Tomcat 7 wtp server adapter, that is:

      1) automatic redeployment of application when a dynamic resource changes (like a Java class)

      2) no redeployment when a static resource changes (only refresh)

       

      From what we see in default configuration (exploded webapp) static resources are refreshed but dynamic resources do not trigger automatic redeployment. Is there something we are missing or the community server adapter doesn't support this feature ?

       

      I am aware that scanning of exploded application can be enabled but we want to avoid it so static resource changes do not trigger full redeployment.

       

      ---

       

      Second concern is that we are building our projects using maven multimodule functionality. When the tools are switched to deploy archives (war is the target here) automatic redeployment doesn't happen when a dependency in WEB-INF/lib changes. We created two simple projects:

      a) one named 'dep1' (Java Project)

      b) second named 'webapp' (Dynamic Web Project) with the 'dep1' set in "Deployment assembly" project properties

       

      The dependency is placed in WEB-INF/lib/dep1.jar. When we recompile a class that is in "webapp" project the whole application gets redeployed (cool), but when a class from 'dep1' is recompiled the application isn't redeployed. We are yet again forced to do manual deployment like in the first problem.

       

      In a way those two are problems are connected. We don't use any JBoss 7 specific functionallity yet. These are simple web applications (no ear, osgi, etc).

       

      Thanks,

      Konrad

        • 1. Re: JBoss AS7 webapp development
          Max Rydahl Andersen Master

          konrad,

           

          Our AS 7 adapter is still evolving so your input is appreciated.

           

          To explain why AS7 adapter works like it does right now then 99% of the logic is based of how the previous jboss adapters worked and here we did explicitly decided not to trigger redeploys of applications on class changes because of two things:

           

          1) restart the app could be a rather heavy operation in previous AS versions

           

          2) if you are editing/saving multiple class files you would trigger multiple restarts for no real good reason.

           

          3) when you restart you loose the session context thus making live debugging almost impossible.

           

          #1 is not relevant anymore, but 2 & 3 still is but im open for suggestions

           

          ...so back to your questions:

           

          Concern 1:

          We deploy archives content exploded by default and then its up to the runtime frameworks to pick up changes (thats what you see happen when (x)html resources are picked up - thats us just copying over incrementally and then its jboss web and jsf fwk that picks up the changes).

           

          You can (since JBoss Tools M2 I believe) right click on a module to trigger a restart.

           

          That gives a pretty nice balance IMO, but i'm sure you are about to give me examples of where its not - let me know

           

          Concern 2:

          If I understand you correctly here then you want all deployments that have a transitive dependency to a project to repackage.

           

          I can see the usecase for that but haven't seen other adapters do this. Are you saying Tomcat 7 adapter does that ?

           

          p.s. Rob that works on the incremental deployment aspect adapter is on PTO at the moment - but i'll answer/find what I can

          • 2. Re: JBoss AS7 webapp development
            Konrad Wolski Newbie

            I wanted to attach a file with the projects to this post so everyone can check the "concern 2" but I can't see this functionallity in this portal.

            Thanks for answering our questions.

            We will continue our development on Tomcat 7 for now. JBoss 7 will probably be our production server.

             

            I can live with full application restarts because the application is written well and it start pretty quick. I would go for JRebel otherwise. We have some applications written in Vaadin framework, this almost only has Java code so you can see the point that incremetal deployment doesn't help here.

            • 3. Re: JBoss AS7 webapp development
              Max Rydahl Andersen Master

              Konrad, if you use the "advanced editor" when replying there is a "Choose file" option available.

               

              About your usecase I want to go investigate what Tomcat server adapter actually do - if they force restart on every *.class change or something more/less specific.

               

              I believe we can quite easily add option for full module restart if some regular expression matches on a file which could help you ?

               

              btw. could you let me know if tomcat 7 adapter actually redeploys module on updates to transitive project dependencies ? (I don't see it happening so just wondering if I've configured/looked somewhere wrong)

               

              ...and please lets help you actually do development on your production server target

              • 4. Re: JBoss AS7 webapp development
                Konrad Wolski Newbie

                Hi Max,

                 

                For what I know Eclipse doesn't support nested dependencies. I've done it with maven support but this simply adds a list of projects / jars into "Deployment Assembly" of the webapp. This way Tomcat adapter restarts when a deep dependency changes, say webapp -> dep1 -> dep2, when something inside dep2 changes the application is restarted. The restart feature can be controlled per application in Server Properties and then Modules tab -> "Auto reload" column. When the restart is disabled then it works just like "Incremental publish" in JBoss exploded application.

                 

                The regular expression thing would be what I'm looking for. It would trigger automatic restart on content change. With exploded application content if that is possible.

                 

                Thanks for following up,

                Konrad

                • 5. Re: JBoss AS7 webapp development
                  Max Rydahl Andersen Master

                   

                   

                  For what I know Eclipse doesn't support nested dependencies.

                   

                  That's how I see it too yes.

                   

                  I've done it with maven support but this simply adds a list of projects / jars into "Deployment Assembly" of the webapp.

                   

                  Yes - so same configuration as if you just used plain eclipse/WTP for it.

                   

                  This way Tomcat adapter restarts when a deep dependency changes, say webapp -> dep1 -> dep2, when something inside dep2 changes the application is restarted.

                   

                  I'm confused - now you are saying that Eclipse supports nested dependencies and trigger restart ? (note: might possibly be tomcat adapter specific)

                   

                   

                  The restart feature can be controlled per application in Server Properties and then Modules tab -> "Auto reload" column. When the restart is disabled then it works just like "Incremental publish" in JBoss exploded application.

                   

                  I assume "Auto reload" and "restart" mean the same thing here ?

                   

                  The regular expression thing would be what I'm looking for. It would trigger automatic restart on content change. With exploded application content if that is possible.

                  It would only be for exploded content since everytime a full archive is updated JBoss would redeploy on its own.

                  • 6. Re: JBoss AS7 webapp development
                    Konrad Wolski Newbie

                    I'm just saying that webapp has two dependencies configured named "dep1" and "dep2" by m2e into "Deployment Assembly" based on projects in the workspace. When I change anything inside dep1 or dep2 the application is restarted. The dep2 is added to webapp because dep1 depends on it.

                     

                    I attached the sample projects.

                     

                    > I assume "Auto reload" and "restart" mean the same thing here.

                     

                    Yes. That's how I see it.