error between mybatis 3.0.5 and newer version (>3.1.0)

378 views
Skip to first unread message

matpil

unread,
Sep 24, 2013, 8:11:35 AM9/24/13
to mybati...@googlegroups.com
Hi,
I'd like to update mybatis (and mybatis-spring) version from 3.0.5 to the last 3.2.2 but I've an issue on my working mapper.

error is:

....
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [com/myApp/context/service-context.xml]: 
Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/myApp/context/service-context.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/base/myApp-1.7.9-alpha-3.jar!/dao/mybatis/maps/myApp/__myAppMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: No typehandler found for mapping value
 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        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:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:398)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:594)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)



I've try to update with jar version 3.1.1, 3.2.0, 3.2.2, and 3.2.3-SNAPSHOT.

Is new version not backward compatible???


thanks in advance

Regards

Eduardo Macarron

unread,
Sep 24, 2013, 12:39:40 PM9/24/13
to mybati...@googlegroups.com
It is backward compatible. This can be a bug in newer version or you can have a wrong mapping that new versions are able to detect and olders don't.

Have a look at __myAppMapper and that "value" to see if there is something wrong with it.




2013/9/24 matpil <mat...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

matpil

unread,
Sep 25, 2013, 5:18:04 AM9/25/13
to mybati...@googlegroups.com
Thanks for your reply!

The result map that I use is:

<resultMap id="RateDaFatturareMap" type="java.util.Map">
   <result column="METODO" jdbcType="VARCHAR" property="key" />

  <collection column="IMF.CD_ORDINE" 
      property="value"
      javaType="java.util.List"
      ofType="String">
     <result column="IBAN" jdbcType="VARCHAR" property="value" />
  </collection>

</resultMap>

and with myBatis 3.0.5 works fine.

It could be a bug in newer version?

Regards
--
matpil

Eduardo Macarron

unread,
Sep 25, 2013, 12:17:06 PM9/25/13
to mybati...@googlegroups.com
I will try to reproduce it and tell you something. 


2013/9/25 matpil <mat...@gmail.com>

Eduardo Macarron

unread,
Sep 25, 2013, 4:13:09 PM9/25/13
to mybati...@googlegroups.com
The point is that 3.2.2 is trying to discover the type "value" of the class "String" and it happens that String has a property named "value" of the type char[] and there is not a default handler for it so 3.2.2 points that there is something wrong here. Probably 3.0 is just ignoring this and works by chance.

Note that there is not any property named "value" in your objects so the right mapping is:

It works like this:
  <collection column="IMF.CD_ORDINE" 
      property="value"
      javaType="java.util.List"
      ofType="String">
     <result column="IBAN" jdbcType="VARCHAR"  />
  </collection>


2013/9/25 Eduardo Macarron <eduardo....@gmail.com>

matpil

unread,
Sep 26, 2013, 12:27:24 PM9/26/13
to mybati...@googlegroups.com
thx for your help.
I'll try asap this solution!

Regards.
--
matpil
Reply all
Reply to author
Forward
0 new messages