2

I feel like I keep going in circles with this one. I followed the Getting Started guide for Google App Engine (https://developers.google.com/appengine/docs/java/gettingstarted/) in Eclipse and everything went relatively well until I uploaded it to the App Engine.

I was getting 500 errors so I checked the logs and found this: "guestbook/SignGuestbookServlet : Unsupported major.minor version 51.0]"

I then search for this problem (on stackoverflow, of course) and found this solution: Google App Engine and Java Version?

So I set the compliance level to 1.6 and then at the bottom of the dialog I get the warning that "When selecting 1.6 compliance, make sure to have a compatible JRE installed and activated (currently 1.7)".

I happy click OK, and it prompts for a rebuild. After the rebuild I then get this new error: "Java compiler level does not match the version of the installed Java project facet."

Not having knowingly used any facets in the project I do a search for some help (again on stackoverflow) and find this: "Faceted Project Prblem (Java Version Mismatch)" error message

Unfortunately it is not even close to being helpful because I am not used Maven, and when I bring up the properties of the project there is no Project Properties -> Project Facets panel for me to change a version on.

So it seems that I am stuck with something that either cannot be compiled in Eclipse or cannot be deployed to App Engine. I know that I am probably missing something obvious here but I can't quite put my finger on it.

UPDATE: I have uninstalled all JREs and JDKs, and reinstalled only jdk1.6.0_32. The problem continues exactly the same.

4

3 回答 3

7

我有同样的问题。我能够通过使用 Navigator 视图并编辑 .settings/org.eclipse.wst.common.project.facet.core.xml 来解决,更改为:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <installed facet="java" version="1.6"/>
</faceted-project>

在此更改之后,错误消失了,我可以使用 jre1.7 但 java 1.6 合规级别在 DevMode 中成功运行 GWT 项目。

似乎确实应该有一种方法可以通过项目配置来编辑这个 java 方面,但我在 Juno 中找不到它。

于 2012-08-25T20:07:40.043 回答
2

在解决这个问题几个小时之后,删除我在 war 文件夹中的 nocache.js 是最后一块拼图。

与上面的答案相反,在 1.7 中创建应用程序后,我能够成功降级到合规级别 1.6

于 2012-10-15T08:40:12.393 回答
2

至少在我的情况下,答案似乎是,如果您在创建 Web 应用程序时将 Eclipse 默认编译器级别设置为 1.7,那么您将无法成功将其切换到 1.6。

示例 1:使用 JRE 1.6

  1. 在 Eclipse 中设置 Preferences->Java->Installed JREs to jdk 1.6.0_32
  2. 将 Preferences->Java->Compiler 设置为合规级别 1.6
  3. 使用 google 插件创建“新 Web 应用程序”
  4. 在本地运行 - 成功
  5. 部署到应用引擎,远程运行 - 成功

示例 2:使用 JRE 1.7

  1. 在 Eclipse 中设置 Preferences->Java->Installed JREs to jdk 1.7.0_04
  2. 将 Preferences->Java->Compiler 设置为合规级别 1.7
  3. 使用 google 插件创建“新 Web 应用程序”
  4. 在本地运行 - 成功
  5. 上传到应用引擎 - 失败(不支持的 major.minor 版本 51.0)
  6. 在 Eclipse 中,将 Preferences->Java->Compiler 设置为合规级别 1.6 - 失败(不会在本地编译(Java 编译器级别与已安装的 Java 项目方面的版本不匹配)。

解决方案:

在使用 google 插件创建 Web 应用程序之前,将 JRE 和编译器级别切换到 1.6(如示例 1 所示)。

如果您的项目已经存在,那么希望您还没有走得太远,可以再次创建它。

于 2012-05-23T05:39:16.280 回答