12 Replies Latest reply on Oct 26, 2009 9:17 PM by atamhank

    Does Seam work on JBossAS 5.1.0?

    worldofnic
      It's a simple question, but does any version of Seam work out-of-the-box with JBossAS 5.1.0.GA?

      So far, I've tried 2.0.x and 2.1.2.

      If I create a simple crud app with seam-gen or JBossTools (against PostgreSQL on Java 6 on Vista/x86 or RHEL 5/x64) then it pretty much fails in the well documented ways you see on the forums. (select foo from Foo foo doesn't work as the datasource is unbound)

      Adding in the various one-line changes to persistence.xml (you add a <class>) and components.xml help (the entity bean is then mapped correctly) but I still can't find the datasource.

      Is there a known way to get them working together? As they're both from the same stable, I expected them to get along really well.

      Looking forward to some positive news.
      nic
        • 1. Re: Does Seam work on JBossAS 5.1.0?
          jeanluc

          It works for me (Seam 2.1.1.GA, JBoss 5.1.0.GA, Oracle 10). The app is not generated with seamgen nor does it use Seam's app framework, though.

          • 2. Re: Does Seam work on JBossAS 5.1.0?
            mdesignz

            It's working for me.  Be sure that all of your tags in persistence.xml are on the same line.  In other words, you can't break a single tag across multiple lines.  That one, got me for quite a while.  If you continue to have problems, post the exception and I'm sure we can figure it out.  Like Jean Luc, this is a non-seam-gen application built with Maven 2 under JDK 6 (so I'm using the JDK specific AS 5.1.0.GA). 

            • 3. Re: Does Seam work on JBossAS 5.1.0?
              jeanluc

              We also build with Maven 2 under JDK6. Not sure if it's relevant but just in case...



              It's working for me. Be sure that all of your tags in persistence.xml are on the same line. In other words, you can't break a single tag across multiple lines.

              Do you mean the tag name (such as <property ... or an entire element (such as <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />? Is this a confirmed bug? This looks like an XML parsing bug, I don't see why the JPA implementation would be aware of how persistence.xml was written. What matters is the content.


              Thanks,
              -jl

              • 4. Re: Does Seam work on JBossAS 5.1.0?
                mdesignz

                My mistake.  Not persistence.xml, but the data source files.  This is a known issue for 5.1.0.GA according to the various forums.


                For example, if you have:




                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
                </xa-datasource-class>
                <xa-datasource-property name="URL">
                jdbc:mysql://localhost/jbpm?characterEncoding=UTF-8</xa-datasource-property>
                




                which can easily occur if you have something that formats for you, the datasource won't start.


                It must be:




                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                <xa-datasource-property name="URL">jdbc:mysql://localhost/jbpm?characterEncoding=UTF-8</xa-datasource-property>
                



                • 5. Re: Does Seam work on JBossAS 5.1.0?
                  mdesignz
                  • 6. Re: Does Seam work on JBossAS 5.1.0?
                    norman

                    I've used the latest Seam 2.1 with AS 5.1.  Seam 2.2 specifically targets 5.1 with updates to the latest Hibernate versions.  2.2.0.GA will be out shortly.

                    • 7. Re: Does Seam work on JBossAS 5.1.0?
                      worldofnic

                      Thanks all. I'll probably try 2.2.0.CR1 soonish and see how far I get.

                      • 8. Re: Does Seam work on JBossAS 5.1.0?
                        adampwells

                        I cannot get Seam 2.2 to work when using an xa-datasource on either JBoss AS 4.2.3 or 5.1


                        The error is data source not bound - and I have checked for breaks in the file.


                        The same data source works with Seam 2.1.2 on JBoss 4.2.3.


                        <?xml version="1.0" encoding="UTF-8"?>
                        <!DOCTYPE datasources
                            PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
                            "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
                        <datasources>
                           <xa-datasource>
                            <jndi-name>portalDatasource</jndi-name>
                             <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                             <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/portal</xa-datasource-property>
                             <xa-datasource-property name="User">portal</xa-datasource-property>
                             <xa-datasource-property name="Password">password</xa-datasource-property>
                             <track-connection-by-tx>true</track-connection-by-tx>
                             <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
                            <metadata><type-mapping>mySQL</type-mapping></metadata>
                          </xa-datasource>
                        </datasources>



                        Looking at the JNDIView, I can see that the data source IS bound...


                        I have used seam-gen to create the seam apps.


                        Any pointers would be appreciated...

                        • 9. Re: Does Seam work on JBossAS 5.1.0?
                          asookazian

                          I successfully deployed and ran the booking example from Seam 2.2.0.GA on JBoss 5.1.0.GA.  So perhaps the problem is specific to MySQL and/or MySQL XA datasources...


                          In any event, it would be nice if the examples in the Seam distro had a project that used XA datasource for 2 RDBMDS global tx or 1 RDBMS and 1 JMS session, etc. with MySQL backend like the wiki example.

                          • 10. Re: Does Seam work on JBossAS 5.1.0?
                            lvdberg

                            JBoss 5.1 works great -out-of-the-box- with Seam 2.1.2 and Rich 3.3.1. It solved an important issue for me concerning loading the entitymanager-related-jar (domainModel9 BEFORE loading the Seam application. In JBOSS 5.0 its the other way around, can be solved by using ear deployment, but for development we deploy the EJB3 module separate from the web-application. Another great diferences is the inclusion of the latests REST-Easy libraries and Hibernate (Try out Hibernate in combination with Envers together with Seam)



                            We are using seam-gen for pre- 2.1.2 projects but we are gradually shifting to Maven now.


                            Leo

                            • 11. Re: Does Seam work on JBossAS 5.1.0?
                              atamhank
                              I have been experimenting with Seam and various versions of jboss and various versions of postgresql database drivers (v8.2, v8.3 and v8.4) and created simple CRUD app to run on various permutations and combinations.

                              Seam 2.0.3 + Jboss 4.2.2 + Postgresql (8.3) with jdbc drivers v8.3, v8.4 works ok (jdbc 8.2 did not work) using SeamGen

                              When the same application is deployed to jboss 5.1 (with rest of above same), the working application did run but did not fetch actual data in the UI. The app works as if there is no data in the database. No apparent error message or any thing in the log. does warn about ejb3 persistence not set properly.

                              Hope this helps someone who may be trying this out.
                              • 12. Re: Does Seam work on JBossAS 5.1.0?
                                atamhank
                                Just checked out

                                Seam 2.2.0.GA + Jboss-5.1.0.GA + Postgresql 8.3 + Postgresql-8.4-701.jdbc4.jar driver work fine with seam gen. just reverse engineered an simple app and works well out of box.

                                Anyone used rev eng setting to enable the system to sense the primary key is being generated from associated sequence in database so Seam just needs to take the value from sequence and put in database table's primary key column?

                                I saw some posts where need to specify the table name, sequence name for each table?
                                eg.

                                @Entity
                                public class Inventory implements Serializable {

                                        @Id
                                        @GeneratedValue(generator="InvSeq")
                                        @SequenceGenerator(name="InvSeq",sequenceName="INV_SEQ", allocationSize=5)
                                        private long id;
                                Is there a way for it to sense if the primary key is linked to as sequence (or populated via a sequence) to automatically put the code for that table in place? Very useful especially if there a large number of tables.

                                I will appreciate any help or sharing of experience around this. 
                                Thanks,
                                Aaditi