dev@glassfish.java.net

Re: Unable to reproduce (was [GFv3] localhost:8080/<ContextRoot> does not work)

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 24 Jul 2008 21:19:52 -0400

Salut,

Sahoo wrote:
> Is there any tracing that I can enable to provide more information?

Setting the logger server="FINEST" should help. The problem right now
I'm observing thanks to Marina is that it seems there is a thread race
at startup when hk2 register the host, adapter, etc. Hudson, Ubuntu and
OS X (at least for me) aren't showing any failure because the Grizzly
Mapper gets the proper information, e.g the hosts, alias and adapter. In
you example, it seems the Mapper has never been invoked with that
information. Why is the question :-)

Worse, with Marina's setup the @Inject annotation doesn't inject the
Mapper, ending in a beautiful NPE. Jerome explained to me how hk2 works
and how services are initialized, I think I've missed one case, which is
  what you are facing and what Marina is experiencing. Before the Mapper
wasn't shared and we have guessed the host, which is why the problem
never occurred.

Take a look at
kernel/src/main/com/sun/enterprise/v3/services/impl/GrizzlyService.registerEndpoint(..)

This is the root cause. Now I can't reproduce the issue, so it makes
debugging a little hard. But the root cause is the Mapper is not
initialized with proper info, hence fail to map and return a 404.

Let me know if you find something :-)

I
> can even debug some code, if you tell me which code path is suspected.

Thanks for the help.

-- Jeanfrancois

  I
> use OpenSolaris/x86. Here is what I get in the client side:
>
> /glassfish@/tmp$ wget -S http://localhost:8080/FirstV3Test
> --04:48:55-- http://localhost:8080/FirstV3Test
> => `FirstV3Test'
> Resolving localhost... 127.0.0.1
> Connecting to localhost|127.0.0.1|:8080... connected.
> HTTP request sent, awaiting response...
> HTTP/1.1 404 Not Found
> Content-Type: text/html; charset=iso-8859-1
> Content-Length: 815
> Date: Thu, 24 Jul 2008 23:18:55 GMT
> Connection: Keep-Alive
> 04:48:55 ERROR 404: Not Found.
> /
>
> glassfish@/tmp$ cat /etc/hosts
> 127.0.0.1 localhost glassfish glassfish.
> 192.168.1.12 glassfish-iwi0 # Added by inetmenu
>
> Only localhost does not work, I can use 127.0.0.1 or glassfish as the
> host in the URI.
>
> Thanks,
> Sahoo
>
> Jeanfrancois Arcand wrote:
>> Salut,
>>
>> looking at issue filled by Sahoo:
>>
>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=5372
>>
>> I cannot reproduce the problem on both Ubuntu and OS X.
>>
>> My host file contains:
>>
>> 127.0.0.1 localhost
>> 127.0.1.1 ja120114-desktop
>>
>>> ja120114_at_ja120114-desktop:/tmp$ wget -S
>>> http://localhost:8080/tomcat-test/
>>> --12:21:23-- http://localhost:8080/tomcat-test/
>>> => `index.html.1'
>>> Resolving localhost... 127.0.0.1
>>> Connecting to localhost|127.0.0.1|:8080... connected.
>>> HTTP request sent, awaiting response... HTTP/1.1 200 OK
>>> X-Powered-By: Servlet/2.5
>>> Server: GlassFish/v3
>>> ETag: W/"29-1216862374000"
>>> Last-Modified: Thu, 24 Jul 2008 01:19:34 GMT
>>> Content-Type: text/html
>>> Content-Length: 29
>>> Date: Thu, 24 Jul 2008 16:21:23 GMT
>>> Connection: Keep-Alive
>>> Length: 29 [text/html]
>>
>>> ja120114_at_ja120114-desktop:/tmp$ wget -S
>>> http://localhost:8080/tomcat-test/ServletTest
>>> --12:22:52-- http://localhost:8080/tomcat-test/ServletTest
>>> => `ServletTest'
>>> Resolving localhost... 127.0.0.1
>>> Connecting to localhost|127.0.0.1|:8080... connected.
>>> HTTP request sent, awaiting response... HTTP/1.1 200 OK
>>> X-Powered-By: Servlet/2.5
>>> Server: GlassFish/v3
>>> Content-Type: text/plain;charset=ISO-8859-1
>>> Content-Length: 7
>>> Date: Thu, 24 Jul 2008 16:22:52 GMT
>>> Connection: Keep-Alive
>>> Length: 7 [text/plain]
>>
>> Are you using HTTP 1.0 by any chance?
>>
>> Thanks
>>
>> -- Jeanfrancois
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>