I seem to have a problem with spring annotation-driven transaction managing and tomcat. These are some of the beans I use in my project:
<bean id="dataSource" class="service.myBatis.RoutingDataSource"> </bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
Everything works fine when i run the project in eclipse. But when i run the project in tomcat it doens't get past the creation of beans. It also does not give me an error or any indication of what is wrong.
The log shows it finishes with instantiating a bean and then it suddenly destroys all beans:
[DEBUG] 12 jul 09:28:55.888 AM localhost-startStop-1 [org.springframework.beans.factory.support.DefaultListableBeanFactory]
Finished creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor'
[INFO] 12 jul 09:28:55.895 AM localhost-startStop-1 [org.springframework.beans.factory.support.DefaultListableBeanFactory]
Destroying singletons in........
If i remove the <tx:annotation-driven transaction-manager="transactionManager" />
line the project will just startup normaly in tomcat and eclipse.
Usually if something works in eclipse and it doesn't in tomcat it is caused by tomcat not finding some class/lib or resource. I have no idea what is causing this though
Could anyone tell me what the problem is? Why does it destroy all the beans without giving an error?
I figured it out. It was not spring that was causing the problems it was something else in my project. The error was put in some tomcat log instead of to the console. So it seemed like there was no error.