users@jersey.java.net

Re: [Jersey] 404's returned

From: Conrad <cahofmeyr_at_gmail.com>
Date: Wed, 1 Jul 2009 15:21:45 -0700 (PDT)

Hi Paul,

Using GlassFish monitoring I saw that requests to my REST endpoints were
going to the default servlet. I changed the url-pattern for my servlet
container to a wildcard, and now everything is working again.

I find it strange that the servlet mappings can break after a restart of the
server, but in any case, the problem had nothing to do with Jersey itself.

Thanks for the help!


Paul Sandoz wrote:
>
>
> On Jul 1, 2009, at 2:51 AM, Conrad wrote:
>
>>
>> Hi,
>>
>> I have the exact same problem. I'm using GlassFish v2 and I
>> installed Jersey
>> from Update Center. I'm deploying my web application through
>> GlassFish tools
>> for Eclipse.
>>
>> As far as I can see in the GlassFish log file below, there are no
>> problems.
>>
>> I got the 404s when I tried to get my services working for the first
>> time.
>> By tampering around with the servlet container specified in web.xml
>> and the
>> jersey annotations (see below), I managed to get my services to work,
>> flawlessly.
>
> OK.
>
>
>> It worked until I restarted GlassFish, and now I'm getting the
>> 404s again for no apparent reason. The only difference is that I
>> restarted
>> GlassFish.
>>
>
> Did you redeploy your web application after the restart?
>
> It might be the case that deploying the application via the IDE might
> not retain the state of the deployment over restarts of the app server.
>
>
>> Excerpt from GlassFish log file:
>>
>
> The excerpt looks OK. Is that excerpt from GF after you restarted or
> before?
>
> You can configure monitoring from the GF admin console:
>
> http://docs.sun.com/app/docs/doc/820-4335/ablur?a=view
>
> plus you might want to verify after a restart whether your application
> is still registered via the admin console.
>
> Paul.
>
>>
>>
>>> [#|2009-07-01T02:23:30.507+0200|INFO|sun-appserver2.1|
>>> com.sun.jersey.api.core.PackagesResourceConfig|
>>> _ThreadID=24;_ThreadName=httpWorkerThread-4848-2;|Scanning
>>> for root resource and provider classes in the packages:
>>> com.ccgza.services_rest|#]
>>>
>>> [#|2009-07-01T02:23:30.516+0200|INFO|sun-appserver2.1|
>>> com.sun.jersey.api.core.PackagesResourceConfig|
>>> _ThreadID=24;_ThreadName=httpWorkerThread-4848-2;|Root
>>> resource classes found:
>>> class com.ccgza.services_rest.Test1Resource
>>> class com.ccgza.services_rest.Test2Resource|#]
>>>
>>> [#|2009-07-01T02:23:30.516+0200|INFO|sun-appserver2.1|
>>> com.sun.jersey.api.core.PackagesResourceConfig|
>>> _ThreadID=24;_ThreadName=httpWorkerThread-4848-2;|Provider
>>> classes found:
>>> class com.ccgza.services_rest.JAXBContextResolver|#]
>>>
>>> [#|2009-07-01T02:23:30.530+0200|INFO|sun-appserver2.1|
>>> com.sun.jersey.server.impl.application.WebApplicationImpl|
>>> _ThreadID=24;_ThreadName=httpWorkerThread-4848-2;|Initiating
>>> Jersey application, version 'Jersey: 1.1.0-ea 04/30/2009 06:59 PM'|#]
>>>
>>
>> Excerpt from web.xml
>>
>>
>>> <servlet-name>WebGateway</servlet-name>
>>>
>>> <servlet-
>>> class>com.sun.jersey.spi.container.servlet.ServletContainer</
>>> servlet-class>
>>> <init-param>
>>>
>>> <param-name>com.sun.jersey.config.property.packages</param-name>
>>> <param-value>com.ccgza.services_rest</param-value>
>>> </init-param>
>>>
>>
>> Excerpt from Java:
>>
>>
>>> @Path("/WebGateway/Test1")
>>> public class Test1Resource
>>> ...
>>>
>>
>>
>> Jonathan Cook - FM&amp;T wrote:
>>>
>>> Hello,
>>>
>>> I have this really strange problem where I run up my development
>>> environment and then go to a url. All the resources are registered
>>> eg):
>>> 17-Jun-2009 14:18:16 com.sun.ws.rest.api.core.PackagesResourceConfig
>>> init
>>> INFO: Root resource classes found:
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.football.resources.FootballCompetit
>>> ionResource
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.football.resources.FootballIncludeP
>>> athGeneratorResource
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.football.resources.FootballMatchRes
>>> ource
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.football.resources.FootballFixtureR
>>> esource
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.football.resources.FootballResource
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.football.resources.FootballCompetit
>>> ionListResource
>>> 17-Jun-2009 14:18:16 com.sun.ws.rest.api.core.PackagesResourceConfig
>>> init
>>> INFO: Provider classes found:
>>> class
>>> com
>>> .bbc.newsi.feeds.sport.webservice.providers.FreemarkerTemplateProcess
>>> or
>>>
>>> But then all the urls I go to return a 404 for some reason in the
>>> http
>>> header. If I then restart everything sometimes it works and
>>> sometimes it
>>> doesn't. I appreciate this is probably a hard one to solve but
>>> there are
>>> no errors logged and I just wondered if anyone else had this
>>> problem at
>>> all.
>>>
>>> Thanks
>>> Jonathan
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/404%27s-returned-tp3092806p3186287.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>

-- 
View this message in context: http://n2.nabble.com/404%27s-returned-tp3092806p3192125.html
Sent from the Jersey mailing list archive at Nabble.com.