简体   繁体   English

面对java.lang.NoSuchMethodError:码头+ Eclipse

[英]Facing a java.lang.NoSuchMethodError: Jetty + Eclipse

Hi I am using embedded Jetty 8.x In Eclipse and getting this error, while making simple Hello web application with JSP and Servlet. 嗨,我在Eclipse中使用嵌入式Jetty 8.x,并使用JSP和Servlet制作简单的Hello Web应用程序时遇到此错误。 Am I missing some jar in 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

I'm going to go ahead and put some more detail in an answer as I also faced the same issue (or close enough) where the application worked fine when run form eclipse and threw 我将继续在答案中提供更多细节,因为我也遇到了同样的问题(或足够接近),即当运行eclipse并抛出时,应用程序运行良好

java.lang.NoSuchMethodError: org.apache.jasper.compiler.JspUtil.expandClassPath(Ljava/util/List;)Ljava/util/List;

when exported and running form a runable jar. 导出并在可运行的jar中运行时。

The soloution (as mentioned in the comments above) was to add jasper-compiler-*.jar and jasper-runtime-*.jar to the class path in eclipse before exporting (Where the asterixis are version numbers). 解决方案(如上面的评论中所述)是在导出之前将jasper-compiler-*.jarjasper-runtime-*.jar到eclipse中的类路径(此处的星号为版本号)。 these I found respectively at: jasper-compiler.jar and jasper-runtime.jar 我分别在以下位置找到了这些文件: jasper-compiler.jarjasper-runtime.jar

If these links are dead at the time of reading then a Google search (or using a service like jar finder ) should help you locate the required jars mentioned above. 如果在阅读时这些链接无效,那么Google搜索(或使用jar finder之类的服务)应该可以帮助您找到上述所需的jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM