Announcement Announcement Module
Collapse
No announcement yet.
Problem with configurate Spring and Hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with configurate Spring and Hibernate

    Hello

    I really need your help, I'm new in spring and hibernate, and I have a small problem

    I can't execute example from web: http://www.vaannila.com/spring/sprin...gration-1.html, the prev ex works fine and I can't configure Spring with Hibernate.


    Help!

    Error:

    javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:879)
    org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:662)


    root cause

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'viewResolver' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/convert/ConversionExecutorNotFoundException
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:483)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:412)
    java.security.AccessController.doPrivileged(Native Method)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:383)
    org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 76)
    org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:273 )
    org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:175)
    org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:485)
    org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:716)
    org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:377)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 27)
    org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:341 )
    org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:307)
    org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
    javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:879)
    org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:662)


    root cause

    java.lang.NoClassDefFoundError: org/springframework/core/convert/ConversionExecutorNotFoundException
    org.springframework.expression.spel.support.Standa rdEvaluationContext.<init>(StandardEvaluationConte xt.java:62)
    org.springframework.context.expression.StandardBea nExpressionResolver.evaluate(StandardBeanExpressio nResolver.java:117)
    org.springframework.beans.factory.support.Abstract BeanFactory.evaluateBeanDefinitionString(AbstractB eanFactory.java:1181)
    org.springframework.beans.factory.support.BeanDefi nitionValueResolver.evaluate(BeanDefinitionValueRe solver.java:211)
    org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:200)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1243)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1011)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:475)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:412)
    java.security.AccessController.doPrivileged(Native Method)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:383)
    org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 76)
    org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:273 )
    org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:175)
    org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:485)
    org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:716)
    org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:377)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 27)
    org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:341 )
    org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:307)
    org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
    javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:879)
    org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:662)

  • #2
    root cause

    java.lang.ClassNotFoundException: org.springframework.core.convert.ConversionExecuto rNotFoundException
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1438)
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1284)
    org.springframework.expression.spel.support.Standa rdEvaluationContext.<init>(StandardEvaluationConte xt.java:62)
    org.springframework.context.expression.StandardBea nExpressionResolver.evaluate(StandardBeanExpressio nResolver.java:117)
    org.springframework.beans.factory.support.Abstract BeanFactory.evaluateBeanDefinitionString(AbstractB eanFactory.java:1181)
    org.springframework.beans.factory.support.BeanDefi nitionValueResolver.evaluate(BeanDefinitionValueRe solver.java:211)
    org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:200)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1243)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1011)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:475)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:412)
    java.security.AccessController.doPrivileged(Native Method)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:383)
    org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 76)
    org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:273 )
    org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:175)
    org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:485)
    org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:716)
    org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:377)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 27)
    org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:341 )
    org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:307)
    org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
    javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:879)
    org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:662)




    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>SpringExample17</display-name>
    <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.htm</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>redirect.jsp</welcome-file>
    </welcome-file-list>
    </web-app>



    dispatcher-servlet.xml


    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.Intern alResourceViewResolver"
    prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

    <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/hibernatetutorial"/>
    <property name="username" value="root"/>
    <property name="password" value=""/>
    </bean>

    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="myDataSource" />
    <property name="annotatedClasses">
    <list>
    <value>com.vaannila.domain.User</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.hbm2ddl.auto">create</prop>
    </props>
    </property>
    </bean>

    <bean id="myUserDAO" class="com.vaannila.dao.UserDAOImpl">
    <property name="sessionFactory" ref="mySessionFactory"/>
    </bean>

    <bean name="/user/*.htm" class="com.vaannila.web.UserController" >
    <property name="userDAO" ref="myUserDAO" />
    </bean>

    </beans>



    Project structure:

    http://imageshack.us/photo/my-images/651/aaaju.jpg/

    Libs:

    http://imageshack.us/photo/my-images/847/bbbn.jpg/

    java classes the same like in tutorial

    Comment

    Working...
    X