0

When I configure my spring project to use Mybatis, I added the following to the applicationContext.xml

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Mybatis Configuration -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mapperLocations" value="classpath*:com/foo/bar/**/*Mapper.xml" />
    <property name="configLocation" value="classpath:mybatis/mybatis-config.xml"/>
</bean>

<mybatis:scan base-package="com.foo.bar" annotation="com.foo.bar.mybatis.Mapper" />

and get the following red X on the file:

Error occured processing XML 'loader constraint violation: when resolving field "logger" the class loader (instance of org/springframework/ide/eclipse/core/java/ProjectClassLoaderCache$FilteringURLClassLoader) of the referring class, org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for the field's resolved type, org/apache/commons/logging/Log, have different Class objects for that type'.

When I search for this online I can only seem to find an instance where someone had issues after a release of an update to spring which was later fixed. Can someone give me some indication as to what precisely this is implying and how to fix it? (This does not stop the project from building or using MyBatis, everything seems to function, I just want to clean up the markers in my project)

Ginto Hewoo
  • 73
  • 1
  • 1
  • 8
  • Provide information about your Spring version, MyBatis version and build tool you are using in your project. – Martin Strejc Nov 07 '13 at 07:07
  • my apologies: Spring 3.2.3, MyBatis 3.1.1, I am using STS/maven. – Ginto Hewoo Nov 07 '13 at 20:30
  • Did you try update to 3.1.4 or 3.2.5? – Martin Strejc Nov 09 '13 at 12:02
  • I have updated MyBatis to 3.2.3 with no change in results. – Ginto Hewoo Nov 09 '13 at 19:37
  • The problem looks it is belong the dependency injection in Spring, I recommend upgrade the Spring rather than MyBatis. – Martin Strejc Nov 09 '13 at 20:39
  • I have now updated both and the same problem remains. I feel like it is a configuration issue or that there is another similar issue with the setup that I may be overlooking that this error should be pointing to. I appreciate everyone's help and input on this and hope that someone can help me figure it out soon as I am at a bit of a loss. – Ginto Hewoo Nov 12 '13 at 16:03

0 Answers0