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

  • SEARCH
  • Home
  • 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 8615927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:29:54+00:00 2026-06-12T05:29:54+00:00

I am getting the following error when trying to set the dataSource i am

  • 0

I am getting the following error when trying to set the dataSource i am using Spring 3.0 under is my code:

Error

520  [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR org.springframework.web.context.ContextLoader  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'countryDao' while setting bean property 'countryDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.crimetrack.jdbc.JdbcCountryDAO]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.crimetrack.jdbc.JdbcCountryDAO.<init>()

JdbcCountryDAO.java

@Repository
public class JdbcCountryDAO extends JdbcDaoSupport implements CountryDAO{

    private final Logger logger = Logger.getLogger(getClass());


    @Autowired
    JdbcCountryDAO(DataSource dataSource){
        setDataSource(dataSource);
    }

    public List<Country> getCountryList() {
        int countryId = 6;
        String countryCode = "AI";
        logger.debug("In getCountryList()");
        String sql = "SELECT * FROM TBLCOUNTRY WHERE countryId = ? AND countryCode = ?";
        logger.debug("Executing getCountryList String "+sql);

        Object[] parameters = new Object[] {countryId, countryCode};

        logger.info(sql);

        //List<Country> countryList = getJdbcTemplate().query(sql,new CountryMapper());

        List<Country> countryList = getJdbcTemplate().query(sql, parameters,new CountryMapper());
        return countryList;
    }

applicationContext.xml

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="${jdbc.driverClassName}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
    </bean>

  <bean id="countryManager" class="com.crimetrack.service.CountryManager">
        <property name="countryDao" ref="countryDao"/>
    </bean>
    <bean id="countryDao" class="com.crimetrack.jdbc.JdbcCountryDAO">
        <property name="dataSource" ref="dataSource"/>
    </bean>
  • 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-06-12T05:29:55+00:00Added an answer on June 12, 2026 at 5:29 am

    You need to do this:

    <bean id="countryDao" class="com.crimetrack.jdbc.JdbcCountryDAO">
        <constructor-arg index="0" ref="dataSource"/>
    </bean>
    

    The dataSource is not a property of JdbcCountryDAO class, it is a constructor argument. Spring says to you: No default constructor found, because this is not the default constructor:

    @Autowired
    JdbcCountryDAO(DataSource dataSource){
        setDataSource(dataSource);
    }
    

    It has a DataSource as an argument.

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

Sidebar

Related Questions

I am getting the following error when trying to check in my code: $>
I am getting the following authentication error when trying to access Twitter using my
I am trying to set SignalR up, but I keep getting the following error
I'm getting the following error when trying to produce an HTML page using Jade.
I am getting the following error when trying to Initialise the Module using Unity
I am trying to send email through gmail using PHPMailer_V5.1. Getting the following error,
When am trying to set default date and default sysdate am getting following errors:
Getting the following error when trying to start a session: Warning: session_start() [function.session-start]: Node
I am getting the following error when trying to save a file to disk:
I'm getting the following error when trying to delete objects in my database while

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.