Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 79333 invoked from network); 18 Sep 2009 18:24:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Sep 2009 18:24:51 -0000 Received: (qmail 62620 invoked by uid 500); 18 Sep 2009 18:24:47 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 62552 invoked by uid 500); 18 Sep 2009 18:24:47 -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 62539 invoked by uid 99); 18 Sep 2009 18:24:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Sep 2009 18:24:47 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mgainty@hotmail.com designates 65.55.111.78 as permitted sender) Received: from [65.55.111.78] (HELO blu0-omc2-s3.blu0.hotmail.com) (65.55.111.78) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Sep 2009 18:24:36 +0000 Received: from BLU142-W9 ([65.55.111.73]) by blu0-omc2-s3.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 18 Sep 2009 11:24:15 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_f39f642b-4e9e-4804-92c0-31abfbc9749b_" X-Originating-IP: [96.237.35.254] From: Martin Gainty To: Tomcat Users List Subject: RE: NullPointerException on Struts Action Date: Fri, 18 Sep 2009 14:24:15 -0400 Importance: Normal In-Reply-To: <4AB3AF7B.5010705@christopherschultz.net> References: <4AB3AF7B.5010705@christopherschultz.net> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Sep 2009 18:24:15.0940 (UTC) FILETIME=[3AAC6040:01CA388D] X-Virus-Checked: Checked by ClamAV on apache.org --_f39f642b-4e9e-4804-92c0-31abfbc9749b_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable be sure to populate user=2Cpassword=2CDriverClass for DataSource with Datab= ase Parameters beforehand e.g. //web.xml Struts Examples Application action org.apache.struts.action.ActionServlet org.apache.struts.action.DATA_SOURCE org.apache.struts.util.GenericDataSource ........ chris ..struts-1.2.9 is only 3 years old BTW http://struts.apache.org/1.1/api/org/apache/struts/util/GenericDataSource.h= tml Martin Gainty=20 ______________________________________________=20 Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9 =20 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein=2C so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiter= leitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient l= ediglich dem Austausch von Informationen und entfaltet keine rechtliche Bin= dungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen w= ir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=EAtes= pas le destinataire pr=E9vu=2C nous te demandons avec bont=E9 que pour sat= isfaire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=E9e= ou la copie de ceci est interdite. Ce message sert =E0 l'information seule= ment et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9tant d= onn=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulation= =2C nous ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni= . > Date: Fri=2C 18 Sep 2009 12:04:11 -0400 > From: chris@christopherschultz.net > To: users@tomcat.apache.org > Subject: Re: NullPointerException on Struts Action >=20 > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > Julio=2C >=20 > On 9/18/2009 9:44 AM=2C Julio C=E9sar Chaves Fern=E1ndez wrote: > > Hi=2C i've been having a strange behavior with some struts apps deploye= d on Oracle portal. >=20 > Given that this is Struts running on Oracle=2C why not ask your question > on the Struts list or ask someone at Oracle? This is a forum for Apache > Tomcat users. :( >=20 > > 09/09/17 16:10:19 java.lang.NullPointerException > > 09/09/17 16:10:19 at org.apache.struts.action.Action.getDataSource(= Action.java:532) > > 09/09/17 16:10:19 at co.edu.icesi.notas.action.InicioAction.execute= (InicioAction.java:46) >=20 > [snip] >=20 > Wow=2C you're using Action.getDataSource? Wasn't that deprecated like 5 > years ago? >=20 > > InicioAction is the init action that sets some data in the user > > session and makes some validations. The code in Action.java at line 532= is: > >=20 > > protected DataSource getDataSource(HttpServletRequest request=2C String= key) > > { > > ServletContext context =3D getServlet().getServletContext()=3B ---= ----------------------> line 532 > > ModuleConfig moduleConfig =3D RequestUtils.getModuleConfig(request= =2C context)=3B > >=20 > > return ((DataSource)context.getAttribute(key + moduleConfig.getPref= ix()))=3B > > } >=20 > Are you sure you're looking at the right version of the code? >=20 > Are you doing something silly like trying to use this Action before it > has been properly brought into service? If that's the case=2C then > getServlet() would return null. >=20 > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >=20 > iEYEARECAAYFAkqzr3sACgkQ9CaO5/Lv0PA5UACdG+1Bhn2dhBuIHqF0E/gIKCWJ > lxYAnjcN1rTlDXhEcf3+F1x0f3xiTqBV > =3DPB58 > -----END PGP SIGNATURE----- >=20 > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: users-unsubscribe@tomcat.apache.org > For additional commands=2C e-mail: users-help@tomcat.apache.org >=20 _________________________________________________________________ Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. http://clk.atdmt.com/GBL/go/171222985/direct/01/= --_f39f642b-4e9e-4804-92c0-31abfbc9749b_--