struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul McCulloch <paul.mccull...@axiossystems.com>
Subject RE: Struggled for Days. Please Help With This NullPointerExcepti on Problem.
Date Thu, 20 May 2004 09:06:04 GMT
I'd start by getting the source for struts & scaffold. 

I'd then set a breakpoint in my debugger at the start of
org.apache.struts.scaffold.ParameterAction.findSuccess() and step through
until I found the NPE. I'd then look back up the call stack to try and
figure out what happened.

Paul

> -----Original Message-----
> From: Caroline Jen [mailto:jiapei_jen@yahoo.com]
> Sent: 20 May 2004 00:10
> To: struts-user@jakarta.apache.org
> Subject: Struggled for Days. Please Help With This 
> NullPointerException
> Problem.
> 
> 
> Please help me to find the possible place the problem
> comes from.
> 
> I have been struggling with this problem for days.  I
> tried a number of things but just could not get rid of
> the problem.
> 
> The Tomcat log does not give enough clue to trace
> where the problem occurs.  
> My class extends Action.  But the log keeps indicating
> the problem is from
> where the ParameterAction is.  I am completely
> disoriented.
> 
> I think the Tomcat console provides better clue (log
> messages are posted after the console messages):
> 
> org.apache.struts.util.PropertyMessageResources <init>
> 
> INFO: Initializing,
> config='org.apache.struts.taglib.logic.LocalStrings', 
> returnNull=true
> 
> org.apache.struts.util.PropertyMessageResources <init>
> INFO: Initializing,
> config='org.apache.struts.taglib.html.LocalStrings',
> returnNull=true
> 
> org.apache.struts.util.PropertyMessageResources <init>
> INFO: Initializing,
> config='org.apache.struts.util.LocalStrings',
> returnNull=true
> 
> org.apache.struts.util.PropertyMessageResources <init>
> INFO: Initializing,
> config='org.apache.struts.taglib.bean.LocalStrings',
> returnNull=true
> 
> WARNING: Unhandled Exception thrown: class
> java.lang.NullPointerException
> 
> Below are the log messages:
>  
> ----- Root Cause -----
> java.lang.NullPointerException
> 	at
> org.apache.struts.scaffold.ParameterAction.findSuccess(Unknown
> Source)
> 	at
> org.apache.struts.scaffold.BaseAction.execute(Unknown
> Source)
> 	at
> org.apache.struts.action.RequestProcessor.processActionPerform
> (RequestProcessor.java:484)
> 	at
> org.apache.struts.action.RequestProcessor.process(RequestProce
> ssor.java:274)
> .............
> .............
>  
> My struts-config.xml looks like:
> [CODE]
>     <action
>         roles="administrator,editor,contributor"
>         path="/message/ListThreads"
>         type="org.apache.artimus.message.ListThread"
>         name="articleForm"
>         scope="request"
>         validate="false"&gt;
>        <forward
>             name="success"
>             path="/signin/Welcome.jsp">;
>     </action>
> [/CODE]
> I have a java class ListThread.java that extends
> Action.  This java class simply calls a couple of
> helper classes to access my database.  In the end of
> the ListThread.java, it is a standard statement:
>  
>       return ( mapping.findForward( "success" ) );
> 
> [CODE]
> import LOTS OF PACKAGES AND CLASSES;
>  
> public final class ListThread extends Action
> {
>    public ActionForward execute(ActionMapping mapping,
>                                 ActionForm form,
>                                 HttpServletRequest
> request,
>                                 HttpServletResponse
> response)
>                                 throws Exception 
>    {
>  
>       String memberName = request.getRemoteUser();
>  
>       // for sort and order stuff
>       String sort  = request.getParameter( "sort" );
>       String order = request.getParameter( "order" );
>  
>       if ( sort.length() == 0 ) sort =
> "ThreadLastPostDate";
>       if ( order.length()== 0 ) order = "DESC";
>  
>       int offset  = 0;
>       int rows    =
> MessageInboxConfig.ROWS_IN_THREADS;
>       offset = Integer.parseInt( request.getParameter(
> "offset" ) );
>       rows = Integer.parseInt( request.getParameter(
> "rows" ) );
>  
>       ListThreadHandler lthandler = new
> ListThreadHandler();
>       ListPostHandler lphandler = new
> ListPostHandler();
>  
>       int totalThreads =
> lthandler.getNumberOfThreads_forReceiver( memberName
> );
>       if ( offset > totalThreads ) 
>       {
>          throw new BadInputException( "The offset is
> not allowed to be greater than total rows." );
>       }
>  
>       Collection beans =
> lthandler.getThreads_forReceiver_withSortSupport_limit(
> memberName, offset, rows, sort, order );
>  
>       SiteUtil.prepareNavigate( request, offset,
> beans.size(), totalThreads,
> MessageInboxConfig.ROWS_IN_THREADS );
>       int totalPosts =
> lphandler.getNumberOfPosts_forReceiver( memberName );
>  
>       request.setAttribute( "ThreadBeans", beans );
>       request.setAttribute( "TotalThreads", new
> Integer( totalThreads ) );
>       request.setAttribute( "TotalPosts", new Integer(
> totalPosts ) );
>  
>       return ( mapping.findForward( "success" ) );
>  
>    }
> }
> [/CODE]
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


**********************************************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not the addressee
indicated in this message (or responsible for delivery of the message to such person), you
may not copy or deliver this message to anyone. In such case, you should destroy this message,
and notify us immediately. If you or your employer does not consent to Internet email messages
of this kind, please advise us immediately. Opinions, conclusions and other information expressed
in this message are not given or endorsed by my Company or employer unless otherwise indicated
by an authorised representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via
electronic mail attachments we cannot guarantee that attachments do not contain computer virus
code.  You are therefore strongly advised to undertake anti virus checks prior to accessing
the attachment to this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for loss or damage
howsoever caused.
**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message