Atomikos Forum |
|
I just wondered, if this issue (http://www.atomikos-support.com/forums/viewtopic.php?p=336) has been resolved in Atomikos version 3.3.2?
I've got a multi-module Maven project where each module has a couple of Unit/Component tests. When I try to run the test via maven I get a "cannot initialize AtomikosDataSourceBean: Another resource already exists with name XXX - pick a different name" I guess this is caused, since each module/test suite has its own Spring context and creates a new transaction manager. When I try to init and shutdown the UserTransactionServiceImp and delete the file as suggested in the above thread, I get a java.nio.channels.OverlappingFileLockException somewhere in UserTransactionServiceImp.createDefault(). What is the correct way to tearDown the transaction manager after a component test run to be able to start it up again for the next tests i.e. what do I have to do in the @BeforeClass, @AfterClass methods of each test? Thanks for your help!
Hi,
Yes, (http://www.atomikos-support.com/forums/viewtopic.php?p=336) has been fixed. For shutting down, just call shutdown on the UserTransactionServiceImp (but make sure to use the same instance as the one you inited on). Regarding the naming exception: please make sure to close any datasource(s) you create after each test. Also, try to reuse any JNDI Reference you get from the datasource. HTH |