Yes, your are right, this is a bug, but I found a work around: just drop the
java:comp/env path and instead, just use jdbc/MyDs (and I'm not sure but you
can also drop jdbc).
All in all, Jonas is not happy with naming.
Olivier Richaud
CSTB
office: +33 4 93 95 67 24
mobile: +33 6 87 52 53 17
www: http://cic.cstb.fr
----- Message d'origine -----
De : Joe Gittings <[EMAIL PROTECTED]>
À : <[EMAIL PROTECTED]>
Cc : <[EMAIL PROTECTED]>
Envoyé : lundi 4 septembre 2000 17:44
Objet : RE: retrieving the datasource of a CMP bean?
> Hi,
>
> I just tried this. Unfortunately, I get a ClassCastException. It seems
that
> instead of returning a DataSource, the initialContext.lookup() is
returning
> an instance of org.objectweb.jonas.jtm.Current.
>
> Looking in the archives, someone has reported this problem before
> ("DataSource problem", Miroslav Halas, 10th May 2000). Has a fix or
> workaround been found for it?
>
> Joe
>
> -----Original Message-----
> From: Simon Oldeboershuis [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, September 04, 2000 3:51 PM
> To: Joe Gittings
> Cc: [EMAIL PROTECTED]
> Subject: Re: retrieving the datasource of a CMP bean?
>
> Hi Joe,
>
> I posted a similiar question earlier. I got an answer from Philippe:
>
> -----------cut--------------------
> To get a DataSource in your CMP EntityBean you can do:
>
> try {
> initialContext = new InitialContext();
> dataSource
> =(DataSource)initialContext.lookup("java:comp/env/jdbc/MyDs");
> } catch (Exception e) {
> ...
> ...
>
> With in your XML DD
> <resource-ref>
> <res-ref-name>jdbc/MyDs</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> -----------cut--------------------
>
> I hope this helps!
> simon
>
> Joe Gittings wrote:
> >
> > Hi all,
> >
> > I'd like to retrieve the javax.sql.DataSource bound to a CMP entity
bean,
> > from within an implementation method of that bean. In Jonas 1.6.1 this
> > could easily be done with
> >
> > String sDataSourceName = env.getProperty("datasource.name");
> > DataSource ds =
> > (DataSource)initialContext.lookup(sDataSourceName);
> >
> > In Jonas 2.0 I cannot see an easy way to do this - does anyone know of a
> > way? Apologies if this is a dumb question!
> >
> > Joe
> >
> > =====================================================================
> > Joe Gittings, Royal Botanic Gardens, Kew
> > Hanover House, Kew, Richmond, Surrey TW9 3AB
> >
> > [EMAIL PROTECTED]
> > +44 20 8332 5712
> > fax: +44 20 8332 5736
> >
> > ----
> > To unsubscribe, send email to [EMAIL PROTECTED] and
> > include in the body of the message "unsubscribe jonas-users".
> > For general help, send email to [EMAIL PROTECTED] and
> > include in the body of the message "help".
> ----
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe jonas-users".
> For general help, send email to [EMAIL PROTECTED] and
> include in the body of the message "help".
>
> ----
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe jonas-users".
> For general help, send email to [EMAIL PROTECTED] and
> include in the body of the message "help".
>
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".