Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 8344 invoked from network); 23 Dec 2008 07:49:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Dec 2008 07:49:13 -0000 Received: (qmail 96199 invoked by uid 500); 23 Dec 2008 07:49:12 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 96167 invoked by uid 500); 23 Dec 2008 07:49:12 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 96156 invoked by uid 99); 23 Dec 2008 07:49:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Dec 2008 23:49:12 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of willem.jiang@gmail.com designates 209.85.142.188 as permitted sender) Received: from [209.85.142.188] (HELO ti-out-0910.google.com) (209.85.142.188) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Dec 2008 07:49:03 +0000 Received: by ti-out-0910.google.com with SMTP id u5so1723646tia.10 for ; Mon, 22 Dec 2008 23:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=Vj9p7ioaE5TVv6/92nnWLDpnj9Wxm7YiKkWkhh64Et8=; b=noY+7WSgxHRtkmCDDvvYnoZZOcElRpxJia8RCAiSN0a2Dt8bVXiOIjqIVWtCo9qcjy nfdNZ4gtP9+y+DFnGsdpUlpdm4UlPX7a8VebvXbySfiojrVXxkUHN9A28yfCGwqC1N3q 4QDCfQ6bkVP6QmQ15/WdK9qCE5vWxXAZOMkC4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=QpgwFOq9LuK8B4LL3sqYYVRTj6iGfvw9O4Djs80/ChXEPYIY6m61ZVHyiNSCbMrnP2 tFGaXWkeBbYzcLMbr2Bx3OcoVHIhYHMH1TvqF9H/w7qipkWVvyyN9gyzsrAQkG+stKTC mbBhta1PnmKEDkJVZTetK/xRKnzJRE4WAwhgg= Received: by 10.110.43.18 with SMTP id q18mr11067185tiq.18.1230018521284; Mon, 22 Dec 2008 23:48:41 -0800 (PST) Received: from ?192.168.0.131? ([222.131.242.89]) by mx.google.com with ESMTPS id a14sm201267tia.12.2008.12.22.23.48.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 22 Dec 2008 23:48:40 -0800 (PST) Message-ID: <495097CD.30607@gmail.com> Date: Tue, 23 Dec 2008 15:48:29 +0800 From: Willem Jiang User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: dev@cxf.apache.org Subject: Re: Issue with multiple CXF servlets (and proposed fix) References: <21138164.post@talk.nabble.com> In-Reply-To: <21138164.post@talk.nabble.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi I'm here (no vocation plan for this Christmas). I just went through the CXFServelet code to refresh my memory, found it could be cased by not using right bus for the jaxrs endpoint. Since you include ...cxf.xml in the jaxrs spring configuration file, the jaxrs endpoint can't take the already created bus of the application context into consideration. The new created jaxrs endpoint will use its own context's bus instead using the already configured bus. To fix this issue , you just need to remove these three imports >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /> >> >> I just write a quick junit test[1] to verify this. [1] http://svn.apache.org/viewvc?rev=728897&view=rev Willem Glen Mazza wrote: > I would highly recommend waiting until Dan K. reviews this. He (and perhaps > Willem) would be in position best to know about all moving parts that may be > affected by this change. I suspect he is on holiday leave this week (and > possibly the next), however. > > Could the problem also be that you specified > 1 for *both* the servlets defined, > instead of giving them distinct values? Somehow I doubt that's the issue > though. > > Glen > > > > Tong, Gary (FID) wrote: >> Hello, >> >> I'm having issues with creating multiple CXFServlets. I'm trying to >> insantiate 2 independent CXF servlets and deploy them at different URLs. >> The relevant part of the web.xml looks like: >> >> >> test >> >> org.apache.cxf.transport.servlet.CXFServlet >> 1 >> >> config-location >> /WEB-INF/test-servlet.xml >> >> >> >> >> test >> /t/* >> >> >> >> foo >> >> org.apache.cxf.transport.servlet.CXFServlet >> 1 >> >> config-location >> /WEB-INF/foo-servlet.xml >> >> >> >> >> foo >> /f/* >> >> >> This, unfortunately, doesn't work. My test-servlet.xml file looks like: >> >> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:jaxrs="http://cxf.apache.org/jaxrs" >> xsi:schemaLocation=" >> http://www.springframework.org/schema/beans >> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> And foo-servlet.xml looks much the same. This configuration gives me a >> "No service was found." response. However, if I move the import >> statements to the base spring application context, both the test and foo >> servlets end up serving up test-servlet.xml and foo-servlet.xml gets >> ignored. >> >> As far as I can tell, this problem occurs because the configs specified in >> config-location aren't loaded until the majority of the servlet has been >> initialized. Because of this, most of the settings in test-servlet.xml >> and foo-servlet.xml are ignored during initialization. >> >> The order of initialization in CXFServlet seems to be: >> >> 1. Find the spring app context. >> 2. Create a new bus based on the app context. >> 3. Set up the servlet transport factory >> 4. Create the controller >> 5. Load the additional configuration from the config-location servlet >> param >> >> My proposed fix is to change the order of initialization to: >> >> 1. Find the spring app context. >> 2. Load the additional configuration from the config-location servlet >> param >> 3. Create a new bus based on the new child context (or original spring app >> context if there is no additional configuration) >> 4. Set up the servlet transport factory >> 5. Create the controller >> >> The attached diff does this and fixes the problem that I have with >> creating two CXFServlets. Hopefully this is the right way to do this. >> >> Thanks, >> Gary >> -------------------------------------------------------- >> >> This is not an offer (or solicitation of an offer) to buy/sell the >> securities/instruments mentioned or an official confirmation. Morgan >> Stanley may deal as principal in or own or act as market maker for >> securities/instruments mentioned or may advise the issuers. This is not >> research and is not from MS Research but it may refer to a research >> analyst/research report. Unless indicated, these views are the author's >> and may differ from those of Morgan Stanley research or others in the >> Firm. We do not represent this is accurate or complete and we may not >> update this. Past performance is not indicative of future returns. For >> additional information, research reports and important disclosures, >> contact me or see https://secure.ms.com/servlet/cls. You should not use >> e-mail to request, authorize or effect the purchase or sale of any >> security or instrument, to send transfer instructions, or to effect any >> other transactions. We cannot guarantee that any such requests received >> via e-mail will be processed in a timely manner. This communication is >> solely for the addressee(s) and may contain confidential information. We >> do not waive confidentiality by mistransmission. Contact me if you do not >> wish to receive these communications. In the UK, this communication is >> directed in the UK to those persons who are professional and eligible >> counterparties (as defined in the UK Financial Services Authority's >> rules). >> >> >