Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Standalone JTA (Bitronix) + JPA (XA) JDBC + JPA JMS MDP (XA) ActiveMQ

  1. #11

    Default Certified tests you mean :-)

    Hi,

    OK we will check your tests - and if time allows we will even run our application certification program on the test suite - courtesy of the house :-)

    Expect something in the next few weeks (hopefully). End of year is always extra busy here... Poll me if needed.

  2. #12
    Join Date
    Jul 2006
    Posts
    6

    Arrow Final: Standalone JTA (Bitronix) + JDBC DAO / Hibernate DAO + JMS MDP ActiveMQ

    Attached is a final version of the example application containing the example configurations. It contains two different configurations - one using a JDBC DOA and one using a Hibernate DOA.

    It has been reviewed by the very new user friendly Bitronix folks. Ludovic Orban of the Bitronix project was very kind in reviewing the test methodology. He was also very patient and encouraging in explaining the nuances. He pointed out that yes the tests of rollback worked when throwing an exception in the original hibernate example, but because the datasource in the original hibernate configuration was not XA aware, there would be issues with recovery of the state of the system in the case of a crash. So it was a case of close but no cigar - it tested as safe from code throwing exceptions but not fully XA if one of the (possibly) distributed resources crashed.

    Other notes:

    1) bumped to the latest hibernate
    2) i had typo'ed the original title - i am using the native hibernate API not the hibernate JPA entitymanager
    3) fixed the junit tests to run the tests in a fresh application contexts such that all tests run sequentially okay in the one jvm
    4) downgraded the project output from war to jar
    Attached Files Attached Files

  3. #13
    Join Date
    Jun 2007
    Posts
    6

    Default

    For springjta1.0.zip, test with hibernate + JMS, I found that you are using BasicDataSource from DBCP but not PoolingDataSource from BTM.

    could you please explain the purpose of test-raw-pool-context.xml?

  4. #14
    Join Date
    Dec 2008
    Posts
    9

    Default

    Quote Originally Posted by kelvinlaw View Post
    For springjta1.0.zip, test with hibernate + JMS, I found that you are using BasicDataSource from DBCP but not PoolingDataSource from BTM.
    could you please explain the purpose of test-raw-pool-context.xml?
    Kelvin,

    I should have removed the raw pool test file. The actual context files to look at are in src/main/resources and those use the btm PoolingDataSource as expected. I have repackaged the zip file removing that spurious file. I have also added a new test and context file that tries out the Bitronix last resource commit feature for a non-xa-jdbc resource using hypersonic db. I have left the appropriate comment in the context file that there are caveats when using the last resource commit gambit.

    Simon
    Attached Files Attached Files

  5. #15

    Default

    An example of such configuration with JPA on top of Hibernate would be nice as well.

  6. #16
    Join Date
    Jan 2010
    Posts
    7

    Default

    thanks a lot for you effort, simbo1905

    we're now evaluating transaction managers (currently bitronix and atomikos) for a standalone app that will require JPA+JMS transactions.

    this thread has helped us a lot to solve some doubts we had integrating bitronix with spring. It's also quite good to know you had support from bitronix guys.

    thanks again.

  7. #17

    Default Working config with Atomikos

    Hi,

    Sorry for the delay, I had this ready in my workspace for a while but did't get to post it until now.

    Attached is the zip file with a working Atomikos config.

    Note: maven runs tests in parallel by default which causes setUp problems (Atomikos does check against parallel startups so the maven parallel setup default will not work). Use "mvn -DforkMode=once test" instead to run the tests.

    Re the application certification: if you tell me what you want to do then I can tell you if that is what I see in the logs.

    Cheers
    Happy 2010

    Guy
    Attached Files Attached Files

  8. #18
    Join Date
    Jan 2010
    Posts
    7

    Default

    this is great.
    now we have a full evaluation set of the most popular standalone TM's for our JTA tests. thank you all.

    just one more question about atomikos, if it's not asking too much.
    we're probably going to have to migrate from Hibernate JPA to Eclipselink.

    in order to make eclipselink JTA aware, it's needed to set the property target-server and provide a custom JTATransactionController
    class that returns a javax.transaction.TransactionManager when the method acquireTransactionManager() is called.

    could we just return a "new UserTransactionManager()" , just as it's done in the class com.atomikos.icatch.jta.hibernateTransactionManage rLookup for hibernate ?

    again thanks to both of you for your great help.
    it's really appreciated.

  9. #19

    Default Should be ok

    Hi,

    Constructing a new UserTransactionManager should be OK - at least at first sight. In 99% of all cases this works fine, as a rule of thumb.

    Best
    Guy

  10. #20
    Join Date
    Jan 2010
    Posts
    7

    Default

    well , thanks to your help we've been able to make EclipseLink JPA work with Atomikos and Spring, making it full JTA aware.
    right now I cannot post the full source code, because we've been using it to test and try lots of things, and it would be quite embarrasing

    These are the steps :

    1. Add these two properties to the EclipseLink factory Bean:
    Code:
    	
    <property name="jpaProperties">
    <props>
    ...
    ...
       <prop key="eclipselink.target-server">my.spring.jtatest.AtomikosTransactionSessionCustomizer</prop>
       <prop key="jdbc.exclusive-connection.mode">Transactional</prop>
    ...
    ...
       </props>
    </property>
    target-server is the name of the class that will return an Atomikos UserTransaction when EclipseLink calls its method "acquireTransactionManager".

    2. TransactionSessionCustomizer class
    Code:
    package my.spring.jtatest;
    
    public class AtomikosTransactionSessionCustomizer extends JTATransactionController {
    
    
    @Override
      protected TransactionManager acquireTransactionManager() throws Exception {
    
    
    	        Class<?> clazz = Class.forName("com.atomikos.icatch.jta.UserTransactionManager");
                 
    	        return (TransactionManager) clazz.newInstance();
    
    	    }
    
    }
    3. Modify persistence.xml transaction-type to "JTA"
    Code:
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    
      <persistence-unit name="SpringJpaTest" transaction-type="JTA">
    	<jta-data-source>jdbc/MyDB2DB</jta-data-source>
    </persistence-unit>
    	
    </persistence>
    We had to add a dummy jta-data-source. Eclipselink complains if transaction-type is set to "JTA" and no jta-data-source is defined.
    It seems that the name doesn't matter. Our datasource is not named jdbc/MyDB2DB and it still works.


    Now we're trying to configure it with Bitronix. If we're sucessful i will post the results.

    again, thanks simon1905 and GuyPardon.
    without your help we couldn't have done it.
    Last edited by nestochi; Jan 14th, 2010 at 11:06 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •