this is my first mybatis spring mvc application using spring 3.2.4, mybatis-spring-1.2.1
When i try to call my webservice i get the error::
org.spri
I have also encountered this problem in my development. In generall, if you are using xml configuration files for spring,myBatis and etc., then this problem is mostly caused by some mistake in your xml configuration files.
The most voted answer by Dariusz demonstrated that there maybe some problems in the myBatis xml configuration file, while in my case, I found that problems in spring xml configuration file can also result in this problem.
In the situation of this post, in the applicationContext.xml(which should be a configuration file of Spring), we can see a basePackage configuration for the MapperScannerConfigurer:
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="org.mydomain.formulary.mappers" />
</bean>
so if the value for this property is wrong(the package name is not right), it will also result in this problem.
In my case it was a typo error in the id of the mapper xml statement e.g.
<select id="getDtaa" resultType="Data">
List<T> getData()
After changing the id in the XML to the correct function name it worked.
in the spring configuration, taking a xml way for example, make sure that the mapper.xml files are located at the place assigned as the value of the property named mapperLocations
. Once I had it at mappers/anotherfolder/*.xml. And that causes the pain.
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliasesPackage" value="somepackage.model"/>
<property name="mapperLocations" value="classpath*:mappers/*.xml"/>
</bean>
Except for @Dariusz mentioned above, I've also forgotten to add mapper location.
<property name="mapperLocations" value="classpath:mybatis/mappers/*.xml"/>
Check if there is any overload method in mapper. Try to use a separate name instead.