We don't have Spring experience, but
the beans dtd's don't look to us like they would load the jotm class library.
The fact that the transaction manager
was not null does not demonstrate that it was the correct object. Can
you print the transaction manager object
stored in transactionManager to see what class it oringinates from?
-- David E.
"Stefan Arentz" <stefan.arentz@xxxxxxxxx>
wrote on 10/05/2006 10:17:25 AM:
> I'm trying to create a simple unit test with Spring and JOTM but
> TransactionManager.getTransaction() always returns null.
>
> The Spring context for this test looks like this:
>
> <beans>
> <bean id="jotm" class="org.springframework.transaction.jta.
> JotmFactoryBean"/>
>
> <bean id="transactionManager"
> class="org.springframework.transaction.jta.JtaTransactionManager">
> <property name="userTransaction">
> <ref local="jotm"/>
> </property>
> </bean>
> </beans>
>
> And the test like this:
>
> public class MyTest extends AbstractDependencyInjectionSpringContextTests
> {
> private TransactionManager transactionManager;
>
> public void setTransactionManager(TransactionManager
transactionManager)
> {
> this.transactionManager = transactionManager;
> }
>
> //
>
> protected String[] getConfigLocations()
> {
> return new String[] { "classpath:com/test/MyTest-spring.xml"
};
> }
>
> //
>
> public void testInfrastructure()
> {
> assertNotNull(transactionManager);
> }
>
> //
>
> public void testGetTransaction() throws SystemException
> {
> Transaction transaction = transactionManager.getTransaction();
> assertNotNull(transaction);
> }
> }
>
> The transactionManager seem to be setup ok since it is not null, but
> the second test actually get a transaction always fails with
> transaction being null.
>
> The log only shows some INFO stuff about JOTM, nothing about problems.
>
> S.
>
>
> --
> You receive this message as a subscriber of the jotm@xxxxxxxxxxxxx
> mailing list.
> To unsubscribe: mailto:jotm-unsubscribe@xxxxxxxxxxxxx
> For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws