10 Replies Latest reply on May 21, 2007 3:01 AM by -arthur-

    Getting Started with Seam and Maven / Migrating from Spring

    -arthur-

      Hi,

      i'm fed up with developing Web Apps with Spring.
      Spring is cool, no question, but the overhead is pretty too much. And its not a Web Framework.
      Seams seems to be the thing i am searching for.
      So i'm willing to learn another framework ;)

      Seam tends to be an easy way to get things working and enables really cool features.

      So, i plan to migrate my recent started own project onto Seam.
      I wanna drop the whole spring stuff and migrate completely, because of consistency and so on.
      At the moment the project isn't really big; ~ 90 classes. So i hope its not gonna be a bad pain.

      My current project is built with Maven2 and i really want to reside on that.
      This is the current build:

      Facelets, MyFaces, Tomahawk, Ajax4JSF, Richfaces, Acegi, Spring, Hibernate.
      I deploy to jetty on development with code/compile/test cycle. Is this possible with seam?

      Should i use JBoss AS or Microcontainer?
      I'm familar with Hibernate and would like to use it further.
      Or yould you advice to change to EJB3?

      Has anyone hints / advices / best practices to do my intend?

      I've alerady discovered http://software.softeu.cz/seam/index.html for Maven2 support.

      How i get started fast? ;)

      Thansk very much for fast reply! I'm willing to begin this evening ;)



        • 1. Re: Getting Started with Seam and Maven / Migrating from Spr
          gavin.king

          * It's easier to just use JBoss AS, and it is a nicer development experience, since hot deploy works better than in plain Tomcat

          * EJB3 vs. Hibernate is really up to you. If you are already using Hibernate in your project, there is no really strong reason to change at this stage. You can always switch to JPA later if you like.

          * Probably the most pain you will experience is getting everything working nicely with Maven, but at least you have discovered a good starting point for that.

          Cheers.

          • 2. Re: Getting Started with Seam and Maven / Migrating from Spr
            -arthur-

            Thanks for your fast reply!

            So, if i use Hibernate i can package my app as .war and deploy to JBoss AS?
            I haven't any experience with .ear package structure.

            How does Seam handle Hibernate Sessions? I don't wanna see beloved LazyInitilization too often... ;)

            • 3. Re: Getting Started with Seam and Maven / Migrating from Spr
              christian.bauer

              You should start with the tutorials of the Seam reference documentation.

              • 4. Re: Getting Started with Seam and Maven / Migrating from Spr
                -arthur-

                Ok, i got the kickoff.

                The softeu.cz Archetype for Maven2 is awesome.
                Everything worked instantly.
                http://software.softeu.cz/archetypes/seam/index.html

                Im going to start migrating my app now. :)
                Thanks for your advices.

                • 5. Re: Getting Started with Seam and Maven / Migrating from Spr
                  -arthur-

                  Ok, i decided to use EJB3 with Hibernate EntityManager.
                  Thats a clean solution from scratch and not hard to understand.

                  I have a Maven2 Project skelleton and wondering if the Maven2 Jetty6 plugin supports EJB3 when using JBoss Microcontainer?
                  Its important to me, because the Jetty plugin supports in-workspace deployment, hot redeploy, and remote debugging.
                  Anybody tried this?

                  I ordered "Java Persistence with Hibernate" today and really looking forward to read it.
                  It's a pitty i don't have any credit card, else i had ordered the ebook.

                  • 6. Re: Getting Started with Seam and Maven / Migrating from Spr
                    fabricio.lemos

                    I don´t know if it supports hot-redeploy, but I´m using Maven2 Cargo plugin to deploy my Seam application to Jboss AS. It supports in-workspace deployment and remote debugging.

                    • 7. Re: Getting Started with Seam and Maven / Migrating from Spr
                      -arthur-

                      Do you have any resources where i can get an idea of the thing?
                      Any pom.xml settings or an example project?

                      That sounds good, anyway.

                      • 8. Re: Getting Started with Seam and Maven / Migrating from Spr
                        fabricio.lemos

                        I have a multi-module project. Here is the plugin configurations of my ear project:

                        <build>
                         <defaultGoal>cargo:deploy</defaultGoal>
                         <plugins>
                         <plugin>
                         <groupId>org.codehaus.cargo</groupId>
                         <artifactId>cargo-maven2-plugin</artifactId>
                         <configuration>
                         <container>
                         <containerId>jboss4x</containerId>
                         <type>remote</type>
                         </container>
                         <configuration>
                         <type>runtime</type>
                         <properties>
                         <cargo.hostname>
                         ${remoteServer}
                         </cargo.hostname>
                         <cargo.servlet.port>
                         ${remotePort}
                         </cargo.servlet.port>
                         <cargo.remote.username>
                         ${remoteUsername}
                         </cargo.remote.username>
                         <cargo.remote.password>
                         ${remotePassword}
                         </cargo.remote.password>
                         </properties>
                         </configuration>
                         </configuration>
                         </plugin>
                         <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-ear-plugin</artifactId>
                         <configuration>
                         <displayName>Prototipo</displayName>
                         <description>Prototipo Seam</description>
                         <version>5</version>
                         <modules>
                         <webModule>
                         <groupId>br.gov.serpro.prototipo</groupId>
                         <artifactId>cenarios-web</artifactId>
                         <contextRoot>/seam-reg</contextRoot>
                         </webModule>
                         <ejbModule>
                         <groupId>br.gov.serpro.prototipo</groupId>
                         <artifactId>cenarios-ejb</artifactId>
                         </ejbModule>
                         <javaModule>
                         <groupId>org.jboss.seam</groupId>
                         <artifactId>jboss-seam</artifactId>
                         <includeInApplicationXml>
                         true
                         </includeInApplicationXml>
                         </javaModule>
                         <javaModule>
                         <groupId>org.jboss.seam</groupId>
                         <artifactId>el-api</artifactId>
                         <includeInApplicationXml>
                         true
                         </includeInApplicationXml>
                         </javaModule>
                         <javaModule>
                         <groupId>org.jboss.seam</groupId>
                         <artifactId>el-ri</artifactId>
                         <includeInApplicationXml>
                         true
                         </includeInApplicationXml>
                         </javaModule>
                         </modules>
                         </configuration>
                         </plugin>
                         </plugins>
                        </build>
                        <properties>
                         <remoteServer>localhost</remoteServer>
                         <remotePort>8080</remotePort>
                         <remoteUsername>admin</remoteUsername>
                         <remotePassword>admin</remotePassword>
                        </properties>
                        

                        I did not used any Archetype, so it could be a little different from your configuration.
                        To deploy the application, run "cargo:deploy" goal.

                        • 9. Re: Getting Started with Seam and Maven / Migrating from Spr
                          ge0ffrey

                          Thanks for posting the link to http://software.softeu.cz/seam/index.html
                          I just bought the seam book and was sad to find out Seam still has no high-quality poms in the central maven repo.

                          Spring's most voted issue was quality maven2 poms in the central repo (SPR-1484), let's all maven2 users vote for http://jira.jboss.com/jira/browse/JBSEAM-983

                          I've seen they started a poc to build hibernate with maven2, if we can help them there to prove that maven2 is a wonderfull build system (once you've know the quirks, such as the need to lock down plugin versions) maybe the'll accept it into seam too.
                          But it doesn't matter how seam is build, as long as repo1.maven.org contains quality, up to date poms.

                          • 10. Re: Getting Started with Seam and Maven / Migrating from Spr
                            -arthur-

                            I am still working with the softeu.cz repo, its really cool, because you get seam working fast and the preconfiguration is good too.

                            The only disadvantage i've discovered ist the fact, that you depend softeuz.cz repo and their group and artifact ids.
                            So you have to figure out in which pom the specific dependencies are and change them if you want to use snapshots for example.

                            Actual Seam builds in the repo1 would be great!