当前位置: 代码迷 >> Java Web开发 >> jsp 异常 java.lang.ClassNotFoundException: org.apache.lucene.store.Directory 求原因
  详细解决方案

jsp 异常 java.lang.ClassNotFoundException: org.apache.lucene.store.Directory 求原因

热度:1284   发布时间:2016-04-16 22:25:53.0
jsp 错误 java.lang.ClassNotFoundException: org.apache.lucene.store.Directory 求原因
type Exception report

message An exception occurred processing JSP page /clustering.jsp at line 74

description The server encountered an internal error that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /clustering.jsp at line 74

71: System.out.println(select+select+"_keyword.txt"+select+"_vsr.txt"+k_value+"D:\\users\\1");
72: String[] args={select,select+"_keyword.txt",select+"_vsr.txt",k_value,"D:\\users\\1"};
73: //System.out.println(args[3]);
74:    PrintCluster.main(args); 
75:    
76:    }
77:    }


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


root cause 

javax.servlet.ServletExceptionjava.lang.NoClassDefFoundError: org/apache/lucene/store/Directory
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.clustering_jsp._jspService(clustering_jsp.java:159)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


root cause 

java.lang.NoClassDefFoundError: org/apache/lucene/store/Directory
pre.kmeans.main(kmeans.java:26)
run.PrintCluster.main(PrintCluster.java:34)
org.apache.jsp.clustering_jsp._jspService(clustering_jsp.java:140)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


root cause 

java.lang.ClassNotFoundException: org.apache.lucene.store.Directory
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
pre.kmeans.main(kmeans.java:26)
run.PrintCluster.main(PrintCluster.java:34)
org.apache.jsp.clustering_jsp._jspService(clustering_jsp.java:140)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)




单独运行java文件的PrintCluster可以运行通过,PrintCluster调用Kmeans类,kmeans.java 26为
		int  num=transform.getNum(dataDir);  

getNum为一个静态方法。 我已在jsp页面导入了PrintCluster,kmeans和transform。
不是很理解为什么 产生这个错误 java.lang.ClassNotFoundException: org.apache.lucene.store.Directory  求大神们指导,谢谢!
------解决方案--------------------
java.lang.ClassNotFoundException: org.apache.lucene.store.Directory
这个就是少 jar 的。或者jar 冲突了。
------解决方案--------------------
感觉还是楼主jsp导出有问题,贴出来瞅瞅
------解决方案--------------------
看下你的lucene-core.jar有没有在WEB-INF\lib下。
  相关解决方案