9 Replies Latest reply on Jan 28, 2008 3:04 PM by dhinojosa

    seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB

    pabloc2112

      I'm having a hard time upgrading from seam 1.2.1 to seam 2.0.1.CR1. I saw that there is a new version of Embedded JBoss and decided it is now or never for the upgrade. I followed all the instructions on the wiki. I'm using a Postrgres DB, so I created a postgress-ds.xml file and copied to the deploy dir. However, I get a java.lang.ClassCastException: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to javax.transaction.TransactionManager exception. I'm new to jboss configuration, so maybe I'm missing a file (maybe need to delete a file) or configuration? can somebody please point me on the right direction?

      Here is my ds configuration:


      <local-tx-datasource>
      <jndi-name>PostgresDS</jndi-name>
      <connection-url>jdbc:postgresql://localhost/beta_xxx</connection-url>
      <driver-class>org.postgresql.Driver</driver-class>
      <user-name>genie</user-name>
      genie4.0
      </local-tx-datasource>


      And the stack trace:

      java.lang.ClassCastException: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to javax.transaction.TransactionManager
      at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
      at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:325)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
      at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
      at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
      at org.jboss.seam.Component.callCreateMethod(Component.java:2005)
      at org.jboss.seam.Component.newInstance(Component.java:1976)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
      at org.jboss.seam.init.Initialization.init(Initialization.java:573)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)


        • 1. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
          dhinojosa

          Put your code stuff in

          tags, it's hard to interpret.
          
          


          • 2. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
            pabloc2112

            Sorry, here is my ds configuration:

            <datasources>
             <local-tx-datasource>
             <jndi-name>PostgresDS</jndi-name>
             <connection-url>jdbc:postgresql://localhost/beta_xxx</connection-url>
             <driver-class>org.postgresql.Driver</driver-class>
             <user-name>genie</user-name>
             <password>genie4.0<password>
             </local-tx-datasource>
            </datasources>
            


            And the stack trace:
            jSEVERE: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
            java.lang.ClassCastException: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to javax.transaction.TransactionManager
             at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
             at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:325)
             at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
             at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
             at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
             at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
             at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
             at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
             at org.jboss.seam.Component.callCreateMethod(Component.java:2005)
             at org.jboss.seam.Component.newInstance(Component.java:1976)
             at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
             at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
             at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
             at org.jboss.seam.init.Initialization.init(Initialization.java:573)
             at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
             at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
             at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
             at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
             at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
             at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
             at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
             at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
             at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
             at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
             at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
             at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
             at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
             at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
             at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
             at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
             at org.apache.catalina.core.StandardService.start(StandardService.java:516)
             at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
             at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
             at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
            
            


            • 3. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
              nickarls

              Post your persistence.xml and the persistance-related stuff from components.xml

              • 4. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
                pabloc2112

                I'm using hibernate so here is my hibernate.cfg.xml:

                <hibernate-configuration>
                 <session-factory name="java:/genie_db">
                 <property name="show_sql">true</property>
                 <property name="transaction.flush_before_completion">true</property>
                 <property name="connection.release_mode">after_statement</property>
                 <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
                 <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
                 <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
                 <property name="connection.datasource">java:/PostgresDS</property>
                 <property name="configurationClass">org.hibernate.cfg.AnnotationConfiguration</property>
                 <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
                 <mapping package="com.onlineinfo.genie.domain"/>
                 <mapping class="com.onlineinfo.genie.domain.User" />
                 <mapping class="com.onlineinfo.genie.domain.Customer" />
                 <mapping class="com.onlineinfo.genie.domain.Address" />
                ...
                


                and from components.xml ...
                <core:init debug="true"/>
                
                <core:manager conversation-timeout="120000"
                 concurrent-request-timeout="500"
                 conversation-id-parameter="cid"/>
                
                <!--DB-->
                <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
                <persistence:managed-hibernate-session name="genie_db" auto-create="true"/>
                
                <transaction:hibernate-transaction session="#{genie_db}"/>
                ....
                


                • 5. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
                  dhinojosa

                  What happens if you change:

                  <persistence:managed-hibernate-session name="genie_db" auto-create="true"/>
                  



                  To:

                  <persistence:managed-hibernate-session name="genie_db" auto-create="true" session-factory-jndi-name="java:/genie_db"/>
                  


                  • 6. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
                    dhinojosa

                    oh and you need to set the property:
                    hibernate.transaction.flush_before_completion to true

                    • 7. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
                      pabloc2112

                      I changed to:

                      <persistence:managed-hibernate-session name="genie_db" auto-create="true" session-factory-jndi-name="java:/genie_db"/>

                      and still got the same error.

                      Where in jboss do I define the TransactionManager? is com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate the correct transaction manager for hibernate and postgres?

                      • 8. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
                        pabloc2112

                        Nobody else has a problem with Jboss embedded tomcat and postgres? I'm sure I'm missing some configuration, but I can't find any examples or posts related to this problem

                        • 9. Re: seam 2.0.1.CR1 with Tomcat 6.0 and Postgres DB
                          dhinojosa

                          I am out of ideas. I did the embedded mysql a while back purely for academic reasons and offered all I can. Hopefully some of jboss guys can help you out here shortly.