EclipseJena和tomcat查询
Tomcat问题: 输入Informe de execpción 我希望我的孩子们能过得更好 描述服务商的内部错误 这是我的要求 例外情况 javax.servlet.ServletException:La ejeucción del servlet lanzóuna 原因除外 java.lang.NoClassDefFoundError:com/hp/hpl/jena/rdf/model/ModelFactory doPost(rdf.java:55) javaservlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)causa 雷兹 java.lang.ClassNotFoundException: com.hp.hpl.jena.rdf.model.ModelFactory org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) doPost(rdf.java:55) javaservlet.http.HttpServlet.service(HttpServlet.java:637) javaservlet.http.HttpServlet.service(HttpServlet.java:717)nota La 档案馆内的错误原因综合报告 ApacheTomcat/6.0.36 java.lang.NoClassDefFoundError:com/hp/hpl/jena/rdf/model/ModelFactory doPost(rdf.java:55)EclipseJena和tomcat查询,eclipse,servlets,sparql,jena,Eclipse,Servlets,Sparql,Jena,Tomcat问题: 输入Informe de execpción 我希望我的孩子们能过得更好 描述服务商的内部错误 这是我的要求 例外情况 javax.servlet.ServletException:La ejeucción del servlet lanzóuna 原因除外 java.lang.NoClassDefFoundError:com/hp/hpl/jena/rdf/model/ModelFactory doPost(rdf.java:55) javaservlet.http.Htt
jena jar不在webapp的运行时类路径上。谢谢,我解决了这个问题:)只是需要更新tomcat来识别.jar
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.sparql.*;
import java.io.InputStream;
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.ontology.*;
/**
* Servlet implementation class rdf
*/
public class rdf extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public rdf() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String inputFileName = "/home/jarboox/Documentos/Eclipse/workspace/Sparql/src/tres.rdf";
try {
//create the reasoning model using the base
OntModel inf = ModelFactory.createOntologyModel();
// use the FileManager to find the input file
InputStream in = FileManager.get().open(inputFileName);
if (in == null) {
throw new IllegalArgumentException("File: " + inputFileName + " not found");
}
inf.read(in, "");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}