tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Birchmire <tbirchm...@usa.net>
Subject Jasper compiler error (class not found)
Date Sat, 19 Jan 2002 09:32:33 GMT
Why won't Jasper compile this code? 

A. Original Code  counts.jsp  (<%@ page directive finds counterbean )
B. Generated Work File counts$jsp (counterbean imported )
C. Jasper Compiler Error 


A. Jsp file counts.jsp

<html>
<head>
<title>Counter JSP Test </title>
<style="font-family:courier">  </style>

</head>
<body bgcolor=white>
<%@ page language="java" import="counterbean.*" %>
<jsp:usebean id="countsit"
    class="counterbean"  
    scope="application"/>



<h2> Counter Test for JSP Bean </h2>


<table border="0" border="100%">
<% for (int i=0; i<35; i++) { %>



<tr>
  <td align="left">Date <%= i %> </td>
  <td> <%= countsit.getcount() %>    </td> 
  <td> count data  </td>
  <td> midline </td>


</tr>
<% } %>
</table>
</tt>
</body>
</html>

*********************************************************
B. Generated work file.   counts$jsp

package org.apache.jsp;

import counterbean.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class counts$jsp extends HttpJspBase {


    static {
    }
    public counts$jsp( ) {
    }

    private static boolean _jspx_inited = false;

    public final void _jspx_init() throws
org.apache.jasper.runtime.JspException {
    }

    public void _jspService(HttpServletRequest request, HttpServletResponse 
response)
        throws java.io.IOException, ServletException {

        JspFactory _jspxFactory = null;
        PageContext pageContext = null;
        HttpSession session = null;
        ServletContext application = null;
        ServletConfig config = null;
        JspWriter out = null;
        Object page = this;
        String  _value = null;
        try {

            if (_jspx_inited == false) {
                synchronized (this) {
                    if (_jspx_inited == false) {
                        _jspx_init();
                        _jspx_inited = true;
                    }
                }
            }
            _jspxFactory = JspFactory.getDefaultFactory();
            response.setContentType("text/html;charset=ISO-8859-1");
            pageContext = _jspxFactory.getPageContext(this, request,
response,
			"", true, 8192, true);

            application = pageContext.getServletContext();
            config = pageContext.getServletConfig();
            session = pageContext.getSession();
            out = pageContext.getOut();

            // HTML // begin [file="/counts.jsp";from=(0,0);to=(7,0)]
                out.write("<html>\r\n<head>\r\n<title>Counter JSP Test
</title>\r\n<style=\"font-family:courier\">  </style>\r\n\r\n</head>\r\n<body
bgcolor=white>\r\n");

            // end
            // HTML // begin [file="/counts.jsp";from=(7,50);to=(18,0)]
                out.write("\r\n<jsp:usebean id=\"countsit\"\r\n   
class=\"counterbean\"  \r\n    scope=\"application\"/>\r\n\r\n\r\n\r\n<h2>
Counter Test for JSP Bean </h2>\r\n\r\n\r\n<table border=\"0\"
border=\"100%\">\r\n");

            // end
            // begin [file="/counts.jsp";from=(18,2);to=(18,30)]
                 for (int i=0; i<35; i++) { 
            // end
            // HTML // begin [file="/counts.jsp";from=(18,32);to=(23,24)]
                out.write("\r\n\r\n\r\n\r\n<tr>\r\n  <td align=\"left\">Date
");

            // end
            // begin [file="/counts.jsp";from=(23,27);to=(23,30)]
                out.print( i );
            // end
            // HTML // begin [file="/counts.jsp";from=(23,32);to=(24,7)]
                out.write(" </td>\r\n  <td> ");

            // end
            // begin [file="/counts.jsp";from=(24,10);to=(24,31)]
                out.print( countsit.getcount() );
            // end
            // HTML // begin [file="/counts.jsp";from=(24,33);to=(30,0)]
                out.write("    </td> \r\n  <td> count data  </td>\r\n  <td>
midline </td>\r\n\r\n\r\n</tr>\r\n");

            // end
            // begin [file="/counts.jsp";from=(30,2);to=(30,5)]
                 } 
            // end
            // HTML // begin [file="/counts.jsp";from=(30,7);to=(37,0)]
               
out.write("\r\n</table>\r\n</tt>\r\n</body>\r\n</html>\r\n\r\n\r\n");

            // end

        } catch (Throwable t) {
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (pageContext != null) pageContext.handlePageException(t);
        } finally {
            if (_jspxFactory != null)
_jspxFactory.releasePageContext(pageContext);
        }
    }
}

****************************************************
C> Compiler error 


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

An error occurred at line: 25 in the jsp file: /counts.jsp

Generated servlet error:
/usr/jakarta/jakarta-tomcat-4.0.1/work/localhost/counterapp/counts$jsp.java:77:
Undefined variable or class name: countsit
                out.print( countsit.getcount() );
                           ^
1 error

        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:284)
        at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:546)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        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:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
        at java.lang.Thread.run(Thread.java:484)



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message