Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

MyBatis-Guice multiple datasource configuration does not work with JNDI datasources #799

@GoogleCodeExporter

Description

@GoogleCodeExporter
Is it expected that JNDI datasources should work using the Multiple Datasources 
configuration advice given at
  http://mybatis.github.com/guice/core.html
??

We spent a great deal of time reading doc and forums - both before and after we 
encountered the problem described below - but could find nothing related.

We needed to add an additional datasource to the application that has been 
running fine with a single JNDI connection configured using the MyBatisModule 
directly.

When we used a PrivateModule to wrap each of our MyBatisModules for the two 
datasources we get the message:
  null returned by binding at org.mybatis.guice.MyBatisModule.bindDataSourceProviderType(MyBatisModule.java:215) ... while locating javax.sql.DataSource

After tracing and checking for hours, we finally got this to work by using 
direct JDBC with the PooledDataSourceProvider.class. 

I've attached three files:
 - the log from Tomcat showing the detailed exceptions we get.
 - The AppListener module configured with JNDI that fails.
 - The AppListener module configured with direct JDBC

The two modules are identical except for the lines I've commented out by each. 
A quick diff will show.

Thank you.

Original issue reported on code.google.com by [email protected] on 23 Mar 2013 at 7:33

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions