dev@glassfish.java.net

Re: Deploying a Rails app throws NPE

From: <Jan.Luehe_at_Sun.COM>
Date: Thu, 07 Aug 2008 13:27:20 -0700

Peter Williams wrote:

> Jan.Luehe_at_Sun.COM wrote:
>
>> Arun Gupta wrote:
>>
>>>> The new ContainerMapper endpoint registration API requires a
>>>> collection of virtual server names ("vs"), which defaults to an
>>>> empty collection (which may be a problem in that an endpoint
>>>> registered using the version of GrizzlyService.registerEndpoint()
>>>> that does not take any "vsServers" argument will not be registered
>>>> at all), so you should never be getting an NPE here:
>>>>
>>>> for (String host : vs) {
>>>>
>>>> unless you were explicitly passing a "null" collection to
>>>> GrizzlyService.registerEndpoint().
>>>>
>>>> Can you check the args you are passing to
>>>>
>>>> GrizzlyService.registerEndpoint()?
>>>
>>>
>>> The arguments are:
>>>
>>> contextRoot, null, adapter, adapter
>>>
>>> The second argument is explicitly and that may be causing the NPE.
>>> What is the proper value instead of "null" ?
>>
>>
>>
>> If you use the 3-arg version of GrizzlyService:
>>
>> registerEndpoint(String contextRoot, Adapter endpointAdapter,
>> ApplicationContainer container)
>>
>> the NPE should go away, but as I mentioned earlier, this loop in
>> ContainerMapper would then be bypassed:
>>
>> for (String host : vs) {
>> mapper.addContext(host, slash(contextRoot),
>> new ContextRootInfo(adapter, container,
>> contextProtocolFilters), new String[0], null);
>> }
>>
>> and your endpoint won't be registered.
>
> Last night, I thought the same thing, but on further inspection, the
> assumptions above are wrong. The 3 argument form of
> GrizzlyService.registerEndpoint passes an internal <hosts> variable to
> the 4 argument version currently in use by RailsDeployer (with the
> null). 'hosts' initially is empty, but is filled in
> GrizzlyService.createNetworkProxy().


Yes, you are right. :)
Thanks for pointing this out.

Your patch looks fine.

Will you take care of committing it?

Thanks,


Jan