RE: OSCore

"Patrick Lightbody" <[email protected]> Mon, 26 Apr 2004 20:44:47 -0700
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <008a01c42c09$fcb3b4e0$7601a8c0@PLAPTOP>
Brian,
I think you have your datasource configured incorrectly. Generally in
J2EE things should always start with "java:comp/env".

Patrick

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf
Of
> Brian Laskey
> Sent: Friday, April 23, 2004 12:50 PM
> To: [email protected]
> Subject: [Opensymphony-developers] OSCore
> 
> I have run into a problem while trying to use PropertySets with
OSUser.
> When trying to set the DataSource in JDBCPropertySet.init()
> 
>     ds = (DataSource) EJBUtils.lookup((String)
config.get("datasource"));
> 
> EJBUtils seems to have trouble looking up my DataSource. I think there
> might be a problem in the lookup method,
> in EJBUtils.lookup:
>     ...
>     try {
>             return getRoot().lookup("java:comp/env/" + location);
>         } catch (NamingException e) {
>             if (notFoundE != null) {
>                 throw notFoundE; // throw first exception if it exists
>             }
> 
>             ignoreEnvLocations.add(location);
> 
>             return getRoot().lookup(location);
>         }
> 
> the return statement in the try just returns null if it does not find
> the datasource and does not throw and exception. I know the other
return
> will work because if I changed JDBCPropertySet to
> 
> ds = (DataSource) new InitialContext().lookup((String)
> config.get("datasource"));
> 
> that makes PropertySets work correctly(setEmail and setFullName from
> User work).  So It seems to me that you would want to check for a null
> value before returning from the try statement and then do the regular
> lookup instead of relying on it to throw an exception if it doesnt
find
> the DataSource.
> 
> Thanks, Im new to Open Symphony tools, but I didnt see this really
> mentioned in the JIRA pages for these projects so I hope Im not
> retreading old territory.
> 
> -Brian
> 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
> For a limited time only, get FREE Ground shipping on all orders of $35
> or more. Hurry up and shop folks, this offer expires April 30th!
> http://www.thinkgeek.com/freeshipping/?cpg=12297
> _______________________________________________
> Opensymphony-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297