tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Putting data source into local container?
Date Mon, 20 Apr 2009 19:08:48 GMT

On Apr 20, 2009, at 11:07 AM, Laird Nelson wrote:

> Hey, this gets weirder.
> I found this:
> Now, this indicates that what you can do is set up your  
> InitialContext, then
> *throw it away*, then create a *new* InitialContext without
> *any*properties, and look up your data source in
> *there*.
> I tried it and it works, but boy does it creep me out.  :-)
> Any ideas as to why I need to create a new InitialContext with no  
> arguments
> after my initialization code to get the subsequent lookup to work?

Right, it is indeed quirky.  We made some improvements here not too  
long ago:

So basically in 3.1.1 you should be able to lookup "openejb:Resource/ 
Foo" from inside the same vm as the container, regardless of how you  
constructed your InitialContext or if it is a bean or client doing the  

Till then the "new InitialContext().lookup("java:openejb/Resource/ 
Foo")" approach will always work in the test case.


View raw message