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 98E6C678A for ; Mon, 20 Jun 2011 17:04:55 +0000 (UTC) Received: (qmail 44926 invoked by uid 500); 20 Jun 2011 17:04:52 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 44744 invoked by uid 500); 20 Jun 2011 17:04:51 -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 44735 invoked by uid 99); 20 Jun 2011 17:04:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 17:04:51 +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; Mon, 20 Jun 2011 17:04:47 +0000 Received: by bwz16 with SMTP id 16so1663686bwz.18 for ; Mon, 20 Jun 2011 10:04:26 -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=nrcGrsn5gV+cQGeVBqON7gVwIJ2Oksb0/h7MNZce0cU=; b=YZopdIalvanCCTu9yFPkb7U+l7tXqaH0wt2vwbGI4qCcE8fF15sOMHHscCc4QjGUy6 9arcEPeSyjpIdzLZO4ujFk7SUgzIHY4I4JtIhfEWb5J4kBBRPqeiLck/3sDz8oGsA+Ut woEiUuWdISmtLJLGJ4WVcb/m8iYsa34NvJ9JA= 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=iwDaxT2AUo+QZYq50k33O80RrcvbvI48iDxvWTciIkQ9Er3cOfctpQuMiu3fVofUCM uBuL3YHjjxx5sR71CrF4OASNzenOIUzA7d5pOlX5RhSIk7+p7/Ny+6+KHzzU/7mddq8n y5JGoa4Ry4pIkR3NSqReV7eWwDJ4y+YgKCYKg= MIME-Version: 1.0 Received: by 10.204.83.73 with SMTP id e9mr747792bkl.118.1308589465974; Mon, 20 Jun 2011 10:04:25 -0700 (PDT) Received: by 10.204.58.207 with HTTP; Mon, 20 Jun 2011 10:04:25 -0700 (PDT) In-Reply-To: <4DFF7BBC.8080503@kippdata.de> References: <4DFF7BBC.8080503@kippdata.de> Date: Mon, 20 Jun 2011 13:04:25 -0400 Message-ID: Subject: Re: Adding a webapp via the API to a running instance From: Benson Margulies To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I set up a testcase at https://github.com/bimargulies/Tomcat-Solr-Test-Case. Note that this is NOT a 3.0 webapp. I read the code, and the failing path is in the if statement for 'pre-3.0'. Please have a look at the single Java class in there and tell me what is wrong, since it seems quite straightforward to me. On Mon, Jun 20, 2011 at 12:56 PM, Rainer Jung wro= te: > Hi Benson, > > On 20.06.2011 17:51, Benson Margulies wrote: >> Reading org.apache.catalina.startup.Tomcat.addWebapp(Host, String, >> String, String), I don't understand the following: >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 // prevent it from looking ( if it finds one= - it'll have dup error ) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctxCfg.setDefaultWebXml("org/apache/catalin/= startup/NO_DEFAULT_XML"); >> >> Why is this being used to prevent the code from seeing a web.xml in >> the basedir/conf? > > I'd say it is not. > > Have a look at ourr test suite. It uses the jsp servlet without > programmatically configuring. I'm pretty sure it comes from the global > web.xml. The test suite also logs > > ... org.apache.catalina.startup.ContextConfig webConfig > ... INFO: No global web.xml found > > but that doesn't keep it from executing JSPs. > > For instance TestAbstractHttp11Processor deploys test/webapp-3.0 and > calls /echo-params.jsp. The basics are in TomcatBaseTest. > > So I'd say there's something wrong in your setup. > HTH. > > Rainer > >> On Mon, Jun 20, 2011 at 11:31 AM, Benson Margulies >> wrote: >>> I'm using import org.apache.catalina.startup.Tomcat to embed tomcat. >>> >>> After it is running, I'm trying to add another webapp with .addWebapp. >>> >>> The addWebapp call logs: >>> >>> 2011-06-20 11:23:23,385 ["http-bio-9167"-exec-2] INFO >>> org.apache.catalina.util.LifecycleBase - The start() method was called >>> on component [Realm[Simple]] after start() had already been called. >>> The second call will be ignored. >>> 2011-06-20 11:23:23,387 ["http-bio-9167"-exec-2] INFO >>> org.apache.catalina.startup.ContextConfig - No global web.xml found >>> >>> This second message is odd, since there is a global web.xml sitting in >>> the conf subdirectory of the pathname I passed to Tomcat.setBaseDir. >>> >>> However, this is followed in quick succession by an NPE. In >>> ContextConfig.java, jspServlet is null. Does it make sense that the >>> problem is the failure to find the global web.xml, since it would >>> define the jsp servlet? And, if so, why does this work for my first >>> webpp (defined before 'start') and not for my second? >>> >>> java.lang.NullPointerException >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.ContextConfig= .convertJsp(ContextConfig.java:1360) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.ContextConfig= .convertJsps(ContextConfig.java:1339) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.ContextConfig= .webConfig(ContextConfig.java:1330) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.ContextConfig= .configureStart(ContextConfig.java:881) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.ContextConfig= .lifecycleEvent(ContextConfig.java:316) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.util.LifecycleSupport= .fireLifecycleEvent(LifecycleSupport.java:119) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.util.LifecycleBase.fi= reLifecycleEvent(LifecycleBase.java:89) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.core.StandardContext.= startInternal(StandardContext.java:5103) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.util.LifecycleBase.st= art(LifecycleBase.java:145) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.core.ContainerBase.ad= dChildInternal(ContainerBase.java:812) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.core.ContainerBase.ad= dChild(ContainerBase.java:787) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.core.StandardHost.add= Child(StandardHost.java:607) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.Tomcat.addWeb= app(Tomcat.java:509) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.Tomcat.addWeb= app(Tomcat.java:483) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.apache.catalina.startup.Tomcat.addWeb= app(Tomcat.java:171) > > --------------------------------------------------------------------- > 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