Profiling the commit problem in Spring JDBCTemplate

Spring’s JdbcTemplate simplifies the usage of jdbc and also provides callbacks to create and execute callable statements.

Problem :
For a single sign on project using jasig-cas framework is well known choice to adopt all web based applications. This framework also provides authentcation-extensions to develop custom authentication handlers.

For ticket persistency, jpa transaction manager is configured and the jdbc authentication handler uses a stored procedure and does not commit to database if you are using ticket jpa transaction manager.

Solution :
William Louth who is the founder, CTO of Jinspired and creator of JxInsight always saves my life. For that kind of a problem installing and enabling the transaction analysis is enough to see jdbc low level instrumentations.
Firstly configure jxinsight for tracing jdbc calls, and replace jdbc urls with the jxinsight urls according to manual.

After the configuration, reset jxisnight and try to login from CAS-Login page. In the picture below, the arrow shows that there is rollback and from the jxinsight’s stack table (not in the picture) it is very easy to understand that it is for tomcat’s validation query.

Right now the question is where is commit or rollback for the stored procedures. The problem begins here. JPATransactionManager is not controlling jdbcTemplate. This means that  adding one more transaction manager to applicationContext. The first transaction manager is controlling the tickets and the second one is controlling our  jdbc authentication handler. This fixes our commit problem.

Hiç yorum yok: