geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Need help with jndi configuration of a datasource
Date Wed, 12 Nov 2008 16:55:32 GMT
You need either an @Resource(name="docbase_tgmt") annotation in your  
ejb (in which case the datasource will be injected, you don't need to  
do the lookup) or a resource-ref for it in a (new) ejb-jar.xml.  In  
either case you don't need the resource-ref element in your geronimo  
plan as the names are the same.

thanks
david jencks

On Nov 12, 2008, at 2:40 AM, Klopp, Alexander wrote:

> Hi all,
>
> I'm working with geronimo 2.1.
> I've created some stateless session beans using the annotation  
> principle (without having an ejb-jar.xml)
> The beans access to a datasource defined in the dbpool section of  
> the console.
>
> My openejb-jar.xml looks like
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2"
>   xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
>   <environment>
>     <moduleId>
>       <groupId>pqm</groupId>
>       <artifactId>pqm-ejb</artifactId>
>       <version>1.0</version>
>       <type>jar</type>
>     </moduleId>
>     <dependencies>
>
>        <dependency>
>          <groupId>console.dbpool</groupId>
>          <artifactId>docbase_tgmt</artifactId>
>        </dependency>
>
>      ... some more dependencies ...
>
>     </dependencies>
>   <enterprise-beans>
>   <session>
>     <ejb-name>DocumentFacadeEJB</ejb-name>
>     <jndi-name>ejb/DocumentFacade</jndi-name>
>     <resource-ref>
>         <ref-name>docbase_tgmt</ref-name>
>      <resource-link>docbase_tgmt</resource-link>
>     </resource-ref>
>   </session>
>  </enterprise-beans>
> </openejb-jar>
>
> The lookup looks like
> ... ctx.lookup("java:comp/env/docbase_tgmt"); ...
>
> After executing a busingess methode that access to the datasource a  
> NameNotFoundException will be thrown.
>
> A similar configuration with the web application deployment  
> descriptor works fine. There I'm able to get the datasource via jndi  
> lookup from a jsp page
>
> Do you have any ideas  ??
>
> Regards
> Alex
>


Mime
View raw message