Jsp error - in tomcat

tejas_shah
tejas_shah used Ask the Experts™
on
I am trying to run a jsp page which accesses Bean, which in turn uses database to access values. When I try to run the jsp page in tomcat, I get the following error.

**********
root cause

org.apache.jasper.JasperException: /jsp/encylcopedia/jobNYLSystemData.jsp(5,32) jsp.error.attribute.noequal

***********

The error line # is at the beginning of a scriptlet using <jsp:useBean > tag.

Please help if anyone knows the solution. thank you.

thanks,
Tejas shah
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mick BarryJava Developer
Top Expert 2010

Commented:
can you post your jsp code

Author

Commented:
Here is my JSP code.


<%@ page import="java.util.*, java.io.* %>

<html>
<body>
<%
 <jsp:useBean id="myEncyclopedia" scope="session" class="encyclopedia.EncyclopediaDAO" />
 String theJob = request.getParameter("job");
 
 List theList =  myEncyclopediaDAO.getJobNYLSystemData( theJob );
 session.setAttribute("nylSystemList", theList);
 
 %>
 
 
 
<jsp:forward page = "/jsp/encyclopedia/newYorkLifeSystem.jsp" />


 </body>
 </html>

I also tried with request.setParameters, but it didn't work. It gives the same error.

Author

Commented:
Here is my JSP code.


<%@ page import="java.util.*, java.io.* %>

<html>
<body>
<%
 <jsp:useBean id="myEncyclopedia" scope="session" class="encyclopedia.EncyclopediaDAO" />
 String theJob = request.getParameter("job");
 
 List theList =  myEncyclopediaDAO.getJobNYLSystemData( theJob );
 session.setAttribute("nylSystemList", theList);
 
 %>
 
 
 
<jsp:forward page = "/jsp/encyclopedia/newYorkLifeSystem.jsp" />


 </body>
 </html>

I also tried with request.setParameters, but it didn't work. It gives the same error.
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Mick BarryJava Developer
Top Expert 2010

Commented:
and what does the class 'encyclopedia.EncyclopediaDAO' look like?

Commented:
Move your useBean tag outside of your scriptlet.

Author

Commented:
This is just one method of the DAO.

// A Data Access object to retrieve information from the Enterprise Encyclopedia
//EncylpediaDAO.java
package encyclopedia;

import java.sql.*;
import java.util.*;

public class EncyclopediaDAO {
    protected Connection myConn;

    public EncyclopediaDAO( ) throws Exception {


        //Step 1 - Load the driver
        String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
        String dbUrl = "jdbc:odbc:EnterpriseDSN";


        try {
             //Step 1 - Load the driver
            Class.forName(driverName);

            //Step 2: Get a connection
            Connection myConn = DriverManager.getConnection(dbUrl, "", "");

           }
           catch(SQLException exc) {
                exc.printStackTrace();
           }

          catch(ClassNotFoundException exc) {
                exc.printStackTrace();
           }
      } // end constructor



     //get job related NYLSystem Data
     public List getJobNYLSystemData( String job ) throws SQLException {
          List nylSystemList = new ArrayList();

            try {

// Step 3 Create and execute statement result
Statement myStmt = myConn.createStatement();

ResultSet myRs = myStmt.executeQuery(
"SELECT Job.jobNm, Job.NYLSystemCd, NYLSystem.NYLSystemDn, NYLSystem.NYLSystemOwnerNm " +
"FROM NYLSystem, Job WHERE Job.jobNm = '" + job + "' and Job.NYLSystemCd = NYLSystem.NYLSystemCd");

// step 4 process results

while(myRs.next() ) {
     String jobName = myRs.getString("Job.jobNm");
String newYorkLifeSystemCd = myRs.getString("Job.NYLSystemCd");
String newYorkLifeSystemDn = myRs.getString("NYLSystem.NYLSystemDn");
String newYorkLifeSystemOwnerNm = myRs.getString("NYLSystem.NYLSystemOwnerNm");
String functionName = null;
NewYorkLifeSystemBean tempSystemBean = new NewYorkLifeSystemBean(newYorkLifeSystemCd,
                        newYorkLifeSystemDn, newYorkLifeSystemOwnerNm, jobName, functionName);


                    nylSystemList.add(tempSystemBean);

                    }
                    myRs.close();
                    myStmt.close();
               }
               catch(SQLException exc) {
                    exc.printStackTrace();
               }


               return nylSystemList;
          }


}


Mick BarryJava Developer
Top Expert 2010

Commented:

can you post the full stack trace.

Author

Commented:
I changed a few things....i closed the quotes on the <%@ page import tag. and switched back to request.setParameter and request.getParameter. and I also made the EnterpriseDAO class serializable and try to run it.
Here is the code for newYorkLifeSystem.jsp

<%@ page import="java.util.*, java.io.*, java.util.*" isThreadSafe="true" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Output</TITLE>
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF">
<%-- Determining if the Job page called it or the business function called it --%>

<%
 String theJob = request.getParameter("job");
 
 
out.println("The New York Life Systems for the" + theJob + "job are");




%>

<%-- retrieving the list from the request object --%>
<%
   
   List theList = request.getParameter("nylSystemList");
   Iterator myIterator = theList.iterator();
   while( myIterator.hasNext()) {
   <jsp:useBean id="tempBean" scope="request" class="encyclopedia.NewYorkLifeSystemBean" />
       tempBean = (NewYorkLifeSystemBean) myIterator.next();
 %>
 
 <TABLE ALIGN="left" BORDER=5 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
 <TR ALIGN="left" VALIGN="middle">
       <TH>Job Name</TH>
       <TH>New York Life System Code</TH>
       <TH>New York Life System Description</TH>
       <TH>New York Life System Owner Name</TH>
       <TH>Business Function</TH>
       
 <TR ALIGN="left" VALIGN=middle">
       <TD> <%= tempBean.getJobName() %> </TD>
       <TD> <%= tempBean.getNewYorkLifeSystemCd() %> </TD>
       <TD> <%= tempBean.getNewYorkLifeSystemDn() %> </TD>
       <TD> <%= tempBean.getNewYorkLifeSystemOwnerNm() %> </TD>
       <TD> <%= tempBean.getBusinessFunctionName() %> </TD>
 </TABLE>
 
 <% } %>
 
 
</BODY>
</HTML>




NOw I am getting different error and here is the stack trace.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:477)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:471)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
      at java.lang.Thread.run(Thread.java:536)


root cause

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
    [javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:47: illegal start of expression
 
 ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:47: ';' expected
 
                                                  ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:47:  expected
 
                                                       ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:48: '{' expected
 String theJob = request.getParameter("job");
                                            ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:51:  expected
 request.setParameter("nylSystemList", theList);
                     ^



An error occurred at line: 16 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:53:  expected
       out.write("\r\n \r\n \r\n \r\n ");
                ^



An error occurred at line: 16 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:54: illegal start of type
      if (true) {
      ^



An error occurred at line: 19 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:58:  expected
      out.write("\r\n\r\n\r\n ");
                                ^



An error occurred at line: 20 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:59:  expected
      out.write("\r\n ");
               ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:60:  expected
      out.write("\r\n \r\n \r\n ");
               ^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:61: 'catch' without 'try'
    } catch (Throwable t) {
      ^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:32: 'try' without 'catch' or 'finally'
    try {
    ^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:70: '}' expected
}
 ^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:51: package request does not exist
 request.setParameter("nylSystemList", theList);
        ^



An error occurred at line: 16 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:53: package out does not exist
       out.write("\r\n \r\n \r\n \r\n ");
          ^



An error occurred at line: 20 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:59: package out does not exist
      out.write("\r\n ");
         ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:60: package out does not exist
      out.write("\r\n \r\n \r\n ");
         ^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:50: cannot resolve symbol
symbol  : variable theJob
location: class
 List theList =  myEncyclopediaDAO.getJobNYLSystemData(theJob);
                                                       ^



An error occurred at line: 5 in the jsp file: /jsp/encylcopedia/jobNYLSystemData.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\jsp\encylcopedia\jobNYLSystemData_jsp.java:50: cannot resolve symbol
symbol  : variable myEncyclopediaDAO
location: class
 List theList =  myEncyclopediaDAO.getJobNYLSystemData(theJob);
                 ^
19 errors


      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
      at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:471)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
      at java.lang.Thread.run(Thread.java:536)



Mick BarryJava Developer
Top Expert 2010

Commented:
Try adding the following to the top of the file:

<%@ page language="java" contentType="text/html" %>

Author

Commented:
Tried adding <%@ page language %> tag...still getting same errors. uggh this logic seems so straight forward and yet, fixing the errors is so difficult.

Mick BarryJava Developer
Top Expert 2010

Commented:
Actually those don't even appear to be from that page, they appear to be from jobNYLSystemData.jsp.

Commented:
I think my first comment is correct. The scriptlet tag can't contain the useBean tag. At least that is my theory.

Commented:
<%
  List theList = (List)request.getParameter("nylSystemList");
  Iterator myIterator = theList.iterator();
  while( myIterator.hasNext()) {
%>
  <jsp:useBean id="tempBean" scope="request" class="encyclopedia.NewYorkLifeSystemBean" />
<%
  tempBean = (NewYorkLifeSystemBean) myIterator.next();
%>

Commented:
To syd108,
request.getParameter(("nylSystemList") will return a String object and you can't cast it to a List object.



Author

Commented:
Here is the error stack that I am getting now.
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:246)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:427)
      at org.apache.jsp.jobNYLSystemData_jsp._jspService(jobNYLSystemData_jsp.java:59)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:202)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:471)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
      at java.lang.Thread.run(Thread.java:536)


root cause

java.lang.NullPointerException
      at org.apache.jsp.newYorkLifeSystem_jsp._jspService(newYorkLifeSystem_jsp.java:74)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:202)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:427)
      at org.apache.jsp.jobNYLSystemData_jsp._jspService(jobNYLSystemData_jsp.java:59)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:202)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:471)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
      at java.lang.Thread.run(Thread.java:536)




and here is my code for newYorkLifeSystemLife.jsp
<%@ page import="java.util.*, java.io.*, java.util.* isThreadSafe="true" %>
<%@ page import="encyclopedia.*" %>
<jsp:useBean id= "tempBean"  class="encyclopedia.NewYorkLifeSystemBean" scope= "session">
</jsp:useBean>



<HTML>
<HEAD>
<TITLE>Output</TITLE>
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF">

<%
 String theJob = request.getParameter("job");
 out.println("The New York Life Systems for the" + theJob + "job are");
%>


<%
   List theList = (List) session.getAttribute("nylSystemList");
   Iterator myIterator = theList.iterator();
   while( myIterator.hasNext() ) {
       
         tempBean = (NewYorkLifeSystemBean) myIterator.next();
 %>
 
 <TABLE ALIGN="left" BORDER=5 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
 <TR ALIGN="left" VALIGN="middle">
       <TH>Job Name</TH>
       <TH>New York Life System Code</TH>
       <TH>New York Life System Description</TH>
       <TH>New York Life System Owner Name</TH>
       
 </TR>      
 <TR ALIGN="left" VALIGN=middle">
       <TD> <%= tempBean.getJobName() %> </TD>
       <TD> <%= tempBean.getNewYorkLifeSystemCd() %> </TD>
       <TD> <%= tempBean.getNewYorkLifeSystemDn() %> </TD>
       <TD> <%= tempBean.getNewYorkLifeSystemOwnerNm() %> </TD>
 </TR>      
 
 </TABLE>
 
 <% } %>
 
 
</BODY>
</HTML>




Java Developer
Top Expert 2010
Commented:
Hard to say for sure by my guess would be that your list is not present in your session.
Check if 'theList' is null.
Commented:
objects is probably right.
To check you can look in Tomcat's work directory for the file.
>newYorkLifeSystem_jsp.java:74)

Commented:
to rrz:

Ty i stand corrected, for some reason i was thinking that it was an attribute on request.

Commented:
Line 74 of ur compiles jsp throws a null pointer exception:
java.lang.NullPointerException
     at org.apache.jsp.newYorkLifeSystem_jsp._jspService(newYorkLifeSystem_jsp.java:74)

Check and see what is being accesed or assigned. My guess if your list if not present. You print the size of ur list size() . You can also check to see if it is null.

Commented:
Line 74 of ur compiles jsp throws a null pointer exception:
java.lang.NullPointerException
     at org.apache.jsp.newYorkLifeSystem_jsp._jspService(newYorkLifeSystem_jsp.java:74)

Check and see what is being accesed or assigned. My guess if your list if not present. You print the size of ur list size() . You can also check to see if it is null.

Author

Commented:
I figured out the answer, I had forgotten to close the quotation mark in the following statement
<%@ page import="java.io.*, java.util.*" isThreadSafe ="true" %> and in the code I was doing
 List theList =  myEncyclopediaDAO.getJobNYLSystemData("job");
instead of gettting the request parameter
 List theList =  myEncyclopediaDAO.getJobNYLSystemData(request.getParameter("job"));
and that's why I was getting the null pointer exception.

Thanks to all the people who tried to help. I appreciate it.

Tejas

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between rrz@871311 and objects.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

krispols
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial