jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Halley <alan_halley2...@yahoo.com>
Subject Re: struts testcase... NullPointerException...
Date Tue, 19 Mar 2002 11:29:54 GMT

 Hi,
In my case the problem was caused by the default validation routine in ActionForm. If this
method is not overidden in your code then the default method returns a null and this seems
to be th root of the null pointer problem.
I overrode this method as follows:-
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)
{
 return new ActionErrors();
}
This appeared to cure the problem.
Alan
 
  vishal kumar singh <vishalkr@cisco.com> wrote: Bala,
This error might be becaue in ur struts-config.xml u have not specified the
form bean.
In ur 
u have the logical name for Form bean for that Action class

Check inside the tag

whether the form bean for the request is there or not.

Form Bean bein g accessed and given null pointer can be because it is not
populated when the form is submitted. This can occur because u might not have
associated the form bean with the request in struts config file and only
associate the request with action class or Maybe u have not given the complete
name inclufin gpackage name /relative name whatever u are using.

regards
Vishal


Vincent Massol wrote:

> Bala,
>
> Apparently you're not the only one having this problem. I have seen the
> same issue being raised. I don't know the answer as I've not used
> StrutsTestCase. Maybe you could also post the question on the
> StrutsTestCase forum/mailing-list on SourceForge (I don't know if
> there's any but there might be).
>
> Also, you might have some luck on the Struts users mailing list.
>
> Alternatively, if you don't get any answer, you can also debug the
> problem and submit a patch ;-)
>
> Good luck,
> -Vincent
>
> > -----Original Message-----
> > From: BALA KRISHNA [mailto:ebalki2002@yahoo.com]
> > Sent: 27 February 2002 23:17
> > To: cactus-user@jakarta.apache.org
> > Subject: struts testcase... NullPointerException...
> >
> > Hi,
> >
> > I am not sure if this is the place to post this...
> >
> > I am testing struts action classes using
> > strutstestcase1.5 (servlet2.2) with cactus 1.2.
> >
> > The test class extends CactusStrutsTestCase. I get the
> > following error. Can anyone explain me what is that I
> > am not doing right.
> >
> > =========================
> >
> > Testcase: testSuccessfulLogin took 4.306 sec
> > Caused an ERROR
> > null
> > java.lang.NullPointerException
> > at
> >
> servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCa
> se
> > .java:213)
> > ...
> >
> > ==========================
> >
> > The login action class that I am testing has a
> > associated loginform bean. This error is occuring only
> > when I test this action class that has a associated
> > actionform bean. My other action classes tests work
> > fine.
> >
> >
> > Thanks,
> > balki
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Greetings - Send FREE e-cards for every occasion!
> > http://greetings.yahoo.com
> >
> > --
> > To unsubscribe, e-mail: > > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: > > help@jakarta.apache.org>
> >
>
> --
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



---------------------------------
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message