6 Replies Latest reply on Jun 22, 2007 2:26 AM by Tom Tackabery

    Seam Eclipse project structure (newbie question)

    Tom Tackabery Newbie

      I'm still rather new at Seam (and web development) and I'm finding it difficult to setup a Seam POJO project using a standard WTP JSF 1.2 (dynamic web) project. I understand the packaging structure defined in the Seam reference doc; however, I'm unsure as to how that would translate into my development project structure.

      I'm using Eclipse 3.3 + WTP JSF 1.2. When I create a new project, Eclipse creates (and expects) a structure like this:

      my-application/
       src/
       com.myapp.foo.java
       com.myapp.bar.java
       ...
       WebContent/
       index.html
       index.xhtml
       foopage.xhtml
       barpage.xhtml
       META-INF/
       MANIFEST.MF
       WEB-INF/
       faces-config.xml
       web.xml
       LIB/
       el-api.jar
       el-ri.jar
       jsf-facelets.jar
       ...


      The Seam reference document (J2EE/pojo) example shows the following packaging:

      my-application.war/
       META-INF/
       MANIFEST.MF
       WEB-INF/
       web.xml
       components.xml
       faces-config.xml
       lib/
       jboss-seam.jar
       jboss-seam-ui.jar
       el-api.jar
       el-ri.jar
       jsf-facelets.jar
       hibernate3.jar
       hibernate-annotations.jar
       ...
       my-application.jar/
       META-INF/
       MANIFEST.MF
       seam.properties
       hibernate.cfg.xml
       org/
       jboss/
       myapplication/
       User.class
       Login.class
       Register.class
       ...
       login.jsp
       register.jsp
       ...


      The example above shows the project source JARd up with seam.properties and the hibernate config files. Is it necessary to create this JAR, i.e can those files "live" in src/, the web root, or WEB-INF during development? Can I deploy those files exploded somewhere else in the standard Eclipse-built war structure during development?

      My best guess would be as follows:

      my-application/
       src/
       com.myapp.foo.java
       com.myapp.bar.java
       ...
       WebContent/
       index.html
       index.xhtml
       foopage.xhtml
       barpage.xhtml
       META-INF/
       MANIFEST.MF
       WEB-INF/
       faces-config.xml
       web.xml
       components.xml
       seam.properties
       LIB/
       jboss-seam.jar
       jboss-seam-ui.jar
       el-api.jar
       el-ri.jar
       jsf-facelets.jar
       hibernate3.jar
       hibernate-annotations.jar
       ...


      I've not had any luck with the above structure so far, but that might be becuase of other configuration issues, missing libs, ingnorant newbie, etc. :-)

      Am I on the right track?

      If you've accomplished this in Eclipse, I would very much appreciate an example.

      Thanks!

        • 1. Re: Seam Eclipse project structure (newbie question)
          Pete Muir Master

          Our recommendation is to use seam-gen, and the eclipse project it creates for you.

          • 3. Re: Seam Eclipse project structure (newbie question)
            Tom Tackabery Newbie

            Thanks for the responses Pete. I've used Seam-gen, and it's very cool in many ways, but I've run into too many issues with that build structure - mostly related to the fact that Eclipse/WTP doesn't recognize it as a web app. I'll admit it might be due to my inexperience, but it ends up costing me more time than it saves. I've had much more success using the standard projects created by WTP - unfortunately they were without Seam.

            I would prefer to fit things into the WTP structure if possible.

            • 4. Re: Seam Eclipse project structure (newbie question)
              Alex Savitsky Novice

               

              "tptackab" wrote:
              My best guess would be as follows:
              my-application/
               src/
               com.myapp.foo.java
               com.myapp.bar.java
               ...
               WebContent/
               index.html
               index.xhtml
               foopage.xhtml
               barpage.xhtml
               META-INF/
               MANIFEST.MF
               WEB-INF/
               faces-config.xml
               web.xml
               components.xml
               seam.properties
               LIB/
               jboss-seam.jar
               jboss-seam-ui.jar
               el-api.jar
               el-ri.jar
               jsf-facelets.jar
               hibernate3.jar
               hibernate-annotations.jar
               ...


              ...

              Am I on the right track?


              In short, yes, you are. The standard WAR structire (without application code in JAR) works ok for Seam. I'm currently using Eclipse 3.2 (waiting for 3.3 to hit GA) + WTP 1.5 (again, I'm behind you there), and my setup is pretty much the one you've shown, with only one difference: all JARs are instead placed in my-application/lib, and linked to the project as "J2EE Module Dependencies". It's only a matter of taste though, placing them in WEB-INF/lib would work just the same (I tried).

              And just for your reference, here's the list of JARs I have in the project, in case you're trying to figure out which ones you're missing:

              lib/commons/commons-beanutils-1.7.0.jar
              lib/commons/commons-codec-1.3.jar
              lib/commons/commons-collections-3.2.jar
              lib/commons/commons-digester-1.7.jar
              lib/commons/commons-fileupload-1.1.1.jar
              lib/commons/commons-lang-2.2.jar
              lib/commons/commons-logging-1.1.jar
              lib/commons/itext-2.0.1.jar
              lib/commons/log4j-1.2.13.jar
              lib/jpa/antlr-2.7.6.jar
              lib/jpa/asm.jar
              lib/jpa/cglib-2.1.3.jar
              lib/jpa/dom4j-1.6.1.jar
              lib/jpa/ejb3-persistence.jar
              lib/jpa/hibernate-3.2.3.jar
              lib/jpa/hibernate-annotations-3.3.0.jar
              lib/jpa/hibernate-commons-annotations.jar
              lib/jpa/hibernate-entitymanager-3.3.1.jar
              lib/jpa/hibernate-validator-3.0.0.jar
              lib/jpa/javassist.jar
              lib/jpa/jboss-archive-browsing.jar
              lib/jsf/ajax4jsf-1.1.0.jar
              lib/jsf/el-api.jar
              lib/jsf/el-ri.jar
              lib/jsf/jsf-api.jar
              lib/jsf/jsf-facelets-1.1.11.jar
              lib/jsf/jsf-impl.jar
              lib/jsf/oscache-2.3.2.jar
              lib/mc/concurrent.jar
              lib/mc/jboss-common-jdbc-wrapper.jar
              lib/mc/jboss-common.jar
              lib/mc/jboss-container.jar
              lib/mc/jboss-dependency.jar
              lib/mc/jboss-j2ee.jar
              lib/mc/jboss-j2se.jar
              lib/mc/jboss-jca.jar
              lib/mc/jboss-local-jdbc.jar
              lib/mc/jboss-microcontainer.jar
              lib/mc/jboss-security.jar
              lib/mc/jboss-system.jar
              lib/mc/jboss-transaction.jar
              lib/mc/jnpserver.jar
              lib/mc/xercesImpl.jar
              lib/seam/jboss-seam-debug.jar
              lib/seam/jboss-seam-pdf.jar
              lib/seam/jboss-seam-ui.jar
              lib/seam/jboss-seam.jar
              


              About half of them is the microcontainer, really, so if you're using embedded EJB, YMMV.

              HTH,

              Alex

              • 5. Re: Seam Eclipse project structure (newbie question)
                Tom Tackabery Newbie

                Great! Thanks Alex. It's good to know I'm not too far off track. The list of jars will be a big help.

                Tom

                • 6. Re: Seam Eclipse project structure (newbie question)
                  Tom Tackabery Newbie

                  Thanks once again Alex. I was able to get my app deployed from WTP using a structure nearly identical to the one you described. I got the jars from a Netbeans Seam generated war. Now I just have to figure out which of the jars I'll really use...;-)

                  Here's the WTP project structure as it appears in Eclipse for anyone that might be interested:

                  my-application/
                   src/
                   com.myapp.foo.java
                   com.myapp.bar.java
                   ...
                   META-INF/
                   persistance.xml
                   seam.properties
                   security.drl
                   messages.properties
                   WebContent/
                   index.html
                   index.xhtml
                   foopage.xhtml
                   barpage.xhtml
                   META-INF/
                   MANIFEST.MF
                   WEB-INF/
                   faces-config.xml
                   web.xml
                   components.xml
                   seam.properties
                   LIB/
                   ajax4jsf-1.1.1-SNAPSHOT.jar
                   antlr-2.7.6.jar
                   antlr-3.0ea8.jar
                   commons-jci-core-1.0-406301.jar
                   commons-jci-janino-2.4.3.jar
                   drools-compiler-3.0.5.jar
                   drools-core-3.0.5.jar
                   el-api.jar
                   el-ri.jar
                   janino-2.4.3.jar
                   jboss-seam-debug.jar
                   jboss-seam-ioc.jar
                   jboss-seam-mail.jar
                   jboss-seam-pdf.jar
                   jboss-seam-remoting.jar
                   jboss-seam-ui.jar
                   jboss-seam.jar
                   jbpm-3.1.4.jar
                   jsf-facelets.jar
                   oscache-2.3.2.jar
                   richfaces-3.0.1-SNAPSHOT.jar
                   stringtemplate-2.3b6.jar