开发者

How do I force Jersey to load it's services?

I'm having trouble with a jersey application running on a jetty server that will take up to 30 seconds to start. I don't know what causes this behaviour, and I'm unsure how to debug it.

Jersey is not started until the first HTTP request to one of its services are made. After the first reques开发者_如何学运维t is made, the following gets printed:

INFO: Initiating Jersey application, version 'Jersey: 1.3 06/17/2010 04:53 PM'

After that, 5 to 45 seconds pass, and then jersey prints info about what resources it found and replies to the HTTP request.

First, I'd like to force jersey to start when the rest of the app starts as a hack to get around this until I find the culprit. Is there any way to do that without emulating an actual HTTP request to jetty?

Second, I'm stumped as to how to debug this. I've checked the constructors in my service classes, and they don't appear to be responsible. Has anyone had similar problems with jersey?


You could try the following in your web.xml:

<servlet>
    <servlet-name>ServletAdaptor</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

I'm not sure why there'd be a long delay - perhaps it's doing some form of check for updates - are you able to monitor the http traffic from your application? Glassfish does that and it can take a while.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜