1 2 3 Previous Next 32 Replies Latest reply on Oct 12, 2011 5:05 AM by bussien

    Seam 2 -> 3 migration. How to start?

    mfelix

      What's the current state of information on what's needed to migrate from Seam 2 to Seam 3? From conversation at JUDCon I gathered there's a lot to do. I'd love to help but have no idea how to start.

        • 1. Re: Seam 2 -> 3 migration. How to start?
          lightguard
          Thanks Mike for starting this thread, I'll sticky it so people will come here and post as well.

          What we're looking for from the community more than anything are questions you have when you try to migrate your application. "This class used to be there, but is not in Seam 3", "How do I do _________ in Seam 3?", questions such as those that come up as you look to migrate. We hope not to miss anything in a migration guide, so we're looking the community can help us remember all the functionality in Seam 2 that needs to included in a migration guide (note many of the Seam 3 module leads have not used Seam 2 for some time (or at all in some cases) or may not be familiar with a particular capability of Seam 2). Some modules are still being developed and may not have exactly the same functionality as Seam 2. Please keep that in mind if the answer is similar to "We don't have that yet".

          Of course we're always looking for more contributors for Seam 3, if there's something not there, and there isn't a module being developed for that functionality, please step up volunteer to help out!
          • 2. Re: Seam 2 -> 3 migration. How to start?
            piklos

            Ok how do you make a method asynchronous in seam 3? I mean in a servlet container, because i know you can do it with EJB. In seam 2 we used to be able to do it in tomcat, but i do not see any way of doing it in seam 3.

            • 3. Re: Seam 2 -> 3 migration. How to start?
              valatharv
              We tried to migrate seam 2.0.2 to seam 2.2.1 (I think same was the case when migrating 2.0.2 to seam 3) we noticed issue with Validator where during jboss start-up it gave the exception "validator must be annotated with @BypassInterceptors"

              Due to other high priority tasks, I was not able to investigate this...

              INFO  [javax.servlet.ServletContextListener] (main) Welcome to Seam 2.2.1.Final
              ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sampleSeamApp]] (main) Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
              java.lang.RuntimeException: Could not create Component: testUniqueNameValidator
                   at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1202)
                   at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1118)
                   at org.jboss.seam.init.Initialization.init(Initialization.java:737)
                   at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
                   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
              .....
              Caused by: java.lang.IllegalStateException: Validator com.test.session.testUniqueNameValidator must be annotated with @BypassInterceptors
                   at org.jboss.seam.Component.registerConverterOrValidator(Component.java:346)
                   at org.jboss.seam.Component.<init>(Component.java:259)
                   at org.jboss.seam.Component.<init>(Component.java:208)
                   at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1186)
                   ... 73 more

              Sample Validator Code:
              @Name("testUniqueNameValidator")
              @Validator
              @Transactional
              public class TestUniqueNameValidator implements javax.faces.validator.Validator, Serializable{
                   @In
                   EntityManager entityManager;
                   ....
              }
              • 4. Re: Seam 2 -> 3 migration. How to start?
                lightguard

                Brvno Brvnic wrote on May 11, 2011 10:13:


                Ok how do you make a method asynchronous in seam 3? I mean in a servlet container, because i know you can do it with EJB. In seam 2 we used to be able to do it in tomcat, but i do not see any way of doing it in seam 3.


                This is one of those areas we don't have quite yet. Seam JMS and Seam Cron will have support for this idea, but they're not quite polished yet. Please examine the modules and give feedback to Pete (Cron) and John (JMS).

                • 5. Re: Seam 2 -> 3 migration. How to start?
                  lightguard

                  Val Sw wrote on May 11, 2011 11:04:


                  We tried to migrate seam 2.0.2 to seam 2.2.1 (I think same was the case when migrating 2.0.2 to seam 3) we noticed issue with Validator where during jboss start-up it gave the exception validator must be annotated with @BypassInterceptors

                  Due to other high priority tasks, I was not able to investigate this...



                  INFO  [javax.servlet.ServletContextListener] (main) Welcome to Seam 2.2.1.Final
                  ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sampleSeamApp]] (main) Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
                  java.lang.RuntimeException: Could not create Component: testUniqueNameValidator
                       at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1202)
                       at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1118)
                       at org.jboss.seam.init.Initialization.init(Initialization.java:737)
                       at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
                       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
                  .....
                  Caused by: java.lang.IllegalStateException: Validator com.test.session.testUniqueNameValidator must be annotated with @BypassInterceptors
                       at org.jboss.seam.Component.registerConverterOrValidator(Component.java:346)
                       at org.jboss.seam.Component.<init>(Component.java:259)
                       at org.jboss.seam.Component.<init>(Component.java:208)
                       at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1186)
                       ... 73 more
                  
                  Sample Validator Code:
                  @Name("testUniqueNameValidator")
                  @Validator
                  @Transactional
                  public class TestUniqueNameValidator implements javax.faces.validator.Validator, Serializable{
                       @In
                       EntityManager entityManager;
                       ....
                  }






                  There is no more @BypassInterceptors in Seam3. For this look to the Seam Faces module, which has support for injection into Validators and Converters. I would think, however, Bean Validation would solve many of these problems.

                  • 6. Re: Seam 2 -> 3 migration. How to start?
                    mfelix

                    Okay, here are some questions to start:


                    1) The first thing that comes to mind is that I'll be doing search/replace for annotations. For instance, changing @In to @Inject. What issues will I find? Is @AutoCreate no longer needed or even a valid concept?


                    2) We have a lot of @Factory methods, which I assume will become @Produces. But we also had a few uses of @Out. I don't see the concept of outjection in the CDI documentation, so I assume that's gone. How to replace it?


                    3) Is there no more @Begin or @End?

                    • 7. Re: Seam 2 -> 3 migration. How to start?
                      lightguard

                      Michael Felix wrote on May 12, 2011 11:52:


                      Okay, here are some questions to start:

                      1) The first thing that comes to mind is that I'll be doing search/replace for annotations. For instance, changing @In to @Inject. What issues will I find? Is @AutoCreate no longer needed or even a valid concept?


                      @AutoCreate is no longer a valid concept, you are correct.



                      2) We have a lot of @Factory methods, which I assume will become @Produces. But we also had a few uses of @Out. I don't see the concept of outjection in the CDI documentation, so I assume that's gone. How to replace it?


                      @Factory becomes @Producer correct.


                      To get similar functionality as @Out in CDI you have to create a wrapper object around what you want to outject. Then you Inject that wrapper object and change the state of the container, maybe not as elegant as @Out but it works. You may also want to look at @Unwraps from Seam Solder as it may also help with this.



                      3) Is there no more @Begin or @End?

                      They're in Seam Faces now. I would highly recommend looking at Seam Conversation to add further conversation management. Conversations in CDI are currently not as feature rich as they were in Seam 2. Another option would be to use @ViewScoped from Seam Faces as well.

                      • 8. Re: Seam 2 -> 3 migration. How to start?
                        ckarthi

                        What is the equivalent of the annotation org.jboss.seam.annotations.Synchronized in Seam 3?

                        • 9. Re: Seam 2 -> 3 migration. How to start?
                          lightguard

                          karthikeyan C wrote on May 16, 2011 09:45:


                          What is the equivalent of the annotation org.jboss.seam.annotations.Synchronized in Seam 3?


                          To the best of my knowledge, we don't have anything that's equivalent, honestly I'm not sure if we will either, Seam 2 really controlled the whole request lifecycle, we're not doing that in Seam 3. Perhaps this could be something to add to either the Faces or Servlet modules. Feel free to create a JIRA for this in one of the modules if you feel it's really needed and we'll get it sorted out.

                          • 10. Re: Seam 2 -> 3 migration. How to start?
                            mfelix
                            Thanks Jason. You say conversations are not as feature-rich in 3. Why is that? Is it a decisions to pare down the functionality, or is it just that no one has gotten to them yet? What features are missing/abandoned?

                            More questions:

                            Will we have to change our Component.getInstance() and Contexts.getConversationContext().get() calls?

                            How does the event model compare?

                            How will we have to change all our *.page.xml files?

                            Is Dan working on "Seam 3 in Action" yet? :)
                            • 11. Re: Seam 2 -> 3 migration. How to start?
                              lightguard

                              Michael Felix wrote on May 17, 2011 17:13:


                              Thanks Jason. You say conversations are not as feature-rich in 3. Why is that? Is it a decisions to pare down the functionality, or is it just that no one has gotten to them yet? What features are missing/abandoned?

                              The problem was the spec, from what I've understood they couldn't all agree on how to treat some of the features from Seam 2. Currently you can only have one conversation going at a time per session, and there is no nesting of conversations. I believe the Seam Conversation module though address many of these issues.



                              More questions:

                              Will we have to change our Component.getInstance() and Contexts.getConversationContext().get() calls?

                              Yes, there is no Component class any more. You can either use the BeanManager (really not recommended for application developers) or the Instance class.



                              How does the event model compare?

                              Events are much more powerful now, the only thing that isn't there out of the box are async events, but you can look to Seam Cron for those.



                              How will we have to change all our *.page.xml files?

                              Those will go to the ViewConfig structure in Seam Faces. Not all the functionality is there, but the majority is, you'll want to ask Brian Leathem for more info.



                              Is Dan working on Seam 3 in Action yet? :)

                              I don't think so. He's too busy running around at conventions to do another book :)

                              • 12. Re: Seam 2 -> 3 migration. How to start?
                                So where are all the s:*-commands gone?
                                I used things like s:link etc. a lot, but now they have somehow disappeared.
                                Is there any equivilant?

                                Thomas
                                • 13. Re: Seam 2 -> 3 migration. How to start?
                                  lightguard

                                  Many of them are part of JSF2 now. If you give us a list of exactly which ones you're looking for we can better answer.

                                  • 14. Re: Seam 2 -> 3 migration. How to start?
                                    mfelix

                                    Regarding @Out being removed: I found a thread here where Dan said (back in 2009):




                                    It will be available in Seam classic mode, which Seam 3 will fully support. Developers will be encouraged to embrace JCDI's producer methods, which are like super charged factory methods. But the jury is still out from the community as whether producer methods will completely replace the need for outjection or not. We have to see what people like. If there is still a strong case for outjection, it will stay (just not in JSR-299/JCDI). Personally, I still find it extremely useful and don't really get confused by it.


                                    What has changed since he wrote that? I still think outjection is useful and am confused by its removal. We have a lot of uses of it and I'm struggling with thinking about how they'll have to change.


                                    For instance: a case where a factory iterates a list of object A to compute a list of object B, but also wants set a boolean depending on whether any of those object in list A meets some criterion. Right now we're outjecting a list and a boolean when the factory completes (using a void factory method with several @Out). Without @Out at our disposal it seems we'll either have to rely on Contexts.getConversationContext().set() or its equivalent, or wastefully run through the loop again in a different producer method. Neither option seems like an improvement.

                                    1 2 3 Previous Next