tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Boring <jwbor...@tampabay.rr.com>
Subject nullpointer (on forward) in tomcat (both 331 & 332)
Date Sat, 03 Aug 2002 13:01:32 GMT
The following servlet code throws nullpointer (on forward) in tomcat
(both 3.3.1 & 3.3.2). Any ideas where to start looking?

Jeff W. Boring
jwboring@tampabay.rr.com

------------------------------ code -----------------------------
public void forwardToNextPage(String nextPage, HttpServletRequest req,
HttpServletResponse res) throws IOException, ServletException {

  System.out.println("*****************************************");
  System.out.println("************ REQ ----->" + req.toString() );
  System.out.println("*****************************************");
  System.out.println("*****************************************");
  System.out.println("************ RES ----->" + res.toString() );
  System.out.println("*****************************************");

  ServletContext sc = null;
  RequestDispatcher rd = null;

  try {sc = getServletContext();}
  catch (NullPointerException np) {
    System.out.println("********************* NullPointerException on
getServletContext ********************");
    np.printStackTrace();
  }
  try {rd = sc.getRequestDispatcher(nextPage); }
  catch (NullPointerException np) {
     System.out.println("********************* NullPointerException on
getRequestDispatcher ********************");
     np.printStackTrace();
   }
   try {rd.forward(req, res);}
   catch (NullPointerException np) {
     System.out.println("********************* NullPointerException on
forward ********************");
     np.printStackTrace();
   }

----------------------- console --------------------------------------

********************* NullPointerException on forward
********************
java.lang.NullPointerException
        at
com.ibm.eadtraining.servlet.EADTrainingController.forwardToNextPage(E
ADTrainingController.java:89)
        at
com.ibm.eadtraining.servlet.EADTrainingController.submitLogin(EADTrai
ningController.java:212)
        at
com.ibm.eadtraining.servlet.EADTrainingController.doPost(EADTrainingC
ontroller.java:46)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
:570)
        at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
        at org.apache.tomcat.core.Handler.service(Handler.java:235)
        at
org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
81)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:917)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:833
)
        at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(
Http10Interceptor.java:176)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:508)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:533)
        at java.lang.Thread.run(Thread.java:479)


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message