7 Replies Latest reply on Oct 22, 2005 7:31 PM by Marius Oancea

    Starting a new seam project in Eclipse 3.1? - help needed

    Andrew Apprentice

      I'm having difficulty in getting a new project running for seam under Eclipse 3.1

      I have an existing project that deploys to Tomcat 5.5. Here is what it contains:
      Facelets 1.0a
      MyFaces 1.1.0
      Hand written MyFaces facelet taglib XML
      Jenia4Faces libraries & servlet
      Hand written Jenia4Faces facelet taglib XML
      Hibernate 3 w/ hbm.xml deployment
      PostgreSQL data source configured in Server.xml for both authentication realm and application usage
      web.xml/Tomcat based authentication using standard JSPs
      Eclipse using 2 deployments:
      Internal deployment to be able to debug (.deployables directory)
      Ant script for standalone tomcat execution
      Eclipse 3.1 with Exadel 3.0.4 Free plugin

      I want to try to use JBoss-Seam for this project inside of Eclipse. I installed the JBoss IDE plugins into Eclipse, but there is no Seam project wizard.

      I am fairly new to Eclipse and haven't ever used JBoss before now (used WebLogic ~4-5 years ago). Could someone help me through getting a new project working in Eclipse?

      Here is what I would like if possible:
      Data source defined once for security inside of JBoss and my application and web-site authentication & data access.
      Hibernate3 used as a backend to EJB3 persistence manager
      (Preferrably) Continue to use hbm.xml mapping (I am not a big fan of ORM through annotations, I don't like the class being bound to only one database)
      Use Seam for all backing beans, and have them deployed as session-beans with conversation scope (right now I am using request scope, and although nice, it creates difficulties on occassions).
      Full integration into Eclipse (I would like to be able to debug on the server) and deploy using an ant build script.

      I got the example seam application (booking) to work fine. The problem is that I can't debug it, it uses annotations, not hbm.xml, it seems to have the data soruce defined in mutiple locations (hard to figure out how to configure), and the ant build script is hard-coded for the examples (I cannot easily just pick up and use it for my project).

      I am new to ear files and fairly new to war files, so please don't assume too much for deployment (I have been working in .NET for several years, and am trying to brush up my Java skills and also build a Java site for my Church).

      Has anyone accomplished this yet? Even if someone could assist me in getting a JBoss web app project (JSF with no Seam) instead of a Tomcat project working in Eclipse it would be a good start.

      Here is what I have done so far to JBoss to try to get ready:
      Added new myfaces and facelet jars to the lib dir:
      /usr/local/jboss/server/default/deploy/jbossweb-tomcat55.sar/jsf-libs
      ls -l:

      -rw-rw-r-- 1 andrew developers 116K 2005-10-04 21:43 commons-beanutils.jar
      -rw-rw-r-- 1 andrew developers 29K 2005-10-04 21:43 commons-codec-1.2.jar
      -rw-rw-r-- 1 andrew developers 162K 2005-10-04 21:43 commons-collections.jar
      -rw-rw-r-- 1 andrew developers 165K 2005-10-04 21:43 commons-digester-1.6.jar
      -rw-r--r-- 1 andrew users 24K 2005-10-11 13:38 el-api.jar
      -rw-r--r-- 1 andrew users 98K 2005-10-11 13:38 el-ri.jar
      -rw-r--r-- 1 andrew users 7.1K 2005-10-11 13:38 facelets-bsh-1.0.jar
      -rw-r--r-- 1 andrew users 241K 2005-10-11 13:38 jsf-facelets.jar
      -rw-r--r-- 1 andrew developers 21K 2005-10-11 13:38 jstl.jar
      -rw-r--r-- 1 andrew developers 231K 2005-10-11 13:38 myfaces-api.jar
      -rw-r--r-- 1 andrew developers 453K 2005-10-11 13:38 myfaces-impl.jar
      -rw-r--r-- 1 andrew users 385K 2005-10-11 13:38 standard.jar
      -rw-r--r-- 1 andrew users 877K 2005-10-11 13:38 tomahawk.jar
      


      Added my data source XML to
      /usr/local/jboss/server/default/deploy/postgres-ds.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>xxx-postgres</jndi-name>
       <connection-url>jdbc:postgresql://localhost/xxx</connection-url>
       <driver-class>org.postgresql.Driver</driver-class>
       <user-name>xxx</user-name>
       <password>xxx</password>
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>PostgreSQL 7.2</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      Added the following to
      /usr/local/jboss/server/default/conf/login-config.xml
      <application-policy name="xxx">
       <authentication>
       <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
       flag="required">
       <module-option name="dsJndiName">java:/xxx-postgres</module-option>
       <module-option name="principalsQuery">
       select password from users where user_name=?
       </module-option>
       <module-option name="rolesQuery">
       select role_name, 'Roles' from user_roles_vw
       where user_name = ?
       </module-option>
       <module-option name="hashAlgorithm">MD5</module-option>
       </login-module>
       </authentication>
       </application-policy>
      



      At this point, I'm getting a bit stuck without getting an eclipse project to work with.




      Thanks for any help you can provide,
      Andrew

        • 1. Re: Starting a new seam project in Eclipse 3.1? - help neede
          Xiang Qinxian Newbie

          check out seam cvs current, gavin king test booking example every day. current have a eclipse project, check it out for details.

          • 2. Re: Starting a new seam project in Eclipse 3.1? - help neede
            Emmanuel Okyere Newbie

            alternatively, the jdt allows you to create projects from a build file; so make a copy the folder of any of the examples that suits what you want to do, delete the src copies and such and create a project from it's build file; then you can open the build and make changes to project name and such to suit your project

            that worked flawlessly for me

            eokyere

            • 3. Re: Starting a new seam project in Eclipse 3.1? - help neede
              Andrew Apprentice

              Thanks for the ideas, but neither of the solutions really helps. The included jboss-seam project is just a mess, it has all the examples, the ant file is specific to building JBoss Seam and the examples, and is not configured for one project.

              Neither solution creates a project that is able to debug against jboss. Neither creates a usable folder structure.

              Looks like I will have to build a project & ant file from scratch.

              • 4. Re: Starting a new seam project in Eclipse 3.1? - help neede
                Eric Fennell Newbie

                I'm relatively new and know very little about Ant / Eclipse, etc. However, I've had success by putting my project's workspace in {seam-home}\examples directory along with the sample projects provided.

                I realize that you're attempting to create an independent project and this doesn't really address that issue... however, if you want to get your coding started and be able to compile / debug etc. this should work for you.

                As far as creating / structuring the project goes, I've tried a few project templates and had the most success with EJB3.0... though I have a few plugins installed and I'm not sure if this is a jboss-ide template or an exadel studio template...

                I think from this point it will be a matter of merging the two build.xml files to get a single independent build.xml.

                • 5. Re: Starting a new seam project in Eclipse 3.1? - help neede
                  Werner Punz Newbie

                  I guess what is really needed (I am currently trying to get things up and running properly as well in eclipse, without ant) is some kind of eclipse template project which addresses those issues.

                  • 6. Re: Starting a new seam project in Eclipse 3.1? - help neede
                    Werner Punz Newbie

                    Ok I got a barebones MyEclipse seam project up and running,
                    once you have figured out why the project failes it is rather easy.

                    If you use barebones Eclipse I can only recommend to use the ant files from the CVS.
                    There is no EAR support in barebones Eclipse.

                    Instructions:
                    First generate a new Enterprise app, with an EJB part and a webapp part.
                    if you are asked for names, check that the ejb part ends with ejb3

                    add the examples configs from one of the examples to the mix.

                    Alter the application.xml to your needs

                    Add your sources and the external libs

                    deploy the entire thing packed!!!!! note, this is needed, because there
                    seems to be a huge bug in the variable resolver, it only works with packed
                    ejb3 files although the bean itself is registered, but it probably is registered
                    if you deploy unpacked under a slightly different context file, or the
                    variable resolver cannot find the interface. Whatever it is it does not work unpacked! This definitely is a bug in Seam!

                    • 7. Re: Starting a new seam project in Eclipse 3.1? - help neede
                      Marius Oancea Novice

                      I followed your instructions for the seam actual CVS snapshot. The project started in MyEclipse without real problems. Thanx a lot.

                      I tried both (exploded and packaged) types of deployment and both are working with the actual version of seam.

                      In pagaged version is not possible to add breakpoints. Any clue why?
                      In exploded archive variant the brackpoints are possible. What I still miss is hot swaping of classes (I modify a class and when I save it, eclipse tries to change the class at runtime. This is not possible and you have to restart jboss. Redeploy is not enough). Anybody has any experience with that ?

                      Marius