|connecting an application to two different JNDI datasources [message #634742]
||Fri, 22 October 2010 22:47
| Patricia Goldweic
Registered: October 2010
I'm trying to configure a Java SE app running under Tomcat 6 and using JPA, to connect to two different JNDI datasources. I've followed the instructions in the article at http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_ Tutorial#JNDI_Datasource_Setup, but I'm defining two of each (2 'resource-ref' and 'persistence-context-ref' elements in web.xml, 2 different <resource> elements within the GlobalNamingResources tag in server.xml, and also 2 <resource-link> elements within the Context element in server.xml). However, when I run the program, only one of the data sources (the first one tried) is connected and deployed successfully, while the other one fails to connect with the following exception: |
[EL Severe]: 2010-10-22 16:20:22.16--ServerSession(10202447)--Thread(Thread[http-868 6-1,5,main])--Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlExce ption(DatabaseException.java:309)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIC onnector.java:138)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIC onnector.java:94)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDa tasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connectInternal(DatasourceAccessor.java:327)
NOTE: there is authentication and driver information defined for BOTH datasources in the Tomcat file, so this cannot be the real problem. Moreover, I've seen that one of the databases actually ended up, at some point during my experimentation, with tables that correspond to the *other* database.
So, the basic question is: can we actually use eclipselink for an app that needs to connect to 2 distinct datasources? If so, how do you get this to work? Thanks in advance for any suggestions.
Powered by FUDForum
. Page generated in 0.01876 seconds