Unfortunately I cannot reproduce it consistently. Occurs when running then
following code:
public class EventResource {
@HttpContext
private UriInfo context;
@HttpContext
HttpHeaders httpHeaders;
@Resource
HttpServletRequest servletRequest;
...
public Response post( EventConverter data) {
// here servlet Request is null
if (!servletRequest.isUserInRole(ResourceConfig.EVENT_CREATE_ROLE) )
Could it be that the debugger messes up things?
The error below however I see consistently, ignored it (I have no JMS
business in my app, just use Jersey, JPA that's it).
C:/Program Files/glassfishv2ur1/lib/jhall.jar;C:\Program
Files\glassfishv2ur1\lib\appserv-launch.jar
com.sun.enterprise.server.PELaunch
start
Starting Sun Java System Application Server 9.1_01 (build b09d-fcs) ...
MBeanServer started: com.sun.enterprise.interceptor.DynamicInterceptor
CORE5098: AS Socket Service Initialization has been completed.
CORE5076: Using [Java HotSpot(TM) Client VM, Version 1.5.0_12] from [Sun
Microsystems Inc.]
SEC1002: Security Manager is OFF.
C:/Program
Files/glassfishv2ur1/domains/domain1/config/.__com_sun_appserv_pid
ADM0001:SunoneInterceptor is now enabled
SEC1143: Loading policy provider
com.sun.enterprise.security.provider.PolicyWrapper.
WEB0114: SSO is disabled in virtual server [server]
WEB0114: SSO is disabled in virtual server [__asadmin]
ADM1079: Initialization of AMX MBeans started
ADM1504: Here is the JMXServiceURL for the Standard JMXConnectorServer:
[service:jmx:rmi:///jndi/rmi://68.175.113.205:8686/jmxrmi]. This is where
the remote administrative clients should connect using the standard JMX
connectors
ADM1506: Status of Standard JMX Connector: Active = [true]
JBIFW0010: JBI framework ready to accept requests.
WEB0302: Starting Sun-Java-System/Application-Server.
WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 5080
WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 5181
WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 5848
NAM0006: JMS Destination object not found:
mydomain.service.rs.EventsResource/servletRequest
javax.naming.NameNotFoundException
javax.naming.NameNotFoundException
at
com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.j
ava:268)
at
com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
at
com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProv
iderImpl.java:74)
at
com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialC
ontextProviderImpl.java:111)
at
com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at
com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.ja
va:391)
at
com.sun.enterprise.web.WebModuleContextConfig.configureResource(WebModuleCon
textConfig.java:220)
at
com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContex
tConfig.java:161)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:143)
at
org.apache.catalina.core.StandardContext.init(StandardContext.java:6350)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4848)
at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
at
com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at
com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:
304)
at
com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:
176)
at
com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:1
92)
at
com.sun.enterprise.web.VirtualServer.startChildren(VirtualServer.java:1672)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1231)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:955)
at
com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at
com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:
304)
at
com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:
176)
at
com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:1
92)
at
com.sun.enterprise.web.EmbeddedWebContainer$WebEngine.startChildren(Embedded
WebContainer.java:453)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1231)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
at org.apache.catalina.startup.Embedded.start(Embedded.java:936)
at com.sun.enterprise.web.WebContainer.start(WebContainer.java:873)
at
com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:790)
at
com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifec
ycle.java:84)
at
com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java
:442)
at
com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.j
ava:120)
at com.sun.enterprise.server.PEMain.run(PEMain.java:411)
at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
-----Original Message-----
From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Freitag, 18. Januar 2008 04:30
To: users_at_jersey.dev.java.net
Subject: Re: FAuthentication Support
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net