1 2 Previous Next 19 Replies Latest reply on Jun 3, 2009 7:08 PM by deanhiller2000 Go to original post
      • 15. Re: Seam-wicket and hot deployment problem
        buckmin.erdem.agaoglu.gmail.com

        wasnt expecting attention this quick, let alone a fix. Thanks very much.

        • 16. Re: Seam-wicket and hot deployment problem
          thonismeta

          i'm also fighting with the hotdeploy process;


          i fixed the within annotation for the wicket filter and use Clint's ModifiedFileScanner;


          but i can still not hotdeploy wicket classes (using SEAM 2.1.1GA);


          i have a Wicket Page MyPage.java that needs injection of a seam component:


          @In private MySeamComponent mySeamComponent;



          after startup of tomcat, everything works fine, mySeamComponent gets injected into MyPage;


          then i changed MySeamComponent, touch the .mod file, the file scanner detects it and initiates a rescan of all classes;
          but when the org.jboss.seam.deployment.AbstractScanner comes to MyPage.class it will ignore the class because it has no @Name-annotation ( hasAnnotations(getClassFile(), classDeploymentHandler.getMetadata().getClassAnnotatedWith()) );


          so the next time seam tries to inject MySeamComponent into MyPage i get a


          Caused by: java.lang.IllegalArgumentException: Can not set de.gameduell.frontend.tournaments.TournamentsListsController field de.gd.wicket.pages.tournaments.TournamentsList.tournamentsLists to de.gameduell.frontend.tournaments.TournamentsListsController_$$_javassist_7
          at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
          



          the two classes (MyPage and MySeamComponent) are loaded by different classloaders (both child classloaders of the webappclassloader) as seam used a new one, so i think java's complaining correctly...


          then i added i dummy @Name(MyPage) so that AbstractScanner accepts MyPage and adds it to the redeploy list;
          but that does not help, as wicket doe not use seam to instantiate the class but uses its DefaultPageFactory to call newInstance - and DefaultPageFactory of course was loaded by the original classloader, so the new MyPage also comes from this classloader.....


          did i miss sth? do i have to change the DefaultPageFactory?


          thx for any help in advance,


          thonis!

          • 17. Re: Seam-wicket and hot deployment problem
            cpopetz

            The AbstractScanner is supposed to ignore MyPage...that scanner is just looking for changed seam components, which wicket pages are not.  The page classes get reloaded because when redeployment happens, the Seam wrapper around the WicketFilter destroys the filter (and thus the WebApplication instance and everything under it) and recreates it, so that the next time a page is created, the new class is used (because it has never been loaded and the contextClassLoader is a new classloader, created by the hot delpoyment filter, that is pointing to the hot deploy directory.)



            That means there is a limitation of hotDeploying: existing page instances can't be used after a redeploy...you have to create new page instances.  That means you have to reload the page (and make sure you're not reloading a versioned page instance, if you're using for example HybridUrlCodingStrategy.)


            Now, if you are reloading a new page instance, i.e. if you set a breakpoint in DefaultPageFactory.newPage and it's getting hit, and you're still getting injection failures, then I'm not sure what's happening and you'll need to create an example project I can grab.

            • 18. Re: Seam-wicket and hot deployment problem
              thonismeta

              hi clint,


              thank you very much for your explanation! that helped me to debug the problem within seam's wicketfilter.


              the problem was my way of patching the wrong within-@Filter-annotation of the org.jboss.seam.web.WicketFilter - i put the patched version into WEB-INF/dev (and removed the wrong one from the seam.jar)


              it seemed to work, but somehow the WicketFilter never got the most recent version of the HotDeployClassLoader, but had a reference to the first one - so the wicket classes never got reloaded.


              now i put the patched WicketFilter back into the original org.jboss.seam-jboss-seam-2.1.1.GA.jar and everything works fine.


              thx again for your help!!!


              thonis.

              • 19. Re: Seam-wicket and hot deployment problem
                deanhiller2000

                For this scanner that you are all talking about, is there something I can do so my seam war file deployed in jboss loads the seam
                components in an external jar file?  We have an EJB jar file that many apps reuse but my war does not load the seam components from that file....any way this scanner can help?  I am not sure what is going on as my war file sees all the classes in the jar file just fine and my app works up until the point where we try to outject a seam component from the EJB jar file....we run queries against db and everything.  It would be very annoying to have to proxy every EJB bean that I want as a seam component to get this all to work.
                thanks for any help or suggestions,
                Dean

                1 2 Previous Next