Hi folks,

This is my first thread in Spring Framework and I am new to it . While creating a web app in Spring framework I cannot deploy it as it contains few errors. I couldnot resolve. So i seek help from you . . Bean creation exception is the one i got.
System specification : winxp, glassfish server , netbeans IDE
Stacktrace is

INFO: PWC1412: WebModule[/SpringDemo] ServletContext.log():Initializing Spring root WebApplicationContext
INFO: Root WebApplicationContext: initialization started
INFO: Refreshing Root WebApplicationContext: startup date [Tue Sep 28 12:27:41 IST 2010]; root of context hierarchy
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/springDemo-servlet.xml]
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e919dd: defining beans [userDataSource,userHibernateProperties,userSessionFactory,addEditUserController,urlMapping,viewResolver,userDAO,userService]; root of factory hierarchy
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e919dd: defining beans [userDataSource,userHibernateProperties,userSessionFactory,addEditUserController,urlMapping,viewResolver,userDAO,userService]; root of factory hierarchy
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDataSource' defined in ServletContext resource [/WEB-INF/springDemo-servlet.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:955)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:901)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4664)
        at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:535)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5266)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619)
        at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getDeclaredConstructor(Class.java:1985)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:64)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:948)
        ... 54 more

and my web.xml is

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>/WEB-INF/springDemo-servlet.xml</param-value>
    </context-param>

    <servlet>
        <servlet-name>context</servlet-name>
        <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
   </servlet>

  <servlet>
        <servlet-name>springDemo</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
 </servlet>

 <servlet-mapping>
     <servlet-name>springDemo</servlet-name>
     <url-pattern>*.htm</url-pattern>
     
 </servlet-mapping>
  <jsp-config>
      <taglib>
    <taglib-uri>/spring</taglib-uri>
    <taglib-location>/WEB-INF/spring.tld</taglib-location>
    </taglib>
    </jsp-config>

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>redirect.jsp</welcome-file>
    </welcome-file-list>
</web-app>

my []-servlet.xml is

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="userDataSource" class="org.apache.commons.dbcp.BasicDataSource">
     <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
         <property name="url"><value>jdbc:mysql://localhost/springdemo</value></property>
         <property name="username"><value>root</value></property>
     <property name="password"><value>password</value></property>
</bean>

 <!-- Database Property -->
<bean id="userHibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
     <property name="properties">
         <props>
             <prop key="hibernate.hbm2ddl.auto">update</prop>
             <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.query.substitutions">true 'T', false 'F'</prop>
             <prop key="hibernate.show_sql">true</prop>
             <prop key="hibernate.c3p0.minPoolSize">5</prop>
             <prop key="hibernate.c3p0.maxPoolSize">20</prop>
             <prop key="hibernate.c3p0.timeout">600</prop>
             <prop key="hibernate.c3p0.max_statement">50</prop>
             <prop key="hibernate.c3p0.testConnectionOnCheckout">false</prop>
         </props>
     </property>
</bean>

   <!-- Hibernate SessionFactory -->
<bean id="userSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
     <property name="dataSource"><ref local="userDataSource"/></property>
     <property name="hibernateProperties"><ref bean="userHibernateProperties" /></property>

     <!--  OR mapping files. -->
     <property name="mappingResources">
         <list>
             <value>com/simpleweb/user/bean/User.hbm.xml</value>
         </list>
     </property>
</bean>
<bean id="addEditUserController" class="com.simpleweb.user.controller.AddEditUserController"/>

     <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
         <property name="mappings">
             <props>
                 <prop key ="/addedituser.htm">addEditUserController</prop>
             </props>
         </property>
     </bean>
    

     <bean id="viewResolver" class = "org.springframework.web.servlet.view.InternalResourceViewResolver">
     <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
     <property name ="prefix"><value>/com/simpleweb/user/pages/</value></property>
     <property name ="suffix"><value>.jsp</value></property>
    </bean>
    <bean id="userDAO" class="com.simpleweb.user.dao.UserDAOImpl">
    <property name="sessionFactory" ref="userSessionFactory" />
    </bean>

    <bean id="userService" class="com.simpleweb.user.services.UserServiceImpl">
            <property name="userDAO" ref="userDAO" />
    </bean>




</beans>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.