Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 12219 invoked from network); 21 Nov 2003 09:49:17 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 21 Nov 2003 09:49:17 -0000 Received: (qmail 58621 invoked by uid 500); 21 Nov 2003 09:48:30 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 58603 invoked by uid 500); 21 Nov 2003 09:48:30 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 58517 invoked from network); 21 Nov 2003 09:48:29 -0000 Received: from unknown (HELO mwinf0401.wanadoo.fr) (193.252.22.27) by daedalus.apache.org with SMTP; 21 Nov 2003 09:48:29 -0000 Received: from cyril (ASt-Lambert-108-1-5-223.w81-249.abo.wanadoo.fr [81.249.197.223]) by mwinf0401.wanadoo.fr (SMTP Server) with SMTP id 5A7A358000DA for ; Fri, 21 Nov 2003 10:48:41 +0100 (CET) Message-ID: <005b01c3b014$c1824380$dfc5f951@cyril> From: "cyril vidal" To: "Tomcat Users List" Subject: getContext returns null! Date: Fri, 21 Nov 2003 10:49:28 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0058_01C3B01D.22F41EB0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------=_NextPart_000_0058_01C3B01D.22F41EB0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I just would like to get a reference to the ServletContext of another = web application as the current one, to get a RequestDispatcher object. I know that the path should begin with / and that it is interpreted = relative to the server's document root . So i'm in a web application context and would like to get the context of = c:\tomcat\webapps\tutobean application. I've written the following code: protected void doGet(HttpServletRequest req, HttpServletResponse rep) throws ServletException, IOException { ServletContext currentSC =3D getServletContext(); //reference to the = current ServletContext ServletContext distantSC =3D currentSC.getContext("/tutobean"); = //reference to the ServletContext of tutobean webappl, corresponding to = http://localhost:8080/tutobean. distantSC.getRequestDispatcher("/index.html").forward(req,rep); = //NullPOinterException here because distantSC is null!!! What's wrong in my code? Thanks for your response, Regards, Cyril. ------=_NextPart_000_0058_01C3B01D.22F41EB0--