3 Replies Latest reply on Jun 30, 2007 12:19 PM by Flush

    Multiple persistence units (one JTA one RESOURCE_LOCAL) fail

    Flush Newbie

      Hi, I created a persistence.xml file with the definition of two persistence units: one with JTA (for EE components) and one with RESOURCE_LOCAL (for JUnit testing). When deploying the application fails saying that I didn't define a non-jta-data-source for the RESOURCE_LOCAL, but the fact is that since this p.u is for JUnit I didn't define a datasource at all, but just properties to connect to the database.

      This issue deemed to be already resolved in 4.2.0-CR2, as stated here:


      However I'm running 4.2.0-GA and it's still there.

        • 2. Re: Multiple persistence units (one JTA one RESOURCE_LOCAL)
          Brian McGovern Newbie

          Mtedone1, I don't have an answer for you, but can you post your xml regarding JTA, I cannot get JTA working right on 4.2.0. Specifically I cannot seem to lookup TransactionManager from JNDI. I can get UserTransaction from JNDI, but when I do, the expected Transactional behavior simply doesn't work. THe system operates like there is no transaction running and i get partial commits.

          Using UserTransaction I get a warning in the logs, but not an error : JTA cannot find TransactionManager, JTA will not be able to syncronize with existing JTA transactions.

          So I think the root cause is something with JNDI and TransactionManger. Please paste your configs.


          • 3. Re: Multiple persistence units (one JTA one RESOURCE_LOCAL)
            Flush Newbie


            <?xml version="1.0" encoding="UTF-8"?>
            <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
             <persistence-unit name="jemos-ejb3-test" transaction-type="JTA">
             <property name="hibernate.hbm2ddl.auto" value="update"/>
             <property name="hibernate.show_sql" value="true" />
             <persistence-unit name="jemos-ejb3-test-junit" transaction-type="RESOURCE_LOCAL">
             <property name="hibernate.hbm2ddl.auto" value="update"/>
             <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
             <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
             <property name="hibernate.connection.username" value="user"/>
             <property name="hibernate.connection.password" value="password"/>
             <property name="hibernate.connection.url" value="jdbc:mysql://localhost/test"/>