记录一下在servlet里调用lucene时遇到的问题

做为一个没有系统学过java和javaweb就直接上手作东西的程序猿,有时遇到的额问题真的让我很无解呀,今天在servlet里调用一个lucene程序,各类出错,把那个程序单独拿出来运行时一切正常,在servlet里调用时就出错,不只出错连个人web项目的主页都已经访问不鸟了,纠结了一下午,我试着一条一条语句的注释掉执行,试图找出究竟是那句引发的问题,仍是失败了。最后,在overstackflow上找到了答案,http://stackoverflow.com/questions/14638696/servlet-exception-with-lucene-demo-class, java

上面说到了, web

java.lang.ClassNotFoundException is related to Java Classpath. ClassNotFoundException comes when JVM tries to load a class at runtime dynamically and if that class is not found in classpath it throwsjava.lang.ClassNotFoundException. app

As, you are using third party API called Apache Lucene, you need to place all required jar files to application classpath. eclipse

For a web application default classpath is /WEB-INF/lib directory under webapp or WebContent directory. webapp

Copy all required jar files there, eclipse takes care everything rest. ui

看完以后果断把lucene相关的包拷贝到下,问题随之解决,哈哈哈哈。 spa

相关文章
相关标签/搜索