Hi
I am a new user to Lucene.
I tried running the Lucene web application demo provided with the source. I
am able to index the files but I get the following error when I try to
search a query from the browser.
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: 10 in the generated java file
Only a type can be imported.
org.apache.lucene.analysis.standard.StandardAnalyzer resolves to a
package
An error occurred at line: 16 in the generated java file
Only a type can be imported. org.apache.lucene.demo.html.Entities
resolves to a package
An error occurred at line: 32 in the jsp file: /luceneweb/results.jsp
IndexSearcher cannot be resolved to a type
29: <%
30: boolean error = false; //used to control
flow for error messages
31: String indexName = indexLocation; //local copy of
the configuration variable
32: IndexSearcher searcher = null; //the searcher
used to open/search the index
33: Query query = null; //the Query
created by the QueryParser
34: Hits hits = null; //the search results
35: int startindex = 0; //the first index
displayed on this page
An error occurred at line: 33 in the jsp file: /luceneweb/results.jsp
Query cannot be resolved to a type
30: boolean error = false; //used to control
flow for error messages
31: String indexName = indexLocation; //local copy of
the configuration variable
32: IndexSearcher searcher = null; //the searcher
used to open/search the index
33: Query query = null; //the Query
created by the QueryParser
34: Hits hits = null; //the search results
35: int startindex = 0; //the first index
displayed on this page
36: int maxpage = 50; //the maximum
items displayed on this page
An error occurred at line: 34 in the jsp file: /luceneweb/results.jsp
Hits cannot be resolved to a type
31: String indexName = indexLocation; //local copy of
the configuration variable
32: IndexSearcher searcher = null; //the searcher
used to open/search the index
33: Query query = null; //the Query
created by the QueryParser
34: Hits hits = null; //the search results
35: int startindex = 0; //the first index
displayed on this page
36: int maxpage = 50; //the maximum
items displayed on this page
37: String queryString = null; //the query
entered in the previous page
An error occurred at line: 45 in the jsp file: /luceneweb/results.jsp
IndexSearcher cannot be resolved to a type
42: //less
43:
44: try {
45: searcher = new IndexSearcher(indexName); //create
an indexSearcher for our page
46: //NOTE:
this operation is slow for large
47: //indices
(much slower than the search itself)
48: //so you
might want to keep an IndexSearcher
An error occurred at line: 79 in the jsp file: /luceneweb/results.jsp
Analyzer cannot be resolved to a type
76:
//query string so you get the
77:
//treatment
78:
79: Analyzer analyzer = new StandardAnalyzer();
//construct our usual analyzer
80: try {
81: QueryParser qp = new
QueryParser("contents", analyzer);
82: query = qp.parse(queryString); //parse the
An error occurred at line: 79 in the jsp file: /luceneweb/results.jsp
StandardAnalyzer cannot be resolved to a type
76:
//query string so you get the
77:
//treatment
78:
79: Analyzer analyzer = new StandardAnalyzer();
//construct our usual analyzer
80: try {
81: QueryParser qp = new
QueryParser("contents", analyzer);
82: query = qp.parse(queryString); //parse the
An error occurred at line: 81 in the jsp file: /luceneweb/results.jsp
QueryParser cannot be resolved to a type
78:
79: Analyzer analyzer = new StandardAnalyzer();
//construct our usual analyzer
80: try {
81: QueryParser qp = new
QueryParser("contents", analyzer);
82: query = qp.parse(queryString); //parse the
83: } catch (ParseException e) {
//query and construct the Query
84:
//object
An error occurred at line: 81 in the jsp file: /luceneweb/results.jsp
QueryParser cannot be resolved to a type
78:
79: Analyzer analyzer = new StandardAnalyzer();
//construct our usual analyzer
80: try {
81: QueryParser qp = new
QueryParser("contents", analyzer);
82: query = qp.parse(queryString); //parse the
83: } catch (ParseException e) {
//query and construct the Query
84:
//object
An error occurred at line: 83 in the jsp file: /luceneweb/results.jsp
ParseException cannot be resolved to a type
80: try {
81: QueryParser qp = new
QueryParser("contents", analyzer);
82: query = qp.parse(queryString); //parse the
83: } catch (ParseException e) {
//query and construct the Query
84:
//object
85:
//if it's just "operator error"
86:
//send them a nice error HTML
An error occurred at line: 89 in the jsp file: /luceneweb/results.jsp
e cannot be resolved
86:
//send them a nice error HTML
87:
88: %>
89: <p>Error while parsing query:
<%=escapeHTML(e.getMessage())%></p>
90: <%
91: error = true;
//don't bother with the rest of
92:
//the page
An error occurred at line: 127 in the jsp file: /luceneweb/results.jsp
Document cannot be resolved to a type
124: %>
125: <tr>
126: <%
127: Document doc = hits.doc(i);
//get the next document
128: String doctitle = doc.get("title");
//get its title
129: String url = doc.get("path");
//get its path field
130: if (url != null &&
url.startsWith("../webapps/")) { // strip off ../webapps prefix if
present
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Can someone please help me to get through this error. Assistance will be
highly appreciated.
Thanks
Mayank Juneja