Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-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 A87BF6D4E for ; Wed, 22 Jun 2011 14:37:24 +0000 (UTC) Received: (qmail 50918 invoked by uid 500); 22 Jun 2011 14:37:21 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 50863 invoked by uid 500); 22 Jun 2011 14:37:20 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 50854 invoked by uid 99); 22 Jun 2011 14:37:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2011 14:37:20 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bimargulies@gmail.com designates 209.85.214.45 as permitted sender) Received: from [209.85.214.45] (HELO mail-bw0-f45.google.com) (209.85.214.45) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2011 14:37:14 +0000 Received: by bwz16 with SMTP id 16so1265709bwz.18 for ; Wed, 22 Jun 2011 07:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=3c1m6yFArhr5qm1tNeQAOVobBgYyVAnkZdUe/L5BUVo=; b=A8a5hgRTr5sbnfmHDHkffmKRh53jC9yJ9t35FnAusqWLGjuwJsJpQo4CqHLHHYYaXO S+eSaNlx+WPE5o/xPgBiKWBhhRZU6XLow9EuBObptATpLVYsXea3QpP1YLtBYy3QhEO+ TjzvuDvzWwayEbV40f+A2gwe7LV8VSwv9+wCo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=c5mtWbkMfiNC+ps2Z2ODGqF2Drb/f5X8cR4aMxF18q2/gvXKQXlinX+3LN5P7JwxUP 4Glgw4m7Jes0XGsi6U7Tpb8zv/JqfbGwFQpl7ZHacLbcr6vP6Z2CuG+S4jZqrUh06Hhg mowv41F8iqbBmpxNzR9ogkAPaLDBBqUBcXX8M= MIME-Version: 1.0 Received: by 10.205.33.66 with SMTP id sn2mr295042bkb.0.1308753412824; Wed, 22 Jun 2011 07:36:52 -0700 (PDT) Received: by 10.204.117.212 with HTTP; Wed, 22 Jun 2011 07:36:52 -0700 (PDT) In-Reply-To: <4E01FBB7.3020606@apache.org> References: <4E01F579.70808@apache.org> <4E01FBB7.3020606@apache.org> Date: Wed, 22 Jun 2011 10:36:52 -0400 Message-ID: Subject: Re: Adding a webapp to a running embedded tomcat 7 with an 'improved' class loader results in missing classes? From: Benson Margulies To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I agree with your preference. Patch to follow later today. On Wed, Jun 22, 2011 at 10:27 AM, Mark Thomas wrote: > On 22/06/2011 15:18, Benson Margulies wrote: >> Solr has a particularly bizarre class loading environment. The class >> causes the problem is the FileUploadServlet from commons-fileupload. I >> doubt that the problem is validation, but I'll check. >> >> My experience is that, in the stock Tomcat class, the new context gets >> called through .start() before the addWebapp function returns, if the >> container is already running. > > Ah, if the container is already running then that would explain it. I'm > fairly sure (without looking at the code) that any change to the loader > will be ignored. > >> I made a subclass of Tomcat which accepted a loader as another >> argument to addWebapp, and sets it before calling addChild on the >> host. >> >> That cured the problem. Would you be interested in a patch containing >> this additional overload? >> >> Or would it make more sense to have a function createWebapp that left >> out the addChild and left that to the caller? > > I'd be happy with either with a slight preference for the second. (I > have an aversion to methods that gather more and more parameters over tim= e.) > > Mark > >> On Wed, Jun 22, 2011 at 10:00 AM, Mark Thomas wrote: >>> On 22/06/2011 14:47, Benson Margulies wrote: >>>> The equivalent basic scheme worked perfectly fine in tomcat6. In >>>> Tomcat7, it looks like: >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 solrContext =3D tomcat.addWe= bapp("/solr", >>>> solrWebapp.getCanonicalPath()); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 WebappLoader solrLoader =3D = new >>>> WebappLoader(LSHDemoLauncher.class.getClassLoader()); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 solrContext.setLoader(solrLo= ader); >>>> >>>> >>>> I am pulling my hair out because some classes sitting in the >>>> WEB-INF/lib dir of the solr webapp are not found. I've debugged into >>>> the class loader sufficiently to see that the right jars are in the >>>> right place. >>> >>> Some classes or all classes? If some, which ones? Are some JARs falling >>> foul of WebappClassLoader#validateJarFile()? >>> >>>> It occurs to me that this might be just as silly as that I need to get >>>> the class loader set inside of addWebapp so that it is in place before >>>> the call to host.addChild(). If anyone happens to have any advice, I'd >>>> be grateful, else I'll be going ahead to perform experiments. >>> >>> Unlikely. As long as the class loader is set before the Context starts >>> you should be fine. >>> >>> Mark >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>> For additional commands, e-mail: users-help@tomcat.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org