我正在尝试切换到使用 app.yaml 而不是 web.xml 和 app-engine-web.xml。我试图忠实地遵循文档,但我收到错误appconfig.cmd update <my-war-directory>
消息
Reading application configuration data...
Bad configuration: Line 18, column 13: Error setting property 'handlers' on class: com.google.apphosting.utils.config.AppYaml
Caused by: Line 18, column 13: Error setting property 'handlers' on class: com.google.apphosting.utils.config.AppYaml
Please see the logs [C:\Users\<blah blah>\appcfg3710135744474388957.log] for further information.
在指示的日志文件中,我看到带有以下行的堆栈转储:
com.google.appengine.repackaged.net.sourceforge.yamlbeans.tokenizer.Tokenizer$TokenizerException: Line 18, column 13: Found a mapping value where it is not allowed.
这是我的文件(手动添加了行号):
1 application: my-app
2 version: 1
3 runtime: java
4 threadsafe: true
5
6 public_root: /static
7
8 static_files:
9 - include: /**
10
11 welcome_files:
12 - index.html
13
14 system_properties:
15 java.util.logging.config.file: WEB-INF/logging.properties
16
17 handlers:
18 - url: /user/*
19 servlet: org.restlet.ext.servlet.ServerServlet
20 name: user
21 init_params:
22 org.restlet.application: com.my-app.server.resource.user.UserApplication
23 org.restlet.clients: HTTP HTTPS
在网络上尝试了一些 YAML 验证器之后,我实际上认为它在抱怨第 19 行,其中第 13 列指向“servlet”之后的“:”字符。但是这种用法看起来与https://developers.google.com/appengine/docs/java/configyaml/appconfig_yaml#Required_Elements上的文档完全一致
我确定我在做一些愚蠢的事情,但我很难过。