djencks wrote:
>
>
> On Apr 30, 2009, at 6:51 AM, fmeili wrote:
>
> So..... geronimo is assembled out of plugins (e.g. your app becomes a
> plugin once deployed). The plugins form a directed acyclic graph
> (each plugin has a bunch of parents, and you can't have circular
> dependencies). When the deployer tries to figure out what datasource
> you're asking for it looks only in the directed acyclic subgraph of
> ancestors of your app. (this lets you deploy lots of distinct
> datasources with the same "name" in different plugins and still be
> able to refer to them individually without specifying the exact plugin
> they come from everywhere you want a datasource).
>
> So...
> - deploy a datasource e.g. using the console and note what the
> artifact name is for the resulting plugin
> - add a dependency on that datasource plugin into the ear or ejb plan
> (geronimo-application.xml or openejb-jar.xml)
>
> As long as the name in the @Resource annotation matches the name in
> the connector plan that's all that's necessary.
>
> thanks
> david jencks
>
>
Hi David,
thanks a lot for your explanation. I've tried to deploy it, as you
described, but it didn't work.
I don't know where my mistake is. I've tried it in the following way:
1. Using the WebConsole, I've created a database pool using the database
pool wizard. The name of the pool is "jdbc/__mes". The database is
accessible successfully (test-db-ping works).
2. Now the database pool with the name "jdbc/__mes" is listed in the
"Database Pools" page in Geronimos WebConosle. If I follow the link "Usage"
for this pool, I see a lot of hints how to use this pool - but I can't bring
it to work.
3. The "Usage" page tell me to include the following section into my
"web.xml":
<resource-ref>
<res-ref-name>jdbc/MyDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Also this page tell me to insert the following code into the
"geronimo-web.xml" file:
<environment>
<moduleId>
<artifactId>MyWebApp</artifactId>
</moduleId>
<dependencies>
<dependency>
<groupId>console.dbpool</groupId>
<artifactId>jdbc___mes</artifactId>
</dependency>
</dependencies>
</environment>
<context-root>/MyWebApp</context-root>
<resource-ref>
<ref-name>jdbc/MyDataSource</ref-name>
<resource-link>jdbc/__mes</resource-link>
</resource-ref>
As fas as I understand you, it is not neccessary to do this in the web.xml
and geronimo-web.xml files. Instead I may define this in the
geronimo-web.xml.
As you wrote, I've tried to use add a dependency in the
geronimo-application.xml - this is the result:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<environment>
<moduleId>
<artifactId>mes.suite</artifactId>
</moduleId>
<dependencies>
<dependency>
<groupId>console.dbpool</groupId>
<artifactId>jdbc___mes</artifactId>
</dependency>
</dependencies>
</environment>
</application>
The @Resource annotation has a "name" this attribute: "jdbc/__mes".
But I still got this deployment error. Also I've tried to insert the
following section in the geronimo-application.xml, but it didn't help:
<resource-ref>
<res-ref-name>jdbc/__mes</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
I don't know, what my mistake is.
Do I need to add something to the "application.xml"?
What do I need to add to the "geronimo-web.xml" to make jdbc connection
available for all web and ejb modules included in the ear?
Thanks,
Frank
--
View this message in context:
http://www.nabble.com/%22Could-not-auto-map-to-resource%22-problem-when-using-EJB-annotations-only-tp23316686s134p23364735.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.