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 40F9862F5 for ; Mon, 20 Jun 2011 17:46:59 +0000 (UTC) Received: (qmail 23026 invoked by uid 500); 20 Jun 2011 17:46:55 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 22856 invoked by uid 500); 20 Jun 2011 17:46:55 -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 22847 invoked by uid 99); 20 Jun 2011 17:46:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 17:46:55 +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 (nike.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:46:49 +0000 Received: by bwz16 with SMTP id 16so1708457bwz.18 for ; Mon, 20 Jun 2011 10:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=e1qH9l7x5t0CBdVSt7p6JdmKPFUOwT/q5PSe/5/dWfY=; b=WEouuLTi7p57Gasx0H1+FmBNxlC+SjsVNEp/fjid/yF4MsitVGl7FkqIKJ7sFDWB8b naR5S0aDLYBfBQ4pO32fX/MCIshvfIrzJrN0l3k2HGOvVkMDTdGpkOc+EVNCUcDPqf9S zA3NcdRtRnSPxC/A09dvJru1VhBh5utP7HwHY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=haPh92GqVd+71E13SKoSaQdykP9Mpl6fv/1ChZ9Q2jlnHBcQbhbljCotGeRXLU6rVo LyKvsCoIugEkyLhN2ZBJikAeq4pW49PqnS0fkRl9yl7s080QCqQltxFRq5NjGbVDogzh g8Hn9ZhfjmE/AEirLo1H0qBREYtBCOAWW/qVQ= MIME-Version: 1.0 Received: by 10.204.83.73 with SMTP id e9mr783784bkl.118.1308591988763; Mon, 20 Jun 2011 10:46:28 -0700 (PDT) Received: by 10.204.58.207 with HTTP; Mon, 20 Jun 2011 10:46:28 -0700 (PDT) Date: Mon, 20 Jun 2011 13:46:28 -0400 Message-ID: Subject: Running an old servlet with Tomcat 7.0.16 embedded API From: Benson Margulies To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Ranier, I've now demonstrated that this is not about 'deferred launch' but rather about an old servlet failing to be configured with the embedded Tomcat class. https://github.com/bimargulies/Tomcat-Solr-Test-Case has been simplified. It makes the few required calls to set up the Tomcat object. Then it calls addWebapp for the solr webapp, and it failed with an NPE, due to the lack of the 'jsp' servlet from the usual global web.xml. The test cases you mentioned didn't bear on this case at all, I'll look for some others. --benson 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