部署应用程序时,不会出现任何错误,但是当我访问我的应用程序时,会出现以下错误:
错误:服务器错误 服务器遇到错误,无法完成您的请求。 请在30秒后再试一次。
Erro Log on Google App Engine Admin:
Uncaught exception from servlet
java.lang.UnsupportedClassVersionError: org/apache/jsp/PessoaApplication_jsp : Unsupported major.minor version 52.0
at com.google.appengine.runtime.Request.process-6a9f678c146455a7(Request.java)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:795)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.lang.ClassLoader.loadClass(ClassLoader.java:360)
at org.mortbay.util.Loader.loadClass(Loader.java:91)
at org.mortbay.util.Loader.loadClass(Loader.java:71)
at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:188)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at java.lang.Thread.run(Thread.java:724)
关注我的主页:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="com.bruno.bariotti.Pessoa" %>
<%@ page import="com.bruno.bariotti.PessoaDao" %>
<!DOCTYPE html>
<html>
<head>
<title>Pessoas</title>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<%
PessoaDao dao = PessoaDao.INSTANCE;
List<Pessoa> pessoas;
pessoas = dao.listPessoas();
%>
Numero total de pessoas: <% pessoas.size(); %> Pessoas.
<table>
<tr>
<th>Nome</th>
<th>Idade</th>
<%for (Pessoa p : pessoas) {%>
<tr>
<td>
<%p.getNome(); %>
</td>
<td>
<%p.getIdade(); %>
</td>
</tr>
<% } %>
</table>
<hr />
<div class="main">
<div class="headline">Nova Pessoa</div>
<form action="/new" method="post" accept-charset="utf-8">
<table>
<tr>
<td><lable for="nome">Nome</lable></td>
<td><input type="text" name="nome" id="nome" size="200"/></td>
</tr>
<tr>
<td><lable for="idade">Idade</lable></td>
<td><input type="text" name="idade" id="idade" size="3"/></td>
</tr>
</table>
</form>
</body>
</html>
答案 0 :(得分:1)
当您使用JDK 1.8并部署应用程序(例如,使用maven,例如, mvn appengine:update
。
在更新过程中,Google AppEngine maven插件使用JDK 1.8编译JSP文件(如下图所示)。生成的类文件的版本号为52.0,Google AppEngine目前不支持(因此您的错误:不支持的major.minor版本52.0 )。
解决方法非常简单:将JAVA_HOME
变量设置为指向JDK 1.7
Windows中的示例:
set JAVA_HOME=c:\Program Files\Java\jdk1.7.0_05
之后你必须再次运行mvn appengine:update
,这将解决问题。
JDK 1.7 。您可以在Using Apache Maven: Requirements上找到更多信息。