在尝试运行jsp
页面时,出现以下异常:
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: 17 in the generated java file
Syntax error on token ";", delete this token
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:644)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.22 logs.
看到这些异常,我无法找到它的根本原因。任何人都可以帮助我。我的 IDE 没有显示任何可能表明我正在尝试编译有错误的 jsp 的红色标记。相反,它没有任何迹象。
注意:我也没有看到生成的 Java 文件,正如异常所说
JSP 代码:
<%--
Document : index
Created on : Dec 8, 2012, 10:55:43 AM
Author : user
--%>
<%@page import="internet.CommunicationWithServer.PingTheServer"%>
<%@page import="java.util.GregorianCalendar"%>
<%@page import="internet.CommunicationWithServer.SendNodeInfo"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="internet.HelperClasses.*;" %>
<%@page import="General.HelperClasses.*;" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Client Nappster</title>
<style type="text/css">
@import url("css/index_css.css");
</style>
</head>
<body bgcolor="#000000">
<center> <h2 id="Head">Client Nappster</h2> </center>
<center> <h4 id="Head"><%= new GregorianCalendar().getTime().toString() %></h4> </center>
<%-- Call a method that checks for the internet connection --%>
<%!
boolean isConnectionAvailable;
String networkIP;
%>
<% if(request.getAttribute("File-Sharing-Status") != null && ((Boolean)request.getAttribute("File-Sharing-Status")) == true) {%>
<script type="text/javascript"> alert("Success ! File shared with the nappster server"); </script>
<%}%>
<%
isConnectionAvailable = new CheckConnection().checkConnection();
if(isConnectionAvailable) {
// send a message,the app is conneted to the nappster central server
System.out.println("returned true");
// call a method that sends the client's IP address to the nappster central server
networkIP = new ClientAddress().getNetworkIP();
// send to the server the address and the name of the node online
boolean informationSent = new SendNodeInfo().sendInfo(networkIP);
// call a method that starts a thread that after certain intervals checks if the node is still connected
// to the internet
new PingTheServer().startPingThread();
// make a 'Shared' Directory
boolean directoryMade = new DirectoryMaker().makeDirectory(request.getServletContext().getRealPath("/"), "Shared");
if(directoryMade == false) {
//Warning : Unable to make a directory | Directory already exists
System.out.println("Unable to create the 'Shared' directory | or directory already exists");
}
} else {
// send an error message,unable to connect the app to the napster cental server
System.out.println("returned false");
}
%>
<jsp:include page="EmbeddedJSP/form_table.jsp" />
</body>
EmbeddedJSP/form_table.jsp:
<%@page import="internet.CommunicationWithServer.QueryConnectedNodes"%>
<%@page import="java.io.File"%>
<%@page import="java.io.FileReader"%>
<%@page import="java.io.BufferedReader"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="General.HelperClasses.Stashed"%>
<%@page import="internet.CommunicationWithServer.QueryFileNames"%>
<%! String fileSharingStatusString;
Boolean fileSharingStatus;
String nodesConnected;
boolean ncStashed;
%>
<% BufferedReader sharingStatusReader = new BufferedReader(new FileReader(request.getServletContext().getRealPath("/") + Constants.FilePaths.fstPath));
while((fileSharingStatusString = sharingStatusReader.readLine()) != null) {
fileSharingStatus = new Boolean(fileSharingStatusString.trim());
}
%>
<% if(new File(request.getServletContext().getRealPath("/") + Constants.FilePaths.nlPath).exists())
ncStashed = true;
%>
<table width="100%" border="+3" id="Table_border_color">
<tr>
<th id="Nodes_Connected_Heading"> Nodes Connected </th>
<th id="Files_to_be_shared_heading"> Select a File to share </th>
<th id="Files_shared_heading"> Files Shared </th>
</tr>
<tr>
<td width="20%" id="List_of_nodes_connected"> List <br />
<%-- Get the list of all the nodes connected to the nappster server --%>
<% if(new QueryConnectedNodes().getConnectedNodes() && ncStashed) {
BufferedReader nodesConnectedReader = new BufferedReader(new FileReader(Constants.FilePaths.nlPath));
String line;
while((line = nodesConnectedReader.readLine()) != null) {
%>
<%= line %>
<% } // end of while loop
} // end of if block
else {
%>
<em>No node connected to the nappster server !</em>
<%}%>
</td>
<td width="60%" valign="top" align="center">
<form method="post" action="SendTheFileName" enctype="multipart/form-data">
<div id="Files_to_be_shared">
<input type="file" id="File" name="FileTag" />
<input type="submit" value="Share" />
</div>
</form>
</td>
<td id="List_of_files_shared">
List of files shared. <br />
<%-- check if the user has shared any file --%>
<% if(fileSharingStatus.booleanValue()) {
// if true, get the name of the files
boolean requestSent = new QueryFileNames().getFileNames();
if(requestSent) {
BufferedReader reader = new BufferedReader(new FileReader(request.getServletContext().getRealPath("/") + Constants.FilePaths.fsPath));
String line;
while((line = reader.readLine()) != null) {
%>
<%= line %>
<br />
<%
}
}
} else {
%>
<em>No file has been shared till now !</em>
<%}%>
</td>
</tr>
</table>