简体   繁体   English

谷歌应用引擎部署错误

[英]error with google app engine deploy

I have a problem with the deployment on Google app engine. 我在Google应用引擎上部署时遇到问题。 The project runs fine on my PC but when I upload it, I get the following message: 该项目在我的电脑上正常运行但是当我上传它时,我收到以下消息:

Please enter code: Either the access code is invalid or the OAuth token is revoked.Details: invalid_grant 请输入代码:访问代码无效或OAuth令牌已被撤销。详细信息:invalid_grant

After that the browser opens a page where Google app engine asks for permission and, once I give it, provides a code to be copied in the application. 之后,浏览器会打开一个页面,其中Google应用引擎会请求权限,一旦我提供,就会提供要在应用程序中复制的代码。 But the input window doesn't work since it's stuck with the previous message. 但输入窗口不起作用,因为它与前一条消息一致。

I'm using NetBeans v8 with appengine-java-sdk v1.9, and got the same error with the example project 我正在使用带有appengine-java-sdk v1.9的NetBeans v8,并且在示例项目中遇到了同样的错误

I alredy tried to delete the file .appcfg_oauth2_tokens_java but it didn't work. 我alredy试图删除文件.appcfg_oauth2_tokens_java但它没有用。

Any help would be appreciated, thanks. 任何帮助将不胜感激,谢谢。

Appengine-web.xml AppEngine上-web.xml中

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>fiery-plate-97015</application>
<version>1</version>
<threadsafe>true</threadsafe>
<system-properties>
    <property name="java.util.logging.config.file" value="WEB-   INF/logging.properties"/>
</system-properties>

Web.xml 在web.xml

<?xml version="1.0" encoding="utf-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
    <servlet-name>guestbook</servlet-name>
    <servlet-class>guestbook.GuestbookServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>guestbook</servlet-name>
    <url-pattern>/guestbook</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>sign</servlet-name>
    <servlet-class>guestbook.SignGuestbookServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>sign</servlet-name>
    <url-pattern>/sign</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>guestbook.jsp</welcome-file>
</welcome-file-list>

Situation update: i never used maven so i took me a while and a lot of errors to make it works. 情况更新:我从未使用过maven,所以我花了一些时间和很多错误才使它有效。 At the end i created a new project following step by step google instruction: https://cloud.google.com/appengine/docs/java/gettingstarted/creating . 最后,我按照一步一步的google说明创建了一个新项目: https//cloud.google.com/appengine/docs/java/gettingstarted/creating The project works fine on my pc and seems to deploy correctly but the i get a 500 server error when visiting the page. 该项目在我的电脑上工作正常,似乎正确部署,但访问页面时我得到500服务器错误。 Meanwhile maven installation messed up with netbeans and, when deploying the first project, i get a exception before being asked for the code: 同时maven安装搞乱了netbeans,在部署第一个项目时,我在被要求代码之前得到一个例外:

java.lang.RuntimeException: Cannot get the System Java Compiler. java.lang.RuntimeException:无法获取System Java Compiler。 Please use a JDK, not a JRE. 请使用JDK,而不是JRE。

i checked the system variables to point to jdk folder but the problem persists. 我检查了系统变量以指向jdk文件夹,但问题仍然存在。

When running mvn appengine:update and you get this: 运行mvn appengine时:更新,你得到这个:

"Either the access code is invalid or the OAuth token is revoked.Details: invalid_grant"

and then nothing, you need to delete 然后什么都没有,你需要删除

~/.appcfg_oauth2_tokens_java

On running the command again the browser will launch and ask you to login (to your google app engine account). 再次运行该命令时,浏览器将启动并要求您登录(到您的谷歌应用引擎帐户)。 After login you will get a code to paste into the command line... 登录后,您将获得一个粘贴到命令行的代码...

Your <application>guestbook</applicaiton tag in your appengine-web.xml is incorrect, I believe. 我相信你的appengine-web.xml中的<application>guestbook</applicaiton标签是不正确的。 That should be your unique project ID at http://console.developers.google.com . 这应该是您在http://console.developers.google.com上的唯一项目ID。 You can create one there if you don't have one. 如果没有,可以在那里创建一个。

The 500 error from the Google App Engine is due to runtime error. Google App Engine的500错误是由于运行时错误造成的。 If you check logs, and it seems you did already your getting the Unsupported major.minor version 52.0. 如果您检查日志,似乎您已经获得了Unsupported major.minor版本52.0。

Google App Engine is still running on JDK 7 and you have uploaded a compiled version using JDK8. Google App Engine仍在JDK 7上运行,您已使用JDK8上传了已编译的版本。 Please compile using JDK 7 and the problem will disappear. 请使用JDK 7编译,问题将消失。

About the first error 关于第一个错误

Please enter code: Either the access code is invalid or the OAuth token is revoked.Details: invalid_grant 请输入代码:访问代码无效或OAuth令牌已被撤销。详细信息:invalid_grant

It disappeared while trying to solve the other problems, i don't know what was the cause. 它在试图解决其他问题时消失了,我不知道原因是什么。

For the second 第二个

java.lang.RuntimeException: Cannot get the System Java Compiler. java.lang.RuntimeException:无法获取System Java Compiler。 Please use a JDK, not a JRE. 请使用JDK,而不是JRE。

I solved this by changing the value of environment variable PATH, putting jdk directory before anything else. 我通过更改环境变量PATH的值,将jdk目录置于其他任何位置之前解决了这个问题。

For the third: 对于第三个:

Uncaught exception from servlet java.lang.UnsupportedClassVersionError: org/apache/jsp/guestbook_jsp : Unsupported major.minor version 52.0 来自servlet的未捕获异常java.lang.UnsupportedClassVersionError:org / apache / jsp / guestbook_jsp:不支持的major.minor版本52.0

The answer provided by Christopher Ebejer is correct. Christopher Ebejer提供的答案是正确的。 Now the examples work both with maven that with netbeans. 现在,这些示例与使用netbeans的maven一起工作。

Many thanks. 非常感谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM