geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: "Could not auto-map to resource" problem when using EJB annotations only
Date Thu, 30 Apr 2009 16:29:39 GMT

On Apr 30, 2009, at 6:51 AM, fmeili wrote:

> Hi all,
> I try to deploy an EAR with some (skinny) WAR's and some EJB's. All  
> EJB's
> use the @Resource tag for Database access. I always get a deployment  
> error,
> that the resource could not auto-map. Instead the error message tell  
> me to
> use a Geronimo deployment plan.
> After looking deeper in the Deployment plan mechanism of Geronimo I'm
> completely confused. I found that I need an "openejb-jar.xml" and  
> use the
> <resource-ref> Tag in it. This only works, if I have also a standard
> "ejb-jar.xml". But does this mean, that I have to really write all  
> the "old
> pre JEE5" deployment descriptors for all my EJB's to deploy the EAR to
> Geronimo?

You don't have to do that.
> Is there a way to tell Geronimo the name of a JDBC resource globally  
> - maybe
> in the "geronimo-application.xml" - I haven't found a hint about this?
> I tried Geronimo 2.1.4 and 2.2-SNAPSHOT.

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).

- 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.

david jencks

> Thanks in advance for an answer,
> greetings,
>  Frank
> -- 
> View this message in context:
> Sent from the Apache Geronimo - Users mailing list archive at  

View raw message