geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aman Nanner/MxI Technologies <aman.nan...@mxi.com>
Subject Re: Problems with access a datasource from a stateless session bean via JNDI lookup
Date Wed, 07 Feb 2007 23:22:28 GMT
As far as I know, you cannot do this in Geronimo 1.1.1 because there is no
global JNDI.  Instead, you need to define a resource-ref in your
openejb-jar.xml like this:

      <session>
         <ejb-name>TestEjb</ejb-name>
         <jndi-name>com/testing/TestEjb</jndi-name>
         <resource-ref>
            <ref-name>jdbc/DataAccessObject</ref-name>
            <resource-link>com/testing/MyCustomDataSource</resource-link>
         </resource-ref>
      </session>


where "com/testing/MyCustomDataSource" is the name of your datasource as
defined in your DataSource RAR plan.

Then, in your code, you would retrieve the datasource by doing a lookup on
"java:/comp/env/jdbc/DataAccessObject", which we defined in the
openejb-jar.xml.

Carsten Lange <lasco@arcor.de> wrote on 02-07-2007 04:03:25 AM:

> Hi,
>
> I 'm trying to access a datasource from a stateless session bean via
> JNDI lookup. I tried everything I could find at any documentation.
> But I can not access the datasource because the JNDI name could not
> be found. I deployed the application in an EAR and have the
> reference to it at web.xml and geronimo-web.xml. If I deploy the WAR
> single and outside of the EAR the problem is solved and the access
> to the datasource works. But deployed at the EAR it does not work.
> I'm using geronimo 1.1.1.
> Please help me.
> You can reach me under: lasco@arcor.de
>
> Thanks Carsten
>
> ________________________
> Lange Software Consulting
> Carsten Lange
> 0177 870 82 88
>

__________________________________________________________________________________
* This message is intended only for the use of the individual or entity to which it is addressed,
and may contain information that is privileged, confidential and exempt from disclosure under
applicable law. Unless you are the addressee (or authorized to receive for the addressee),
you may not use, copy or disclose the message or any information contained in the message.
If you have received this message in error, please advise the sender by reply e-mail , and
delete the message, or call (collect) 001 613 747 4698. *


Mime
View raw message