日期:2014-05-16  浏览次数:20448 次

启动jetty,打开JSP页面报错:Unable to compile class for JSP

启动jetty,打开JSP页面报错:Unable to compile class for JSP

?

解决方案:为项目加入JDK的tools.jar即可

?

?

?

HTTP ERROR 500
Problem accessing /. Reason: 

    Unable to compile class for JSP

Generated servlet error:
2011-12-10 19:37:07 org.apache.jasper.compiler.Compiler generateClass
??: Javac exception 
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
	at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
	at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924)
	at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
	at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
	at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
	at org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:500)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
	at cn.chenfeng.Filter.PageTimersFilter.doFilter(PageTimersFilter.java:46)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)


Generated servlet error:
2011-12-10 19:37:07 org.apache.jasper.compiler.Compiler generateClass


Generated servlet error:
??: Env: Compile: javaFileName=/C:/Users/ADMINI~1/AppData/Local/Temp/Jetty_0_0_0_0_8081_WebRoot____ag5q3e/jsp//org/apache/jsp\index_jsp.java


Generated servlet error:
    classpath=/E:/MyWorkspace/cfJavaEEPlay/