tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: NullPointerException on Struts Action
Date Fri, 18 Sep 2009 18:24:15 GMT

be sure to populate user,password,DriverClass for DataSource with Database Parameters beforehand
e.g.

//web.xml
<web-app>
  <display-name>Struts Examples Application</display-name>
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>org.apache.struts.action.DATA_SOURCE</param-name>
      <param-value>org.apache.struts.util.GenericDataSource</param-value>
    </init-param>
........
</web-app>

chris ..struts-1.2.9 is only 3 years old BTW

http://struts.apache.org/1.1/api/org/apache/struts/util/GenericDataSource.html
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.




> Date: Fri, 18 Sep 2009 12:04:11 -0400
> From: chris@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: NullPointerException on Struts Action
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Julio,
> 
> On 9/18/2009 9:44 AM, Julio César Chaves Fernández wrote:
> > Hi, i've been having a strange behavior with some struts apps deployed on Oracle
portal.
> 
> Given that this is Struts running on Oracle, why not ask your question
> on the Struts list or ask someone at Oracle? This is a forum for Apache
> Tomcat users. :(
> 
> > 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)
> 
> [snip]
> 
> Wow, you're using Action.getDataSource? Wasn't that deprecated like 5
> years ago?
> 
> > 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:
> > 
> > protected DataSource getDataSource(HttpServletRequest request, String key)
> >   {
> >     ServletContext context = getServlet().getServletContext();  ------------------------->
line 532
> >     ModuleConfig moduleConfig = RequestUtils.getModuleConfig(request, context);
> > 
> >     return ((DataSource)context.getAttribute(key + moduleConfig.getPrefix()));
> >   }
> 
> Are you sure you're looking at the right version of the code?
> 
> Are you doing something silly like trying to use this Action before it
> has been properly brought into service? If that's the case, then
> getServlet() would return null.
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkqzr3sACgkQ9CaO5/Lv0PA5UACdG+1Bhn2dhBuIHqF0E/gIKCWJ
> lxYAnjcN1rTlDXhEcf3+F1x0f3xiTqBV
> =PB58
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message