spring - bitronix transaction manager -
i'm trying migrate jpa jta , use bitronix transaction manager. i'm getting below error message when try run unit tests. according bitronix documentation normal b/c spring context configuration trying load resources twice (once in base class , in test class, see code below), have tried same atomikos , got similar result.
caused by: java.lang.illegalargumentexception: resource uniquename 'xyzdb' has been registered
my base class
@contextconfiguration(locations = {"classpath:com/xyz/basecontext.xml"}) @transactional public abstract class abstracttestsupport extends assert implements applicationcontextaware {
in unit tests have extend test support , add context config file below. loads context once base class , time child class , fails
child class
@contextconfiguration(locations = {"classpath:com/xyz/testcontext.xml"}) public class unittest extends abstracttestsupport {
after test i'm shutting down context, next test works fine long doesn't extend base class context config file.
@afterclass public static void onteardownafterclass() throws exception { applicationcontext.shutdownapplicationcontext(); assertfalse("spring application context still active after shutdown. ", applicationcontext.isactive()); }
i want keep context config files in child classes , make work that, ideas appreciated....
the error message means created connection pool unique name 'xyzdb' (remember there uniquename property need set on btm's pools?) second time @ time exception thrown. cannot that: each connection pool must have unique name , must closed before 1 identical name can created.
i suppose there overlap between 2 context files causing or maybe connections pools aren't closed should. unfortunately published little information definitive answer.
Comments
Post a Comment