阅读背景:

GAE - 浏览jsp页面时出错

来源:互联网 

I create a blank project (by using eclipse plugin), create a default jsp page, run GAE server, browse to this jsp and i got error

我创建一个空白项目(通过使用eclipse插件),创建一个默认的jsp页面,运行GAE服务器,浏览到这个jsp,我得到错误

JRE: 1.6, Compiler: 1.6

JRE:1.6,编译器:1.6

JSP file:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>

Error:

HTTP ERROR: 500

Unable to compile class for JSP

Generated servlet error:
    [javac] C:\DOCUME~1\zeroonea\LOCALS~1\Temp
\Jetty_0_0_0_0_8080_war____ut4fm1\jsp\org\apache\jsp\index_jsp.java:7:
cannot access javax.servlet.jsp.HttpJspPage

Generated servlet error:
    [javac] bad class file: G:\Program Files\for JAVA\eclipse\plugins
\com.google.appengine.eclipse.sdkbundle_1.2.0.v200904062334\appengine-
java-sdk-1.2.0\lib\shared\geronimo-jsp_2.1_spec-1.0.1.jar(javax/
servlet/jsp/HttpJspPage.class)
    [javac] class file has wrong version 49.0, should be 48.0
    [javac] Please remove or make sure it appears in the correct
subdirectory of the classpath.
    [javac] public final class index_jsp extends
org.apache.jasper.runtime.HttpJspBase
    [javac]              ^
    [javac] 1 error

RequestURI=/index.jsp
Caused by:

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

Generated servlet error:
    [javac] C:\DOCUME~1\zeroonea\LOCALS~1\Temp
\Jetty_0_0_0_0_8080_war____ut4fm1\jsp\org\apache\jsp\index_jsp.java:7:
cannot access javax.servlet.jsp.HttpJspPage

Generated servlet error:
    [javac] bad class file: G:\Program Files\for JAVA\eclipse\plugins
\com.google.appengine.eclipse.sdkbundle_1.2.0.v200904062334\appengine-
java-sdk-1.2.0\lib\shared\geronimo-jsp_2.1_spec-1.0.1.jar(javax/
servlet/jsp/HttpJspPage.class)
    [javac] class file has wrong version 49.0, should be 48.0
    [javac] Please remove or make sure it appears in the correct
subdirectory of the classpath.
    [javac] public final class index_jsp extends
org.apache.jasper.runtime.HttpJspBase
    [javac]              ^
    [javac] 1 error

        at org.apache.jasper.compiler.DefaultErrorHandler.javacError
(DefaultErrorHandler.java:84)
        at org.apache.jasper.compiler.ErrorDispatcher.javacError
(ErrorDispatcher.java:332)
        at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:
412)
        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 com.google.appengine.tools.development.PrivilegedJspServlet.access
$101(PrivilegedJspServlet.java:23)
        at com.google.appengine.tools.development.PrivilegedJspServlet$2.run
(PrivilegedJspServlet.java:59)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.google.appengine.tools.development.PrivilegedJspServlet.service
(PrivilegedJspServlet.java:57)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
        at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
        at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
        at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
        at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
        at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
(DevAppEngineWebAppContext.java:54)
        at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
        at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:306)
        at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
        at org.mortbay.jetty.Server.handle(Server.java:313)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:830)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
        at org.mortbay.io.nio.SelectChannelEndPoint.run
(SelectChannelEndPoint.java:396)
        at org.mortbay.thread.BoundedThreadPool$PoolThread.run
(BoundedThreadPool.java:442)

Powered by Jetty:// 

2 个解决方案

#1


Eclipse isnt using the JDK/JRE that you think your using...

Eclipse不使用您认为使用的JDK / JRE ...

#2


It's because you should be using a JDK instead of the JRE.

这是因为您应该使用JDK而不是JRE。

If you have JDK installed, make sure eclipse is using it under preferences / Java. If not, install one.

如果安装了JDK,请确保eclipse在preferences / Java下使用它。如果没有,请安装一个。

Regards Yusuf


分享到: