Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

How do I print out line of code that caused the error?

D. Alvarado

2006-11-28

Replies:

Hi, I'm using Tomcat 5.5 with Apache 2. Upon getting jsp compilation
errors, I'm not told any inofrmation about the code the causaed the
error and the line printed is incorrect. What do I need to configure
to correct this? For example, this page below:

<%@(protected).*" %>
<%
    Object v = new String("b");
    session.setAttribute("a", v);

    Enumeration e = session.getAttributeNames();
    while (e.hasMoreElements()) {
          String attr = (String) e.nextElement();
          String v1 = session.getAttribute(attr);
          String v2 = session.getValue(attr);
          out.println("attr: " + attr + " v1:" + v1 + " v2:" +
v2 + "<BR>\n");
    }  // while
%>

causes this error. You can eventually figure out the problem, but
"line 2" is not right.

=============begin error========================
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

An error occurred at line: 2 in the jsp file: /session_vars.jsp
Generated servlet error:
Type mismatch: cannot convert from Object to String

An error occurred at line: 2 in the jsp file: /session_vars.jsp
Generated servlet error:
Type mismatch: cannot convert from Object to String


 org.apache.jasper.servlet.JspServletWrapper.handleJspException (JspServletWrapper.java:512)
 org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:377)
 org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service (JspServlet.java:264)
 javax.servlet.http.HttpServlet.service (HttpServlet.java:802)

=======================end error======================

Thanks, - Dave

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.