Announcement Announcement Module
Collapse
No announcement yet.
Trying to use hibernate in Spring Web Flow Project.. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to use hibernate in Spring Web Flow Project..

    I am trying to use hibernate in a Spring Web Flow Porject but I am getting the following error:

    Here is my database.xml file:
    <?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:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"

    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/schem...ontext-3.0.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schem...ing-tx-3.0.xsd
    http://www.springframework.org/schema/jdbc
    http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">



    <contextroperty-placeholder location="classpath:jdbc.properties" />

    <context:component-scan base-package="org.uftwf" />

    <tx:annotation-driven transaction-manager="hibernateTransactionManager"/>

    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${database.driver}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.user}" />
    <property name="password" value="${database.password}" />
    <property name="timeBetweenEvictionRunsMillis" value="300000" />
    <property name="numTestsPerEvictionRun" value="6" />
    <property name="minEvictableIdleTimeMillis" value="1800000" />
    <property name="initialSize" value="3" />
    <property name="maxActive" value="10" />
    <property name="maxIdle" value="10" />
    <property name="maxWait" value="5000" />
    <property name="poolPreparedStatements" value="true" />
    <property name="maxOpenPreparedStatements" value="100" />
    </bean>

    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="annotatedClasses">
    <list>
    <value>org.uftwf.schoolvisit.model.VisitModel</value>
    </list>
    </property>

    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
    </props>
    </property>
    </bean>

    <bean id="hibernateTransactionManager"
    class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    </beans>


    Here is my error: can someone please tell me why

    2012-08-28 13:20:08,222 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'database': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private org.hibernate.SessionFactory org.uftwf.schoolvisit.database.DatabaseImpl.sessio nFactory; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring/database.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 287)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1106)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)
    at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationContext(ContextLoader .java:385)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:284)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 111)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4791)
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:5285)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:618)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:650)
    at org.apache.catalina.startup.HostConfig$DeployDescr iptor.run(HostConfig.java:1582)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
Working...
X