Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:04:32+00:00 2026-05-23T20:04:32+00:00

I’m trying to setup a TransactionManager in my Web Application (powered by Spring MVC

  • 0

I’m trying to setup a TransactionManager in my Web Application (powered by Spring MVC 3), as I need to have one method of a component annotated as @Transactional.

This is my situation:

  • web.xml: load 2 xml files for the Spring ContextLoaderListener (applicationContext.xml and database.xml)
  • applicationContext.xml: contains some beans which I can’t define via annotation, plus the tags for annotation, plus the usual context:annotation-config and context:component-scan (this component-scan includes the package that contains the @Transactional method)
  • database.xml: contains the datasource (I’m using BasicDataSource from commons-dbcp), the transaction manager definition and tx:annotation-driven.

I’ve got a @Component (DeleteComponent) which has an interface and an implementation (DeleteComponentImpl). The implementation class is annotated with @Component and has one public method annotated with @Transactional (I annotated the concrete class and not the interface, as Spring documentation states). For @Transactional I didn’t put any arguments, as defaults are fine. This class has some DAOs (annotated with @Repository) being injected via @Autowired. I’m using only plain JDBC (no Hibernate or other ORM). This @Component is injected into a @Controller (which is defined in spring-servlet.xml).

If the method annotated as @Transactional throws an exception (unchecked, as RuntimeException), however, nothing is rolled back. The database retains the changes did before the exception. I’m using Jetty web server for testing locally my application. The thing I noticed is actually that seems like no transaction manager is being set up. Actually, my transaction manager is named transactionManager. The xml line to set up the annotation-driven transaction is

<tx:annotation-driven transaction-manager="transactionManager"/>

<bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
</bean>

If I change it to use a non-existing bean name like

<tx:annotation-driven transaction-manager="fake"/>

The application still deploys correctly and doesn’t complain.

Any tips on what should I check to make it working?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:04:34+00:00Added an answer on May 23, 2026 at 8:04 pm

    I solved by using @Transactional(rollbackFor = RuntimeException.class) and switching from a BasicDataSource to a ComboPooled that’s present in c3p0 library. Thanks for the suggestions though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.