Symptom
Hi,
I was checking abstracts for Volume 41 No. 2 of Journal of Agricultural and Applied Economics. When I searched on "Race, Gender, School . . ." I got an error message saying that the website had experienced an internal error and I tried it again w/ the same results. Since the same message requested letting you know of the problem I am responding.
Sincerely,
Error Message
Trying the search above generated the error message:
An internal server error occurred on http://ageconsearch.umn.edu:
Date: 8/28/09 10:59 AM
Session ID: 6AAEA1B2D8AADD0C7F1BE28731AE9083
-- URL Was: http://ageconsearch.umn.edu/simple-search?sort=date&query=%28%28keyword%3Arace%29%29&from_advanced=true&query2=&field1=keyword&conjunction2=AND&query1=race+&field2=keyword&query3=&conjunction1=AND&field3=ANY&SortDirection=descending
-- Method: GET
-- Parameters were:
-- field3: "ANY"
-- field2: "keyword"
-- field1: "keyword"
-- sort: "date"
-- query3: ""
-- query2: ""
-- SortDirection: "descending"
-- query1: "race "
-- query: "((keyword:race))"
-- from_advanced: "true"
-- conjunction2: "AND"
-- conjunction1: "AND"
Exception:
java.sql.SQLException: Query "((keyword:race))" returned unresolvable handle: 53087
at org.dspace.app.webui.servlet.SimpleSearchServlet.doDSGet(SimpleSearchServlet.java:271)
at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:151)
at org.dspace.app.webui.servlet.DSpaceServlet.doGet(DSpaceServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Outline of Solution
1) A handle was found by search that was not in the database (probably a deleted file and IndexAll has not run yet).
2) I found the segment of code that collects into a list all the items found by search.
3) When any word that was on this deleted record was input, the search routine would throw an error and halt.
4) I rewrote the code to ignore handles that are not in the database.
5) Ran a few basic tests on Odin (our private DSAPCE setup).
6) Deployed it to strip1 (production site)
Modified Code
// FROM SimpleSearchServlet.java
/*
resultsItems = new Item[numItems];
for (int i = 0; i < numItems; i++)
{
String myhandle = (String) itemHandles.get(i);
Object o = HandleManager.resolveToObject(context, myhandle);
resultsItems[i] = (Item) o;
if (resultsItems[i] == null)
{
throw new SQLException("Query \"" + query
+ "\" returned unresolvable handle: " + myhandle);
}
}
*/
// The code below will only add handles to the list if a well defined
// item is associated with it.
Item[] resultsItems_temp = new Item[numItems];
int item_count =0;
for (int i = 0; i < numItems; i++){
String myhandle = (String) itemHandles.get(i);
Object o = HandleManager.resolveToObject(context, myhandle);
if (o != null){
resultsItems_temp[item_count] = (Item) o;
item_count++;
}
}
resultsItems = new Item[item_count];
for (int i = 0; i < item_count; i++){
resultsItems[i] = resultsItems_temp [i];
}