"Type interface is not known to the MapperRegistry" exception using mybatis

ripper234 picture ripper234 · Nov 24, 2010 · Viewed 42.4k times · Source

I'm setting up mybatis using annotations, and getting this helpful exception

org.apache.ibatis.binding.BindingException: Type interface org.foo.Bar is not known to the MapperRegistry

Googling it doesn't find anything, nor the user guide. What am I missing?

Answer

dolbysurnd picture dolbysurnd · Nov 16, 2012

just for anyone who ended up here because they're new to mybatis http://www.mybatis.org/core/configuration.html
http://www.mybatis.org/mybatis-3/configuration.html

in the config file mappers section

<mappers>
<mapper class="my.package.com.MyClass"/>
</mappers>

this will have you up and running with a config.xml and annotated interfaces