The datasource module needs to be listed as a dependency of the war
module if they are deployed separately. Single-valued component
search in geronimo follows the directed acyclic graph of dependencies
so you can deploy lots of datasources named "jdbc/db" in different
modules yet still get the one you want in your app by specifying the
module with the right one as a dependency.
thanks
david jencks
On Nov 26, 2009, at 9:44 AM, cumbers wrote:
I am looking for someone to put me out of my geronimo/openpa misery.
I have an application that I can deploy to Geronimo (2.1.1.3) that
uses
openjpa where the properties inside the persistence.xml are explicitly
defined like so:
<properties>
<property name="openjpa.ConnectionDriverName"
value="oracle.jdbc.driver.OracleDriver"></property>
<property name="openjpa.ConnectionURL"
value="jdbc:oracle:thin:@localhost:1521:DB"></property>
<property name="openjpa.ConnectionUserName"
value="dbuser"></property>
<property name="openjpa.ConnectionPassword"
value="passw0rd"></property>
</properties>
However this app is going to be deployed by lots of users, and
ideally I
would like to ship a war file, and direct users to create a JNDI
object that
they define and then openjpa uses this.
Simply defining the JNDI datasource connection within Geronimo, and
using
the reference in the <jta-data-source>jdbc/db</jta-data-source> or
<non-jta-data-source>jdbc/db</non-jta-data-source> does not appear
to work,
and I get the following error message when I try and create an
EntityManager:
"<openjpa-1.2.1-r2180:4612 fatal user error>
org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or
DataSource class name must be specified in the ConnectionDriverName
property."
After 3 days on google, I found this page:
http://cwiki.apache.org/GMOxDOC21/datasource-connectionfactory-mdb-and-jpa.html
which suggests that:
"Although many other servers use jndi to define the meaning of the
jta-data-source and non-jta-data-source geronimo does not. These are
not
jndi names in any way but must match the name specified in the
connector
plan."
OK so using the jndi object name directly does not seem to be
supported.
However the name in the resourceadapter of the plan.xml IS "jdbc/db"
and so
I think this should work. Here is the relevant snippet from my
plan.xml as
created when I define a JDBC datasource using Geronimo.
<resourceadapter>
<outbound-resourceadapter>
<connection-definition>
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-
interface>
<connectiondefinition-instance>
<name>jdbc/db</name>
I have run out of ideas on how I can make this work, and would be
massively
appreciative if anyone can shed some light on why this is not
working. If
you think you need more information please let me know!
Cheers
Rich
--
View this message in context:
http://old.nabble.com/Geronimo-with-openjpa-%28and-DataSource-lookups%29-tp26532836s134p26532836.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.