Quantcast

Bean named 'sqlSessionFactory' must be of type org.mybatis.spring.SqlSessionFactoryBean

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Bean named 'sqlSessionFactory' must be of type org.mybatis.spring.SqlSessionFactoryBean

sreedhar
This post has NOT been accepted by the mailing list yet.
Hi,


   I am getting the following exception.
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'sqlSessionFactory' must be of type [org.mybatis.spring.SqlSessionFactoryBean], but was actually of type [org.apache.ibatis.session.defaults.DefaultSqlSessionFactory]

  I configured sqlSessionFactory bean in applicationContext.xml like the following way.

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close" p:driverClass="com.mysql.jdbc.Driver"
    p:jdbcUrl="jdbc:mysql://localhost:3306/test" p:user="root" p:password="root"/>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:sqlmap-config.xml" />
/bean>


  I am using the following versions.
  mybatis-3.0.5
  mybatis-spring-1.0.1
  spring-3.0.5

 I want  SqlSessionFactoryBean instance but it  is giving DefaultSqlSessionFactory instance.

 Please help me any one to slove this issue.

  Thanks,
 Sreedhar.
Loading...