Announcement Announcement Module
Collapse
No announcement yet.
BeanCreationException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


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



      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.

      Comment


      • #4
        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.

        Comment

        Working...
        X