面对java.lang.NoSuchMethodError:Jetty + Eclipse

时间:2012-09-14 06:33:05

标签: java eclipse jsp jetty

您好我在Eclipse中使用嵌入式Jetty 8.x并获得此错误,同时使用JSP和Servlet创建简单的 Hello Web应用程序。我在Build Path中错过了一些jar吗?

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_20\jre
Detected OS: Windows XP
parsing buildfile jar:file:/C:/Documents%20and%20Settings/ashish.s/NewEclipseJuno/JServer/WebContent/WEB-INF/lib/ant-1.8.3.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/Documents%20and%20Settings/ashish.s/NewEclipseJuno/JServer/WebContent/WEB-INF/lib/ant-1.8.3.jar!/org/apache/tools/ant/antlib.xml from a zip file
parsing buildfile jar:file:/C:/Documents%20and%20Settings/ashish.s/My%20Documents/Downloads/ant-1.8.3.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/Documents%20and%20Settings/ashish.s/My%20Documents/Downloads/ant-1.8.3.jar!/org/apache/tools/ant/antlib.xml from a zip file
Project base dir set to: C:\Documents and Settings\ashish.s\NewEclipseJuno\JServer
    [javac] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

1 个答案:

答案 0 :(得分:0)

我将继续并在答案中提供更多细节,因为我也面临同样的问题(或足够接近),当运行形式eclipse并投掷

时应用程序工作正常
java.lang.NoSuchMethodError: org.apache.jasper.compiler.JspUtil.expandClassPath(Ljava/util/List;)Ljava/util/List;

导出并运行时形成一个可运行的jar。

soloution(如上面的评论中所述)是在导出之前将jasper-compiler-*.jarjasper-runtime-*.jar添加到eclipse中的类路径(其中asterix是版本号)。我分别在jasper-compiler.jarjasper-runtime.jar

找到了这些内容

如果这些链接在阅读时已失效,则Google搜索(或使用jar finder等服务)可帮助您找到上述所需的广告。