OSCore
Brian Laskey <[email protected]> Fri, 23 Apr 2004 15:49:36 -0400
| Newsgroups | gmane.comp.java.open-symphony.devel |
|---|---|
| Message-ID | <[email protected]> |
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