Cheng Fang wrote:
>
>
> On 11/8/10 2:56 PM, Marina Vatkina wrote:
>> Ken Cavanaugh wrote:
>>> On Nov 8, 2010, at 11:28 AM, Marina Vatkina wrote:
>>>
>>>> Ken Saks told me at 3.0 timeframe that GF/habitat bootstrapping and
>>>> injection should happen during new InitialContext() call.
>>>>
>>>> Cheng, can you check?
>>>
>>> That's interesting, because the place where this problem occurs is
>>> in the constructor for
>>> SerialInitContectFactory, which is called in a new InitialContext()
>>> call (followed by
>>> getInitialContext). But that's the problem: the very first thing in
>>> the SerialIInitContextFactory
>>> constructor IS the reference to Globals.getDefaultHabitat(), which
>>> returns null.
>>
>> What's strange is that it all works in a single-instance install (ejb
>> devtests do that and Gopal was also able to set up hist test on a
>> single instance).
>>
>> So the question is why Globals.getDefaultHabitat() is not working
>> correctly in a cluster?
> When standalone client running against DAS, the habit is initialized
> in SerialContext constructor (later than SerialInitContextFactory
> constructor):
>
> if( SerialInitContextFactory.getDefaultHabitat() == null ) {
> // Bootstrap a hk2 environment.
> // TODO This will need to be moved somewhere
> else. Potentially any
> // piece of glassfish code that can be an initial
> entry point from a
> // Java SE client will need to make this happen.
>
> habitat = Globals.getStaticHabitat();
> SerialInitContextFactory.setDefaultHabitat(habitat);
> }
>
> In cluster install, habitat is used earlier, and needs to be
> initialized earlier.
Actually, I think what this says is that SerialInitContext needs to use
Globals.getStaticHabitat instead
of getDefaultHabitat. If that's all that is needed, it's a very simple
change. I think I can try that pretty easily,
since I have a test case for Gopal's bug.
Thanks,
Ken.