简体   繁体   English

如何正确配置Google App Engine Java应用程序?

[英]How to configure correctly Google App Engine Java Application?

I am following the Google's Tutorial on creating your first GAE Java Project. 我正在关注创建您的第一个GAE Java项目的Google教程 When I create it exactly the same as theirs I get lots of errors. 当我创建它与他们完全相同时,我会遇到很多错误。 I believe that it is caused wrong application configuration. 我相信这是导致错误的应用程序配置。 Below are my configuration files: 以下是我的配置文件:

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>my_app_id</application>
  <version>1</version>
</appengine-web-app>

appengine-web.xml AppEngine上-web.xml中

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
    <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>
    <welcome-file-list>
        <welcome-file>guestbook.jsp</welcome-file>
    </welcome-file-list>
</web-app>

What you need is probably is to beat the evil zombie wizards by enable Using Concurrent Requests 你需要的可能是通过启用使用并发请求击败邪恶的僵尸向导

By default, App Engine sends requests serially to a given web server. 默认情况下,App Engine会将请求串行发送到给定的Web服务器。 You can configure App Engine to send multiple requests in parallel by adding the element to appengine-web.xml : 您可以将App Engine配置为通过将元素添加到appengine-web.xml来并行发送多个请求:

In your appengine-web.xml : 在你的appengine-web.xml

<threadsafe>true</threadsafe>

Just for better readability, you might want to configure GAE/J using app.yaml https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml 为了更好的可读性,您可能需要使用app.yaml配置GAE / J https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml

GAE will use the app.yaml to generate both web.xml and appengine-web.xml. GAE将使用app.yaml生成web.xml和appengine-web.xml。 I also just find the app.yaml syntax much easier to read. 我也发现app.yaml语法更容易阅读。

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

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