dev@glassfish.java.net

Re: Deploying a Rails app throws NPE

From: <Jan.Luehe_at_Sun.COM>
Date: Thu, 07 Aug 2008 10:45:43 -0700

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.

So, can you continue to use the 4-arg version of registerEndpoint(), but
instead of passing "null" for "vsServers", pass a Collection<String>
that contains an empty string?


Jan



>
> -Arun
>
>>
>> Thanks,
>>
>>
>> Jan
>>
>>
>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.ContainerMapper.register(ContainerMapper.java:119)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttp.registerEndpoint(GrizzlyEmbeddedHttp.java:333)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyProxy.registerEndpoint(GrizzlyProxy.java:197)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyProxy.registerEndpoint(GrizzlyProxy.java:58)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:344)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:329)
>>>>>
>>>>> at
>>>>> org.glassfish.scripting.rails.RailsDeployer.load(RailsDeployer.java:87)
>>>>>
>>>>> at
>>>>> org.glassfish.scripting.rails.RailsDeployer.load(RailsDeployer.java:45)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.load(ApplicationLifecycle.java:641)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:280)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.deployment.DeployCommand.execute(DeployCommand.java:279)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:286)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:114)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:94)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:230)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:156)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:148)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:70)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)
>>>>> Aug 6, 2008 9:19:04 PM org.glassfish.api.ActionReport failure
>>>>> SEVERE: Exception while deploying the app
>>>>> java.lang.NullPointerException
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.ContainerMapper.register(ContainerMapper.java:119)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttp.registerEndpoint(GrizzlyEmbeddedHttp.java:333)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyProxy.registerEndpoint(GrizzlyProxy.java:197)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyProxy.registerEndpoint(GrizzlyProxy.java:58)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:344)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:329)
>>>>>
>>>>> at
>>>>> org.glassfish.scripting.rails.RailsDeployer.load(RailsDeployer.java:87)
>>>>>
>>>>> at
>>>>> org.glassfish.scripting.rails.RailsDeployer.load(RailsDeployer.java:45)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.load(ApplicationLifecycle.java:641)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:280)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.deployment.DeployCommand.execute(DeployCommand.java:279)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:286)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:114)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:94)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:230)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:156)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:148)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:70)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)
>>>>> Aug 6, 2008 9:19:04 PM
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle unload
>>>>> SEVERE: Failed to unload from container type : jruby
>>>>> java.lang.NullPointerException
>>>>> at
>>>>> org.glassfish.scripting.rails.RailsDeployer.unload(RailsDeployer.java:96)
>>>>>
>>>>> at
>>>>> org.glassfish.scripting.rails.RailsDeployer.unload(RailsDeployer.java:45)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:763)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle$1.actOn(ApplicationLifecycle.java:263)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:300)
>>>>>
>>>>> at
>>>>> com.sun.enterprise.v3.deployment.DeployCommand.execute(DeployCommand.java:279)
>>>>>
>>>>>
>>>>> Peter is waiting for a fix from GlassFish Scripting workspace and
>>>>> I'd rather see a working build (at least from JRuby perspective)
>>>>> before I integrate any further changes.
>>>>>
>>>>> Thanks,
>>>>> -Arun
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>