Setup Mac OSX 10.6.7, Eclipse, Tomcat 1.6
I am trying to call a string from a Java file to my JSP to display it to the user but I keep getting the below error. Any help is as always much appreciated,
The JSP
<%
Injector injector = Guice.createInjector(new GuiceInjector());
SliceConnector r = injector.getInstance(SliceConnector.class);
out.println(r.search());
String dbConcept = "http://dbpedia.org/resource/human_rights";
System.out.println(r.search(dbConcept));
%>
The Java
public String search(String dbConcept)
{
setSlicepediaProductionMode(true);
List<SliceHit> sliceHits = searchForSlices();
if (sliceHits == null) {
System.err.println("Timeout occurred while fetching slices");
return "error";
}
if (!sliceHits.isEmpty()) {
System.out.println("Found some slices Yuhuuuu ! :-) ");
String sliceContent = createSlices(sliceHits);
System.out.println("Slice content:");
System.out.println(sliceContent);
return sliceContent;
} else {
System.out.println("No Slices were found for this query");
}
System.out.println("Slice Consumer stopped activity");
return "SliceConnector";
}
private void setSlicepediaProductionMode(boolean productionMode)
{
sliceSearcher.setProductionMode(productionMode);
sliceCreator.setProductionMode(productionMode);
}
private List<SliceHit> searchForSlices() {
SlicepediaQuery sliceQuery = new SlicepediaQuery();
String dbConcept = "http://dbpedia.org/resource/human_rights";
sliceSearcher.setSliceQuery(sliceQuery);
if (sliceSearcher.run())
{
return sliceSearcher.getSliceHits();
} else
{
return null;
}
}
The Error
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 141 in the jsp file: /SimpleResponse2.jsp
The method search() in the type SliceConnector is not applicable for the arguments (String)
138:
139:
140: String dbConcept = "http://dbpedia.org/resource/human_rights";
141: System.out.println(r.search(dbConcept));
I see that you are calling search() twice, first without argument, the second time with a string. In the code posted you only provide for the latter case, so you should already get an error at the first call.
Correct the first call and make sure you are referencing to the right file(s).