我試着在netbeans 6.1
如何避免在tomcat服務器上運行jsp的異常?
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" session="true"%>
<%@ page import="com.hp.hpl.jena.rdf.model.*"%>
<%@ page import="com.hp.hpl.jena.query.*"%>
<%
try
{
String inputFile="C:\\Users\\Admin\\Documents\\NetBeansProjects\\finalview\\resumenew.rdf";
InputStream in = new BufferedInputStream(new FileInputStream(new File(inputFile)));
Model model = ModelFactory.createMemModelMaker().createModel("");
model.read(in,null) ;
String queryString =
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"PREFIX foaf: <http://www.xmlns.com/foaf/0.1> " +
"SELECT ?name ?phone WHERE { ?person foaf:name ?name . ?person foaf:phone ?phone }";
Query query1 = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query1,model);
ResultSet results = qe.execSelect();
ResultSetFormatter.out(System.out, results, query1);
qe.close();
}catch(Exception e){}
%>
運行在tomcat5.5
這jsp
計劃,我得到以下異常,當我運行程序
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
Model cannot be resolved to a type
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
ModelFactory cannot be resolved
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
Query cannot be resolved to a type
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
QueryFactory cannot be resolved
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
QueryExecution cannot be resolved to a type
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
QueryExecutionFactory cannot be resolved
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
ResultSet cannot be resolved to a type
An error occurred at line: 6 in the jsp file: /test.jsp
Generated servlet error:
ResultSetFormatter cannot be resolved
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
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)c
你能告訴我,我應該讓我的jsp
程序和作爲輸入給它的文件。
我該如何避免這個錯誤?
您是否將類包含在類路徑中? –
如何包含它?請打電話給我?這裏的課程是什麼意思? – sheba