Am trying to use mybatis-guice library.

Here is some code.

//to create an injector

Injector injector = Guice.createInjector(new GuiceModule(), new
XMLMyBatisModule.Builder().setEnvironmentId("test").create();

//to get a mapper instance
JobMapper jobMapper = getInjector().getInstance(JobMapper.class);

running calling a method on the mapper , i get the following error:

-------------------------------------------------------------------------------
Test set: com.dg.lsys.test.JobMapperTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.501 sec
<<< FAILURE!
testGetLatestJobs(com.dg.lsys.test.JobMapperTest)  Time elapsed: 0.472 sec
<<< ERROR!
java.lang.NoSuchMethodError:
com.google.inject.util.Providers.guicify(Ljavax/inject/Provider;)Lcom/google/inject/Provider;
        at org.mybatis.guice.EachMapper.bindMapper(EachMapper.java:43)
        at org.mybatis.guice.EachMapper.doHandle(EachMapper.java:39)
        at org.mybatis.guice.EachMapper.doHandle(EachMapper.java:29)
        at
org.mybatis.guice.iterables.$ItemHandler.handle(ItemHandler.java:37)
        at
org.mybatis.guice.XMLMyBatisModule.configure(XMLMyBatisModule.java:92)
        at
com.google.inject.AbstractModule.configure(AbstractModule.java:59)
        at
com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
        at com.google.inject.spi.Elements.getElements(Elements.java:101)
        at
com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
        at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:115)
        at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:100)
        at com.google.inject.Guice.createInjector(Guice.java:95)
        at com.google.inject.Guice.createInjector(Guice.java:72)
        at com.google.inject.Guice.createInjector(Guice.java:61)
        at
com.dg.lsys.test.AbstractBaseTest.getInjector(AbstractBaseTest.java:42)
        at
com.dg.lsys.test.AbstractBaseTest.getConnection(AbstractBaseTest.java:48)
        at
org.dbunit.DatabaseTestCase.newDatabaseTester(DatabaseTestCase.java:85)
        at
org.dbunit.DatabaseTestCase.getDatabaseTester(DatabaseTestCase.java:109)
        at org.dbunit.DatabaseTestCase.setUp(DatabaseTestCase.java:151)
        at junit.framework.TestCase.runBare(TestCase.java:132)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
        at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


I am not sure if its a guice or mybatis-guice problem. So i have posted on
both forums.


Where could i be going wrong?

Kind regards.
Josh.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to