I am working on an Eclipse 3.7 RCP application with multiple modules. Module A is a collection of libraries, including mybatis-3.2.2.jar. Module B depends on module A (Require-Bundle in the .mf manifest) and has code that uses MyBatis to access data in the database. I exported packages with the mapper and XML classes to module B and imported them into module A. I create SqlSessionFactory in the code and it works fine if I add all the Mapper classes by name, for example.
configuration.addMapper(MyMapper.class);
however, when I try to add all the mappers to the package:
configuration.addMappers(MyMapper.class.getPackage().getName());
MyBatis does not see them.
I tried changing the default class loader, but that didn't help.
Resources.setDefaultClassLoader(this.getClass().getClassLoader());
I suspect the problem is with class visibility in OSGI. If so, are there any ways to fix it in the application?