Announcement Announcement Module
Collapse
No announcement yet.
Exception in spring - hibernate session factory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception in spring - hibernate session factory

    Hi

    Let me know what should i have to do ,


    my applicationContext.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName">
    <value>COM.ibm.db2.jdbc.net.DB2Driver</value>
    </property>
    <property name="url">
    <value>jdbc:db2//punapp170:6789/inst1</value>
    </property>
    <property name="username">
    <value>db2srv</value>
    </property>
    <property name="password">
    <value>Db2srv310</value>
    </property>
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean" >
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">net.sf.hibernate.dialect.D B2Dialect</prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/kec/manheim/asmt/employee/model/hibernate/EmpSnrao.hbm.xml</value>
    </list>
    </property>
    </bean>

    <bean id="dao" class="com.kec.manheim.asmt.employee.model.hiberna te.Hibernate2BaseDAO">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="employeeDAO" class="com.kec.manheim.asmt.employee.model.hiberna te.EmployeeHibernateDAO">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    </beans>


    i am getting an exception in the tomcat log

    2005-12-20 12:22:43 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRul e: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterR ule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingR ule: Redirect URL: http://jakarta.apache.org]]
    2005-12-20 12:23:28 StandardContext[/Employee_Asmt]Loading Spring root WebApplicationContext
    2005-12-20 12:23:32 StandardContext[/Employee_Asmt]Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dao' defined in ServletContext resource [/WEB-INF/config/applicationContext-hibernate.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptions Exception: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [net.sf.hibernate.impl.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] for property 'sessionFactory']
    PropertyAccessExceptionsException (1 errors)
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [net.sf.hibernate.impl.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] for property 'sessionFactory'
    at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWrapperImpl.java:1103)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:848)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:733)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:890)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.java:917)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.java:906)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1022)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:823)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:345)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:275)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:318)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:230)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:156)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 48)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3827)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4343)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:823)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:807)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:595)
    at org.apache.catalina.core.StandardHostDeployer.inst all(StandardHostDeployer.java:277)
    at org.apache.catalina.core.StandardHost.install(Stan dardHost.java:832)
    at org.apache.catalina.startup.HostConfig.deployDirec tories(HostConfig.java:701)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:432)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:983)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:349)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1091)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:789)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1083)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:480)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:2313)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:287)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:425)

    2005-12-20 12:23:32 StandardContext[/Employee_Asmt]Closing Spring root WebApplicationContext
    2005-12-20 12:23:33 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2005-12-20 12:23:33 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2005-12-20 12:23:33 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2005-12-20 12:23:33 StandardContext[/servlets-examples]SessionListener: contextInitialized()

    Advance in Thanks

    SN RAo

  • #2
    You are mixing hb2 with hb3:
    Failed to convert property value of type [net.sf.hibernate.impl.SessionFactoryImpl] to required type [org.hibernate.SessionFactory]
    net.sf.hibernate = hb2
    org.hibernate = hb3.

    Comment

    Working...
    X