Hi Ben,
ben.mail_at_vtxfree.ch wrote:
> I often get exceptions injecting:
>
Do you mean it happens intermittently with the same code and deployment
configuration? or can you consistently reproduce it?
> @Resource
> HttpServletRequest servletRequest;
>
I presume you are injecting the HttpServletRequest onto a field of the
resource class (since it is not possible to inject onto a method
parameter using this annotation [1]).
From the stack trace it does not appear the exception thrown is related
to injection of the HttpServletRequest since the execution of the
NodeDispatcher.dispatch method will occur after injection onto fields.
The stack trace implies you have implemented a sub-locator method:
@Path("foo") // @UriTemplate("foo")
public Object getSubResource(...) {
...
}
and the runtime has selected to invoke that sub-locator method. A
RuntimeException has been thrown from the Jersey runtime before that
sub-locator has been invoked, implying an issue with managing the method
parameters of the sub-locator. This RuntimeException is then re-thrown
as a ContainerException.
To further help you i would need to see some code and also more of the
stack trace if possible, since the ContainerException is caused by the
RuntimeException, so maybe the cause is also printed out somewhere in a
log as well?
Paul.
> Used for authorization. Does anyone else also have problems with this? I am
> now subscribed ;). Thxs Ben
>
>
> com.sun.ws.rest.api.container.ContainerException: Exception injecting
> parameters to dynamic resolving method
> at
> com.sun.ws.rest.impl.model.node.NodeDispatcher.dispatch(NodeDispatcher.java:
> 70)
> at
> com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java
> :69)
> at
> com.sun.ws.rest.impl.application.WebApplicationContext.dispatchTo(WebApplica
> tionContext.java:105)
> at
> com.sun.ws.rest.impl.model.ClassDispatcher.dispatch(ClassDispatcher.java:43)
> at
> com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java
> :69)
> at
> com.sun.ws.rest.impl.model.RootResourceClass.dispatch(RootResourceClass.java
> :118)
> at
> com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplica
> tionImpl.java:175)
> at
> com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContai
> ner.java:116)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
> at
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFi
> lterChain.java:411)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:317)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:198)
> at
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter
> .java:390)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:230)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:198)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:288)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> Valve.java:271)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:202)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
> )
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
> )
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :150)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
> )
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(
> DefaultProcessorTask.java:637)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(Defa
> ultProcessorTask.java:568)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(Defaul
> tProcessorTask.java:813)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTas
> k(DefaultReadTask.java:341)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadT
> ask.java:263)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadT
> ask.java:214)
> at
> com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUn
> ificationPipeline.java:380)
> at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
> at
> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerTh
> read.java:106)
> -----Original Message-----
> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Sent: Dienstag, 15. Januar 2008 11:46
> To: users_at_jersey.dev.java.net
> Cc: ben.mail_at_vtxfree.ch
> Subject: Re: FAuthentication Support
>
>
> Resending with Ben CC'ed as i don't think Ben is subscribed to the list.
>
> Paul.
>
> Marc Hadley wrote:
>> On Jan 15, 2008, at 10:25 AM, ben.mail_at_vtxfree.ch wrote:
>>> I have a question how to implement Authentication using Jersey:
>>>
>>> Is there any way/plan to support (Basic/Digest...) Authentication in
>>> jsr311/Jersey? Or is this the responsibility of the application
>>> parsing the HttpHeades.getRequestHeaders() MultivalueMap?
>>>
>>>
>>>
>> While it would be possible to implement basic or digest auth in an
>> application, we expect that in most cases authentication will be handled
>> by the container, e.g. by a servlet container. See the thread "Security
>> Question" for an example of how to do that in a servlet container.
>>
>> Marc.
>>
>> ---
>> Marc Hadley <marc.hadley at sun.com>
>> CTO Office, Sun Microsystems.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109