Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 15365 invoked from network); 16 Jul 2008 12:59:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jul 2008 12:59:07 -0000 Received: (qmail 40943 invoked by uid 500); 16 Jul 2008 12:58:54 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 40906 invoked by uid 500); 16 Jul 2008 12:58:54 -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 40895 invoked by uid 99); 16 Jul 2008 12:58:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 05:58:54 -0700 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: local policy) Received: from [203.115.0.56] (HELO pop3.sltnet.lk) (203.115.0.56) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 12:58:00 +0000 Received: from ovw1.sltnet.lk ([192.168.3.78]) by pop3.sltnet.lk (Sun Java System Messaging Server 6.2-4.03 (built Sep 22 2005)) with ESMTP id <0K43005LSNYLGI20@pop3.sltnet.lk> for users@tomcat.apache.org; Wed, 16 Jul 2008 18:26:45 +0530 (LKT) Received: from ovw1.sltnet.lk (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with SMTP id EF0C4FC06B for ; Wed, 16 Jul 2008 17:51:12 +0530 (IST) Received: from Rifka (unknown [124.43.65.195]) by ovw1.sltnet.lk (Postfix) with ESMTP id 2D2FCFC068 for ; Wed, 16 Jul 2008 17:51:12 +0530 (IST) Date: Wed, 16 Jul 2008 18:24:31 +0530 From: quikpak Subject: Re: Embedded Tomcat To: Tomcat Users List Message-id: <018a01c8e743$17298040$0201a8c0@Rifka> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Mailer: Microsoft Outlook Express 6.00.2600.0000 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 X-MSMail-priority: Normal X-PMX-Version: 5.4.1.325704, Antispam-Engine: 2.6.0.325393, Antispam-Data: 2008.7.16.124320 References: <5dd474260807150859q5c44e613yf3b1ad83ab75dd5c@mail.gmail.com> <4B8C80F59C4E0E4AB59F4006D8F0257E02432784@dojexch01.doj.state.wi.us> <5dd474260807160233r728d3a37j3f915669be62c07d@mail.gmail.com> X-Perlmx-Spam: Gauge=IIIIIII, Probability=7%, Report='LEO_OBFU_SUBJ_RE 0.1, BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, RDNS_NXDOMAIN 0, RDNS_SUSP 0, RDNS_SUSP_GENERIC 0, USER_AGENT_OE 0, __BOUNCE_CHALLENGE_SUBJ 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_419_BODY_WEBMAIL 0, __FRAUD_419_WEBMAIL 0, __HAS_MSGID 0, __HAS_MSMAIL_PRI 0, __HAS_X_MAILER 0, __HAS_X_PRIORITY 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT_MS_GENERIC 0' X-Virus-Checked: Checked by ClamAV on apache.org i dont want tomcat mails hereafter because im not a member........... ----- Original Message ----- From: "Joe Walker" To: "Tomcat Users List" Sent: Wednesday, July 16, 2008 3:03 PM Subject: Re: Embedded Tomcat > Thanks for the reply - I've been doing some digging into where the NPE > happens, and while I'm sure it has something to do with my Embedded setup > (it works just fine when I point a full Tomcat at the war file using a > Context file), there are other things I need to look at, which are nothing > to do with Embedding - I'll start another thread on CometProcessor, and > maybe come back to this once I'm sure that comet isn't to blame. > > Thanks, > > Joe. > > > On Tue, Jul 15, 2008 at 6:00 PM, Radcliffe, William H. < > RadcliffeWH@doj.state.wi.us> wrote: > > > Joe wrote: > > > > > I'm not getting any exceptions on startup, and the exact war file that > > I'm > > pointing is found because it's serving HTML > > > and even my servlet just fine. > > > But when I get a ServletContext, it's null. I've got a set of tomcat jars > > in the classpath (catalina, annorations-api, > > > tomcat-coyote, tomcat-juli, servlet-api) > > > > > > I don't know if you are crossing contexts or not, but it doesn't look like > > you setCrossContext(true) on the context you created. Should you? > > > > The API only says the following for setCrossContext(boolean crossContext): > > "Set the "allow crossing servlet contexts" flag." However, the Tomcat > > configuration reference seems to state that all calls to getContext will > > return null unless you set the context's crossContext parameter to true. > > When the parameter is true, the configuration reference specifically states > > that other contexts will have access through the > > ServletContext.getContext() > > method. When it is set to false, the reference no longer mentions other > > contexts, it states that getContext() will always return null. I'm > > assuming > > that the setCrossContext method and crossContext parameter have the same > > effect. > > > > I don't know if any of this applies in your case. > > > > > > > > From http://tomcat.apache.org/tomcat-6.0-doc/api/index.html: > > > > setCrossContext > > public void setCrossContext(boolean crossContext)Set the "allow crossing > > servlet contexts" flag. > > > > Specified by: > > setCrossContext in interface Context > > Parameters: > > crossContext - The new cross contexts flag > > > > > > > > From http://tomcat.apache.org/tomcat-6.0-doc/config/context.html: > > > > crossContex: Set to true if you want calls within this application to > > ServletContext.getContext() to successfully return a request dispatcher for > > other web applications running on this virtual host. Set to false (the > > default) in security conscious environments, to make getContext() always > > return null. > > > > Bill > > > > -----Original Message----- > > From: joseph.walker@gmail.com [mailto:joseph.walker@gmail.com] On Behalf > > Of > > Joe Walker > > Sent: Tuesday, July 15, 2008 10:59 AM > > To: users@tomcat.apache.org > > Subject: Embedded Tomcat > > > > Maybe I missed some docs somewhere, but my embedded Tomcat isn't working > > properly. > > I doing essentially this: > > > > Embedded embedded = new Embedded(); > > > > embedded.setCatalinaBase("."); > > > > Engine engine = embedded.createEngine(); > > > > > > Host host = embedded.createHost("localhost", "."); > > > > engine.addChild(host); > > > > Context context = embedded.createContext("/dwr", "target/ant/web/demo"); > > > > host.addChild(context); > > > > > > embedded.addEngine(engine); > > > > > > Connector connector = embedded.createConnector("localhost", 8080, false); > > > > embedded.addConnector(connector); > > > > embedded.start(); > > > > And my web-app starts OK, however the ServletContext seems to be null, so > > the > > web-app fails. > > > > I'm not getting any exceptions on startup, and the exact war file that I'm > > pointing is found because it's serving HTML and even my servlet just fine. > > But when I get a ServletContext, it's null. I've got a set of tomcat jars > > in > > the classpath (catalina, annorations-api, tomcat-coyote, tomcat-juli, > > servlet-api) > > > > Any clues where to look? > > > > Joe. > > > > --------------------------------------------------------------------- > > To start a new topic, e-mail: users@tomcat.apache.org > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > > For additional commands, e-mail: users-help@tomcat.apache.org > > > > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org