1 2 Previous Next 24 Replies Latest reply on Jun 27, 2007 12:40 PM by karol

    Hot redeployment

    Gavin King Master

      I've just committed a new feature to CVS that lets code changes made to Seam JavaBean components be visible immediately without a container restart.

      What you need to do is deploy the JavaBean component classes into the WEB-INF/dev directory, and run in debug mode with jboss-seam-debug.jar in WEB-INF/lib. Then any changes (or additions) to the classes in WEB-INF/dev will be immediately visible.

      It speeds up development quite a lot :-)

      To see this work, get the CVS version, and create a "war" project with seam-gen.

      Let me know what you think.

        • 1. Re: Hot redeployment
          Gavin King Master

          ie. this gives you the same development cycle for JavaBean components that we have today for facelets pages.

          • 2. Re: Hot redeployment
            Michael Yuan Novice

            Okay, I must admit that I am a bit lost here:

            What is the difference between WEB-INF/dev and WEB-INF/classes? What if the content of those two dirs go out of sync? I am guessing that in the "debug" mode, Seam only loads classes from WEB-INF/dev and ignores WEB-INF/classes? Am I way off here? :)

            In any case, this sounds really cool. Does this make developing in Seam POJO more appealing than developing in EJB3 beans? ;)

            • 3. Re: Hot redeployment
              adambrod Newbie

              Does this work in any web container? If so, this could be a huge boost to productivity. Right now if I change a class file I have to redeploy the webapp. Since Seam scans all the classes, Spring does a bunch of context loading, and Hibernate scans for Jpa annotations, it takes about 4 mins.

              I am very excited if this feature will give us a shortcut!

              • 4. Re: Hot redeployment
                Christian Bauer Master

                I wouldn't jump on it just now, it's really experimental. I'm testing it and the first issue with the generated build script is that you have to split your compilation into two steps, which isn't really possible for anything but the most trivial action + model application.

                I'm working on a script that deploys things based on configurable package patterns, so you can say "these are the packages I want to enable for hot redeployment with Seam".

                Progress is being logged on http://jira.jboss.com/jira/browse/JBSEAM-997

                • 5. Re: Hot redeployment
                  Gavin King Master

                   

                  What is the difference between WEB-INF/dev and WEB-INF/classes?


                  Stuff in WEB-INF/classes gets loaded onto the WAR classloader, so it cant be reloaded w/o restarting the deployment. Stuff in WEB-INF/dev gets loaded by a special Seam classloader, so it can be reloaded any time it changes.

                  What if the content of those two dirs go out of sync?


                  "reloadable" classes don't go into WEB-INF/classes during development. "non-reloadable" classes, eg. Hibernate entities live in WEB-INF/classes.

                  Does this make developing in Seam POJO more appealing than developing in EJB3 beans? ;)


                  I'm afraid to say it does, at least until the EJB3 container supports a similar mechanism.

                  • 6. Re: Hot redeployment
                    Gavin King Master

                     

                    Does this work in any web container?


                    Should do, at least any that supports exploded deployment.

                    • 7. Re: Hot redeployment
                      Christian Bauer Master

                      I've posted a build.xml I'm using with IntelliJ here: http://jira.jboss.com/jira/browse/JBSEAM-997

                      • 8. Re: Hot redeployment
                        Gavin King Master

                        So I *think* we can get the same thing for ejb3 components by deploying them into WEB-INF/dev and loading them using E-EJB3. However, I'm not sure that E-EJB3 currently runs inside JBoss, so I would probably need some changes there.

                        • 9. Re: Hot redeployment
                          Christian Bauer Master

                          We should probably try to make the EJB3 deployer more flexible instead. On the other hand, your approach would work on other appservers.

                          • 10. Re: Hot redeployment
                            stephen.friedrich Novice

                            For what it's worth: I strongly agree that rather than rolling your own, the app server itself should be made more flexible.

                            In fact reloading works even right now, if you don't change anything Seam specific, right? At least I seem to have no problem with hot deployment when I just changed the implementation of a method.

                            • 11. Re: Hot redeployment
                              Gavin King Master

                              The problem with JBoss hot deployment today is that redeployment occurs when something changes. Which means that if you are editing stuff in eclipse, and the seam-gen build is copying that stuff across to the deploy dir, you have two choices:

                              (1) touch the descriptor every time, and get thousands of redeploys (JBoss blows up when it runs out of permgen space)
                              (2) don't touch the descriptor until user explicitly asks for a restart (which is irritating to user)

                              The way Seam's hotdeploy works is that it redeploys the components when a request comes in, and it notices that there has been some change in WEB-INF/dev.

                              Which means that you avoid the permgen errors.

                              • 12. Re: Hot redeployment
                                Chuck Adams Novice

                                 

                                "gavin.king@jboss.com" wrote:
                                I've just committed a new feature to CVS that lets code changes made to Seam JavaBean components be visible immediately without a container restart.


                                Mmmm yeah, take that tapestry 5. I think I'm going to have to migrate away from EJB's sooner rather than later to take advantage of stuff like this (it's not like I use them, but I did like having web services available if I needed them). I'm thinking that in a couple years, all java frameworks are going to move to a "hot replace" model (and here's where the smalltalk crowd gets to be smug).

                                There's also a push these days toward OSGi as a way to dynamically construct systems. Does Seam have a strategy for that?

                                • 13. Re: Hot redeployment
                                  stephen.friedrich Novice

                                   

                                  "gavin.king@jboss.com" wrote:
                                  The problem with JBoss hot deployment today is that redeployment occurs when something changes. Which means that if you are editing stuff in eclipse, and the seam-gen build is copying that stuff across to the deploy dir, you have two choices:

                                  So part of this is an Eclipse problem?

                                  I am using Idea. After re-compiling a class I can choose to either hotswap (if I am debugging, using JVM TI) or package (let Idea copy the class file to the exploded dir and let JBoss pick up the single file there).

                                  • 14. Re: Hot redeployment
                                    Tony Herstell Master

                                    I only ever use exploded deployment in MyEclipse anyhow.
                                    No Ant at all so no build or deploy stage.
                                    Only occasionally do you get messages from Jboss/MyEclipse saying it recommends doing a re-start of the server (one-click) and if you have improved on this thats cool... save even more time.

                                    1 2 Previous Next