jetty访问jsp页面出现异常:org.apache.jasper.JasperException: PWC6345: A full JDK (not just JRE) is required解决

今天在jetty下配置一个jsp模版的报表页面,报如下异常信息:

  1.  
    org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
  2.  
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92)
  3.  
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
  4.  
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:119)
  5.  
    at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompiler.java:208)
  6.  
    at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384)
  7.  
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
  8.  
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
  9.  
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
  10.  
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
  11.  
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
  12.  
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
  13.  
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558)
  14.  
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:489)
  15.  
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
  16.  
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
  17.  
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
  18.  
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:972)
  19.  
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417)
  20.  
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
  21.  
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:906)
  22.  
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
  23.  
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
  24.  
    at org.eclipse.jetty.server.Server.handle(Server.java:350)
  25.  
    at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442)
  26.  
    at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:910)
  27.  
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565)
  28.  
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
  29.  
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:46)
  30.  
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:545)
  31.  
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)
  32.  
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
  33.  
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
  34.  
    at java.lang.Thread.run(Unknown Source)

在网上找了很多资料,主要问题还是jetty运行的jre环境配置问题,最终解决方案如下:
在eclipse—>Window—>prefence—>java—>Installed JREs,选择jre点击Edit找到jdk的安装目录,我的安装在C:Program Files/java/jdk1.7在jdk安装目录下找到jre目录,点击finish。,启动项目,访问jsp页面,一切正常。

提醒:网上的解决方案我试了不成功,主要原因就是因为jre配置环境的错误,在选择jre环境的时候,有两个选择,一个是java根目录下的jre(选择这个会不成功),一个是在jdk根目录下的jre(选择这个成功)!!

上一篇:Linq学习2


下一篇:C#面向对象的一些笔记