From user-return-7282-apmail-tuscany-user-archive=tuscany.apache.org@tuscany.apache.org Wed Nov 28 00:14:02 2012 Return-Path: X-Original-To: apmail-tuscany-user-archive@www.apache.org Delivered-To: apmail-tuscany-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A7180E264 for ; Wed, 28 Nov 2012 00:14:02 +0000 (UTC) Received: (qmail 21793 invoked by uid 500); 28 Nov 2012 00:14:02 -0000 Delivered-To: apmail-tuscany-user-archive@tuscany.apache.org Received: (qmail 21765 invoked by uid 500); 28 Nov 2012 00:14:02 -0000 Mailing-List: contact user-help@tuscany.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@tuscany.apache.org Delivered-To: mailing list user@tuscany.apache.org Received: (qmail 21758 invoked by uid 99); 28 Nov 2012 00:14:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Nov 2012 00:14:02 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [212.227.126.186] (HELO moutng.kundenserver.de) (212.227.126.186) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Nov 2012 00:13:54 +0000 Received: from [192.168.0.14] (w-194.cust-4723.ip.static.uno.uk.net [95.172.230.194]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MP1RX-1TYFoz2ogp-006TuD; Wed, 28 Nov 2012 01:13:23 +0100 Message-ID: <50B55746.2070406@apache.org> Date: Wed, 28 Nov 2012 00:13:58 +0000 From: Simon Nash User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: user@tuscany.apache.org Subject: Re: Tuscany class loading (was: Re: Using EMF with Tuscany 1.6) References: <32F15738E8E5524DA4F01A0FA4A8E490AEAD4D20@HQMBX5.eur.ad.sag> In-Reply-To: <32F15738E8E5524DA4F01A0FA4A8E490AEAD4D20@HQMBX5.eur.ad.sag> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:/+pYfLhpcTgxysuJQp0xdny+nGmWK0s9Fn/G19KyzM6 h0azQR07DWOrw24uZzRmTKlOZKaKRDOl3ryIo4TyygKi8xylqy Zv9DBhzauVWSQg5ay+vmVkNblUXp07nPjLx/1sf/z39QWmQf7g db1wsscZZcq9Gq54ZB/zMuLP8iGAhrcScXtSBDtyU6cELqoboG mToH1PDJduWpWikQ3Kzv2RiZDaWwqc4U3EvOSuOCO7k/6PGtGf nCnVFhkgv2BA+MHYUjlemH6xycR2Fncc/tMoiT2B9bw0I2QWwG rTEJkfdtZ8PPlyK5jaZVcAeZq75jkm2j9mGdTu+DoJJdAmAYvh uTRCocwhaRypEqDTedKE= X-Virus-Checked: Checked by ClamAV on apache.org Millies, Sebastian wrote: > Hello there, > > I've never been back to talk about this, so here goes. > > To re-iterate the problem: I want to set up my contributions, so that they can use > different versions of third-party libraries than the Tuscany runtime. My original example > was using recent versions of EMF (hence the subject line), another example is using > Tuscany with an Apache Solr 4.0 backend, which requires different Apache Http Components. > > The standard recommendation is [1], but I have had great trouble to get that to work. (The > reasons have to do with the use of SDOs in the application in question.) > > I have therefore decided to try the opposite approach of including any different versions of components > used by Tuscany in nested jars in the contribution itself. Nested jars in a zip contributionget added into > the contribution classpath. > > Here I am working under the assumption that the SCA contribution classloader would work > somewhat like a webapp class loader in that it would not follow the delegation model, > but would look for classes in the following order > 1) inside the contribution > 2) in the imports > 3) in the parent classloader > > With this behavior, everything goes well. For example, I can make calls to Apache Solr through > the solr-solrj-4.0.0.jar and its dependents, including httpclient-4.1.3.jar and httpcore-4.1.4.jar, > without impacting HTTP calls made by Tuscany-generated proxies elsewhere. > > Here's the snag: As it turned out, org.apache.tuscany.sca.contribution.java.impl.ContributionClassLoader DID > NOT work the way I expected, but rather looked in the parent classloader first, only then inside the contribution. > I had to change the coding (in module contribution-java) and the associated test. A patch is attached. > > Would my change break anything, perhaps with respect to OSGi? Is there anything in the SCA spec that mandates a > certain class loading behavior? I do feel that the alternative behavior is more natural than the one that is currently > implemented. (There a very few resources on Tuscany classloading, and e. g. [2] does not seem to mention > this particular issue.) > > Unfortunately, I cannot get all the Tuscany 1.6 tests to compile and run with maven. > > Please, would anyone be willing to see if Tuscany 1.6 with my patch applied would still pass all current tests? > (unless my proposal is obviously wrong for other reasons, of course) > I can run these tests on the Tuscany 1.x trunk tomorrow. Simon > Best, > Sebastian > > [2] https://cwiki.apache.org/TUSCANYWIKI/classloading.html > > -----Ursprüngliche Nachricht----- > Von: Simon Nash [mailto:nash@apache.org] > Gesendet: Samstag, 25. August 2012 09:17 > An: user@tuscany.apache.org > Betreff: Re: Using EMF with Tuscany 1.6 > > It's been over 2 years since I looked into this in detail and put together the list of gudelines in [1], so I don't recall 100% of the detail of how this works. See inline below for my impressions of what may be happening. > > [cut] > > I'll be interested to hear how you get on with that. > > Simon > >> -- Sebastian >> >>> [1] >>> http://mail-archives.apache.org/mod_mbox/tuscany-user/201006.mbox/%3C >>> 4C164DD3.8090405@apache.org%3E >>> > IDS Scheer Consulting GmbH > Geschäftsführer/Managing Directors: Michael Rehm, Ivo Totev > Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - Registergericht/Commercial register: Saarbrücken HRB 19681 > http://www.ids-scheer-consulting.com >