struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Caroline Jen <jiapei_...@yahoo.com>
Subject Struggled for Days. Please Help With This NullPointerException Problem.
Date Wed, 19 May 2004 23:10:23 GMT
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(RequestProcessor.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


Mime
View raw message