Saturday, 15. August 2009
Jetty and the NoSuchMethodError
Jetty is a small servlet engine you can embed in your application. For my first experiment I started with a simple program to use it as HTML server:
public final class Runner {

    private final Server jetty;

    public Runner() {
        jetty = new Server(4040);

    public void start() throws Exception {
        jetty.setHandler(new WebAppContext("src/main/webapp", "/"));

    public static void main(String[] args) throws Exception {
        Runner runner = new Runner();


I have created a simple HTML page which is located in the directory src/main/webapp. After running this little Runner class from Eclipse I could see the HTML page under http://localhost:4040/.

Now I want more - I want to use it as JSP engine. Before I did a small test to use it as servlet engine which was successful (I created only a small web.xml with an InitServlet). To use Jetty as JSP environment you must include some libraries which are listed in Embedding+Jetty (e.g. the Jasper libraries).

I put the needed libraries in my classpath, created a simple JSP and started Jetty again. When I access the JSP page I got a HTTP ERROR 500 and the following stacktrace:

Caused by:

java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer.(Lorg/eclipse/jdt/internal/compiler/env/IBinaryType;)V
	at org.apache.jasper.compiler.JDTCompiler$1.findType(
	at org.apache.jasper.compiler.JDTCompiler$1.findType(
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(
	at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(
What the hell is the problem here? My first suspicion was that it could be a classpath problem. But how can I confirm it?

to be continued...

... link (0 Kommentare)   ... comment