Results 1 to 6 of 6
  1. #1
    benperks is offline Member
    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0

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

    Hi

    I have spent the past few days scouring forums and the net looking for a solution to this. I have read a lot of fixes but as yet haven't had any luck correcting the error.
    The error is:
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    HTTP Status 500 -

    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: 263 in the generated java file
    Syntax error, insert "else Statement" to complete IfStatement

    An error occurred at line: 263 in the generated java file
    Syntax error, insert "}" to complete Block

    An error occurred at line: 273 in the generated java file
    Syntax error on token "}", delete this token

    An error occurred at line: 274 in the generated java file
    Syntax error, insert "}" to complete ClassBody

    Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.jav acError(Unknown Source)
    org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(Unknown Source)
    org.apache.jasper.compiler.JDTCompiler.generateCla ss(Unknown Source)
    org.apache.jasper.compiler.Compiler.compile(Unknow n Source)
    org.apache.jasper.compiler.Compiler.compile(Unknow n Source)
    org.apache.jasper.compiler.Compiler.compile(Unknow n Source)
    org.apache.jasper.JspCompilationContext.compile(Un known Source)
    org.apache.jasper.servlet.JspServletWrapper.servic e(Unknown Source)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(Unknown Source)
    org.apache.jasper.servlet.JspServlet.service(Unkno wn Source)
    javax.servlet.http.HttpServlet.service(Unknown Source)

    note The full stack trace of the root cause is available in the Apache Tomcat/6.0-snapshot logs.
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    The url on the error page is:
    10.0.0.241:8080/cca/docs/display_docs.jsp?cca_key=8356&field=cmpy_name&valu e=ROSE&type=Search&cmpyname=ROSE%20INNES%20AUCTION S%20CC&branch=East%20London&regno=200407393023&dt= Thu%20Jul%2017%202008%2015:44:38%20GMT+0200%20(SAS T)
    so I assume that the jsp in question is display_docs.jsp - but this script only has 126 lines.
    I have found the class that is created but the class is created new at runtime of the application so editing that is pointless.

    Is the error being caused due to the "Unknown Source"?
    If this is causing the problem, where can I get the known source?


    The code was developed in NetBeans 5.5 and is being run on an external server running Tomcat 6.
    My servlet.jar is set as /usr/share/tomcat-servlet-api-2.5/lib/servlet-api.jar

    I'm still searching and I'm that interested in finding the solution that I'm even willing to risk the sometimes rude and harsh comments from more experienced Java coders.

    Any input will be welcomed.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,558
    Rep Power
    25

    Default

    Is there another display_docs.jsp that could be the one used?
    Could you post the one you found?

    I think the Unknown souce message is because the class being traced wasn't compiled with the -g option.

  3. #3
    benperks is offline Member
    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0

    Default

    (removed command for link)="<%="../uploaded_docs/" + request.getParameter("regno") + "/PF" + new Integer(i).toString() + "_" + request.getParameter("regno") + ".htm"%>" target="_new">Profile on file <%=new Integer(i).toString()%></a></td></tr><%
    }

    }
    // check consumer profile
    strNumber = doc.CheckNumberOfFiles(request.getParameter("regno "), "consumer"); // Get the last number
    if (strNumber.startsWith("Application Error")) // If an application error occured
    {
    session.setAttribute("Error_Variable",strNumber);
    %><script language="javascript">window.open("../ErrorPage.jsp?ErrorLocation=display_docs3","_paren t");</script><%
    }
    else
    {
    Integer Int = new Integer(0);
    Int = Int.valueOf(strNumber); // Convert to Integer
    int iNumber = Int.intValue() ; // New number
    %><tr class="Heading"><td>Consumer profile</td></tr><%
    // Write links to file
    for(int i = 1; i < iNumber + 1; i++)
    {
    %><tr class="Part2_A"><td><a (removed command for link)="<%="../uploaded_docs/" + request.getParameter("regno") + "/CN" + new Integer(i).toString() + "_" + request.getParameter("regno") + ".htm"%>" target="_new">Consumer profile <%=new Integer(i).toString()%></a></td></tr><%
    }

    }
    }%>
    <tr><td align="center"><input type="button" value="Back" onClick="Back()" class="BT"></td></tr>
    </table>
    </td></tr>
    </table>
    </form>
    </body>

    <script language="javascript">
    function Back()
    {
    var dt = new Date();
    <% if (request.getParameter("type").compareTo("special") == 0 )
    {%>
    window.open("../special/Display_one_record.jsp?dt2=" + dt + "&" +"<%=request.getQueryString()%>","_parent");
    <%} else {%>
    window.open("../data_jsp/Display_one_record.jsp?cca_key=<%=request.getParam eter("cca_key")%>&field=<%=request.getParameter("f ield")%>&value=<%=request.getParameter("value")%>& type=<%=request.getParameter("type")%>" + "&dt=" + dt,"_parent");
    <%}%>
    }
    </script>

    </html>
    [/CODE]

    There are no other JSP's with a similar name.
    How do I compile using -g option?

  4. #4
    benperks is offline Member
    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0

    Default

    I am able to compile the JSP on its own in the IDE and this has given me the original problem which I have corrected but now I have an error of:
    /home/benita/projects/cca/build/generated/src/org/apache/jsp/docs/display_005fdocs_jsp.java:273: reached end of file while parsing
    I am not able to post links yet so I can't post the full code at this point....
    The error means that there is a brace missing but I have gone through the code and matched the braces to each other in a pair and I can't seem to find the start brace that is missing...
    How can I get the code up here before I have 20 posts??

  5. #5
    muthu84mca is offline Member
    Join Date
    Nov 2011
    Posts
    1
    Rep Power
    0

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

    Check your open ({) and close ({). Somewhere you missed close } in your JSP. so that only you got this error.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,558
    Rep Power
    25

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

    Look at the date? Your answer is Years too late.

Similar Threads

  1. Jasper compilation
    By java_hunter in forum XML
    Replies: 0
    Last Post: 07-16-2008, 03:01 PM
  2. JasperException: Unable to compile
    By Aerinai in forum Java Servlet
    Replies: 0
    Last Post: 06-17-2008, 06:16 PM
  3. class or interface expected -compile err
    By ravi503 in forum Java Servlet
    Replies: 1
    Last Post: 03-26-2008, 11:45 AM
  4. org.apache.jasper.JasperException: null
    By ranjan_ashish26 in forum Java Servlet
    Replies: 1
    Last Post: 03-21-2008, 05:06 AM
  5. Unable to compile
    By gapper in forum New To Java
    Replies: 2
    Last Post: 01-14-2008, 04:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •