Results 1 to 4 of 4

Thread: BeanCreationException

  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Default BeanCreationException

    Hi ,
    ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Module.xml");
    AccountDao customerDAO = (AccountDao) context.getBean("accountDAO");

    Spring-Module.xml
    <import resource="/Spring-Datasource.xml" />
    <import resource="/Spring-Customer.xml" />

    Spring-Customer.xml
    <bean id="accountDAO" class="com.raghu.spring3.controller.AccountDaoImpl ">
    <property name="dataSource" ref="dataSource" />
    </bean>

    Spring-Datasource.xml
    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">

    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/test" />
    <property name="username" value="root" />
    <property name="password" value="root" />
    </bean>

    May i know why i am getting following error

    org.springframework.web.util.NestedServletExceptio n: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in class path resource [com/spring3/controller/context.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:656)
    org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
    javax.serv

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Please use [ code][./code ] tags when posting code that way it remains readable...

    Have you read the stacktrace?!

    Code:
    java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
    You are missing the commons-pool.jar in your dependencies.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jan 2013
    Posts
    2

    Default

    Still i am getting same problem even i added commons-pool.jar



    Quote Originally Posted by Marten Deinum View Post
    Please use [ code][./code ] tags when posting code that way it remains readable...

    Have you read the stacktrace?!

    Code:
    java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
    You are missing the commons-pool.jar in your dependencies.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    I doubt it is the same error... Make sure you use a recent version.

    I strongly suggest you start using a framework like maven or gradle to manage your dependencies instead of hunting around the internet for your own.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •