我尝试通过终端执行swagger.json
来生成mvn exec:java -DGetSwaggerDoc
,然后按照"生成OpenAPI配置规范" https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java的部分。这就是我得到的:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ web ---
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchFieldError: WHITESPACE
at com.google.apphosting.utils.config.AppEngineWebXml.toNullIfEmptyOrWhitespace(AppEngineWebXml.java:994)
at com.google.apphosting.utils.config.AppEngineWebXml.setInstanceClass(AppEngineWebXml.java:241)
at com.google.apphosting.utils.config.AppEngineWebXmlProcessor.processInstanceClassNode(AppEngineWebXmlProcessor.java:225)
at com.google.apphosting.utils.config.AppEngineWebXmlProcessor.processSecondLevelNode(AppEngineWebXmlProcessor.java:144)
at com.google.apphosting.utils.config.AppEngineWebXmlProcessor.processXml(AppEngineWebXmlProcessor.java:68)
at com.google.apphosting.utils.config.AppEngineWebXmlReader.processXml(AppEngineWebXmlReader.java:132)
at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:76)
at com.google.api.server.spi.tools.AppEngineUtil.getAppProperty(AppEngineUtil.java:129)
at com.google.api.server.spi.tools.AppEngineUtil.getApplicationId(AppEngineUtil.java:52)
at com.google.api.server.spi.tools.AppEngineUtil.getApplicationDefaultHostname(AppEngineUtil.java:91)
at com.google.api.server.spi.tools.EndpointsToolAction.getHostname(EndpointsToolAction.java:226)
at com.google.api.server.spi.tools.GetSwaggerDocAction.execute(GetSwaggerDocAction.java:78)
at com.google.api.server.spi.tools.EndpointsTool.execute(EndpointsTool.java:83)
at com.google.api.server.spi.tools.EndpointsTool.main(EndpointsTool.java:115)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.868 s
[INFO] Finished at: 2016-12-02T15:17:06+08:00
[INFO] Final Memory: 14M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project web: An exception occured while executing the Java class. null: InvocationTargetException: WHITESPACE -> [Help 1]
[ERROR]
这是我的appengine-web.xml
:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>bla</application>
<module>default</module>
<version>r1</version>
<threadsafe>true</threadsafe>
<instance-class>F1</instance-class>
<env-variables>
<env-var name="ENDPOINTS_SERVICE_NAME" value="bla.appspot.com"/>
</env-variables>
<use-google-connector-j>true</use-google-connector-j>
<system-properties>
<property name="java.util.logging.config.file"
value="WEB-INF/logging.properties"/>
<property name="gcm.api.key" value="BLA"/>
<property name="ae-cloudsql.cloudsql-database-url"
value="jdbc:google:mysql://bla:us-central1:db0/bla?user=root&password=bla&useUnicode=true"/>
<property name="ae-cloudsql.local-database-url"
value="jdbc:mysql://localhost:3306/bla?user=root&password=&useUnicode=true&useSSL=false"/>
</system-properties>
<automatic-scaling>
<min-idle-instances>1</min-idle-instances>
<max-idle-instances>3</max-idle-instances>
<min-pending-latency>250ms</min-pending-latency>
<max-pending-latency>1000ms</max-pending-latency>
</automatic-scaling>
</appengine-web-app>
我正在使用Endpoints Framework 2.0.0-beta.9。我该如何解决这个问题?