3 Replies Latest reply on Apr 10, 2008 10:54 AM by Pete Muir

    missing javax.ejb.SessionSynchronization

    alberto Gori Novice

      I am trying to setup a mavenized Seam hello world application, for plain Tomcat6 (EJB, a part of JPA).

      At startup I get this exception:


      18:36:59,592 DEBUG [ComponentDeploymentHandler] could not load class (missing dependency): org.jboss.seam.transaction.EjbSynchronizations
      java.lang.NoClassDefFoundError: javax/ejb/SessionSynchronization
      



      I ask: is it normal that Seam looks for an ejb class? How should I define my transaction management?
      I have this components.xml file:


      <core:manager conversation-timeout="120000" concurrent-request-timeout="500" conversation-id-parameter="cid" />
      <transaction:entity-transaction entity-manager="#{em}" />
      <persistence:entity-manager-factory name="testDatabase" />
      <persistence:managed-persistence-context name="em" auto-create="true" entity-manager-factory="#{testDatabase}" />
      



      The persistence.xml is:


      <persistence-unit name="testDatabase" transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <properties>
              <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
              <property name="hibernate.connection.username" value="sa" />
              <property name="hibernate.connection.password" value="" />
              <property name="hibernate.connection.url" value="jdbc:hsqldb:." />
              <property name="hibernate.connection.pool_size" value="1" />
              <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
              <property name="hibernate.hbm2ddl.auto" value="create-drop" />
              <property name="hibernate.show_sql" value="false" />
              <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
      </properties>
      </persistence-unit>
      



      Do you see something wrong with my configuration?

        • 1. Re: missing javax.ejb.SessionSynchronization
          Guillaume Jeudy Master

          this class is part of the EJB3 spec definition (its an interface), it looks like the class is loaded at seam startup you may have to add the related jar in your classpath it won't attempt to use it if you don't have the ejb-transaction component installed in your components.xml. You definitely don't want to install this component with a tomcat installation, so just a matter of adding the EJB3 API jar in your classpath.

          • 2. Re: missing javax.ejb.SessionSynchronization
            alberto Gori Novice

            Thanks. I added the jar and the stacktrace disappeared.
            Anyway I am getting the error of before (I didn't told you I was getting this error):



            java.lang.AssertionError: javax.el.ELException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
            



            This happens when I flush the session, after enabling manual flushing throught




            <begin-conversation join="true" flush-mode="manual"/>
            



            in pages.xml.


            I was wondering if this feature is possible with my configuration (no EJB).


            Furthermore the error doesn't come out the first time I flush the entitymanager, but it starts to happen after the second.


            Luckily test case is reporting the same problem.


            I don't know now if this is an hibernate misconfiguration or something related to flush-mode manual.



            My project (a very simple hello world) is accessible from SVN, if someone has time could give a look at http://svn2.assembla.com/svn/seam-tomcat6


            • 3. Re: missing javax.ejb.SessionSynchronization
              Pete Muir Master

              Take a look at the JPA example in Seam, it deploys without any EJB API jars to Tomcat.


              Also, try removing

              <transaction:ejb-transaction />

              from components.xml