[jboss-user] [JBoss Web Services CXF] - Continuing problem with XTS WS-T tests in AS trunk/CXF 2.2.9

Andrew Dinn do-not-reply at jboss.com
Thu Jul 22 10:37:05 EDT 2010


Andrew Dinn [http://community.jboss.org/people/adinn] replied to the discussion

"Continuing problem with XTS WS-T tests in AS trunk/CXF 2.2.9"

To view the discussion, visit: http://community.jboss.org/message/553969#553969

--------------------------------------------------------------
Hi Jim,

I am not sure what is different in my code that makes request.getScheme() fail with an NPE while your code works ok but I think it is just luck.

I traced execution through a test case and it appears that the incoming message relates to a valid request. Because this is a one way message there is a handover of control in ContextUtils at line 416


> 416                     inMessage.getInterceptorChain().pause();
>  
> 
>                         // ... and resume on executor thread
>                         getExecutor(inMessage).execute(new Runnable() {
>                             public void run() {
> 421                             inMessage.getInterceptorChain().resume();
>                             }
> 

I checked the request by stopping at 416 and looking up the stack to find the request. The HttpServletRequest object is actually a facade object which indirects to an underlying catalina connector request. It had a name like "Current Servlet stack for thread http-127.0.0.1-8080-1 [S] ActivationService [org.jboss.wsf.stack.cxf.CXFServletExt]". request.getScheme() worked on this object without a NPE.

I picked control up again in the debugger at 421 but, of course, there was no servlet method up the stack where I coudl locate the request. So, I proceeded to step through the code until the ServiceInvokerInterceptor was called. In AbstractInvoker.invoke() the web service context is set up

> public Object invoke(Exchange exchange, Object o)
>    {
>       // set up the webservice request context 
>       WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
> 
>       Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
> 
>       WebServiceContextImpl.setMessageContext(ctx);
> 
> 101   Object retObj = null;


At line 101 I evaluated ctx.get("HTTP.REQUEST") and got another facade hiding a catalina connector request with name "Current Servlet stack for thread default-workqueue-2". However all the fields of this catalina connector request appear to be uninitialised and getScheme() returns null. So, this looks to me like the request is coming out of a thread local and it is pot luck whether the object behind the facade has been initialised or not. IN your tests it may be that a previous call has set values in this object.

regards,


Andrew Dinn

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/553969#553969]

Start a new discussion in JBoss Web Services CXF at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2046]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100722/27690c39/attachment.html 


More information about the jboss-user mailing list