Return-Path: X-Original-To: apmail-cxf-users-archive@www.apache.org Delivered-To: apmail-cxf-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B417D3A7 for ; Thu, 28 Jun 2012 22:40:47 +0000 (UTC) Received: (qmail 55041 invoked by uid 500); 28 Jun 2012 22:40:46 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 54959 invoked by uid 500); 28 Jun 2012 22:40:46 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 54950 invoked by uid 99); 28 Jun 2012 22:40:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2012 22:40:46 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [64.95.72.244] (HELO mxout.myoutlookonline.com) (64.95.72.244) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2012 22:40:39 +0000 Received: from mxout.myoutlookonline.com (localhost [127.0.0.1]) by mxout.myoutlookonline.com (Postfix) with ESMTP id 8C3408FABC2 for ; Thu, 28 Jun 2012 18:21:44 -0400 (EDT) X-Virus-Scanned: by SpamTitan at mail.lan Received: from S10HUB002.SH10.lan (unknown [10.110.2.1]) by mxout.myoutlookonline.com (Postfix) with ESMTP id 228DF8FAB22 for ; Thu, 28 Jun 2012 18:21:44 -0400 (EDT) Received: from S10HUBR002.SH10.lan (10.110.133.101) by S10HUB002.SH10.lan (10.110.133.12) with Microsoft SMTP Server (TLS) id 14.1.355.2; Thu, 28 Jun 2012 18:40:18 -0400 Received: from [192.168.1.47] (74.96.52.123) by mail10.myoutlookonline.com (10.110.133.101) with Microsoft SMTP Server id 14.1.289.1; Thu, 28 Jun 2012 18:40:18 -0400 Message-ID: <4FECDD50.4080803@talend.com> Date: Thu, 28 Jun 2012 18:40:16 -0400 From: Glen Mazza User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: "users@cxf.apache.org" Subject: Re: WebServiceContext value not being populated in SEI implementation References: <4FE9A91B.5050103@talend.com> <1638343.HfzFN8ohhf@dilbert.dankulp.com> In-Reply-To: <1638343.HfzFN8ohhf@dilbert.dankulp.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [74.96.52.123] OK, if I understand what you're saying correctly, "cxf-servlet.xml" is a magic name of sorts, to be used when I'm *not* explicitly declaring a contextConfigLocation--if I'm going to do the latter, avoid the magic name. I'll update this. Thanks, Glen PS: Has this been the case for quite some time, or an internal change in CXF 2.6 (as part of factoring out the Spring stuff)? I think the former, but IIRC my sample did work in 2010 as-is, so dunno. On 06/28/2012 05:43 PM, Daniel Kulp wrote: > Glen, > > I haven't completely figured out a true solution to the problem, but I can > point out a way to "fix" it. > > In your web.xml, you are setting up a spring ContextLoaderListener, but then > pointing it at classpath:META-INF/cxf/cxf.xml. That creates a very basic > spring context with just a bus. The CXF servlet will then create a child > context to load the cxf-servlet.xml. That then doesn't see the > BeanPostProcessor's in the parent context. > > There are really two ways to "fix" this: > > 1) (best) - rename the cxf-servlet.xml to something like cxf-beans.xml and > point the contextConfigLocation to that. All the beans and such would be > loaded into a single context which really is the preferred way to do it. > > 2) REMOVE the ContextLoaderListener from the web.xml for CXF. The > CXFServlet will create a single context from the cxf-servlet.xml which then > will inject properly. > > The big issue is that the Bus is created in one context and then the > Endpoint (and the DoubleItImpl) is created in another. There is definitely > an issue with that. I'm going to see if there is anything we can do to > work around it, but, IMO, your web.xml is a little "strange" for a CXF app. > > Dan > > > > On Tuesday, June 26, 2012 08:20:43 AM Glen Mazza wrote: >> Hi I recently updated my JAX-WS Handler tutorial >> (http://www.jroller.com/gmazza/entry/jaxws_handler_tutorial, source code >> https://github.com/gmazza/blog-samples/tree/master/jaxws_handler_tutorial) >> originally from April 2010. >> >> It runs fine on Metro, mostly fine on CXF except for one problem: In the >> web service implementation >> (http://www.jroller.com/gmazza/entry/jaxws_handler_tutorial#hand6), the >> WebServiceContext variable is not getting populated in CXF as it is with >> Metro: >> >> @Resource >> private WebServiceContext context; >> >> public int doubleIt(int numberToDouble) { >> System.out.println("Context is" + ((context== null) ? "null" >> : "not null")); return numberToDouble* 2; >> } >> >> Metro returns "not null", while CXF returns "null". The source code is >> the same, just the dependencies are switched between the two stacks. Is >> there anything different I need to do (that I didn't need to do before) >> in order to get the CXF SEI to have a populated context value? >> >> Thanks, >> Glen -- Glen Mazza Talend Community Coders coders.talend.com blog: www.jroller.com/gmazza