hbwf / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 rnmi...@custco.biz on 23 Mar 2013 at 7:33

Attachments:

GoogleCodeExporter commented 9 years ago
Could you please open the issue here https://github.com/mybatis/guice ?

Original comment by eduardo.macarron on 26 Mar 2013 at 11:23

GoogleCodeExporter commented 9 years ago
Done. Issue #4:
https://github.com/mybatis/guice/issues/4

Thank you - Richard

-- 
Richard Mixon
Custom Computer Creations, L.L.C.
mobile: (480) 577-6834 office: (480) 614-3442
email: rnmixon@CustCo.biz <mailto:rnmixon@CustCo.biz>
Microsoft Partner ID: 1263725
The messages and documents transmitted with this notice contain
confidential information belonging to the sender. If you are not the
intended recipient of this information, you are hereby notified that any
disclosure, copying, distribution or use of the information is strictly
prohibited. If you have received this transmission in error, please notify
the sender immediately.

Original comment by rnmi...@custco.biz on 26 Mar 2013 at 8:07

GoogleCodeExporter commented 9 years ago
Are you looking to work with the rules of JNDI in Tomcat?
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
Does the example in section "Using resources"?

Error stack shows that failed to get JNDI resource.

Original comment by alexey.l...@gmail.com on 9 Apr 2013 at 8:19