Google App Engine Localhost Backend Error

2019-08-29 04:39发布

问题:

I am trying to run a test GAE backend on my localhost and I am getting the following error:

com.google.appengine.tools.development.InstanceHelper sendStartRequest
WARNING: Start request to /_ah/start on server 0.export failed (HTTP status code=405). Retrying...

My code is as follows:

backends.xml

<backends>
    <backend name="example">
        <class>B1</class>
        <options>
            <instances>1</instances>
            <public>false</public>
            <dynamic>true</dynamic>
        </options>
    </backend>
</backends>

web.xml

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

    <servlet>
        <servlet-name>backend_test</servlet-name>
        <servlet-class>com.test.backend.BackendTest</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>backend_test</servlet-name>
        <url-pattern>/_ah/start</url-pattern>
    </servlet-mapping>

</web-app>

Thank you for the help.

回答1:

You've hooked up com.test.backend.BackendTest to handle start requests. It needs to handle a GET request and respond with 200 (actually 200-299 will do) or a 400.

Details here: https://developers.google.com/appengine/docs/java/backends/#Java_Startup

A 405 response sounds like you didn't supply a handler that overrides get().