I've successfully deployed a Cron job to App Engine, for a Java application using the App Engine Standard environment. It deploys successfully, however the cron job fails, and when I check the log, it isn't calling the correct service:
"GET /my-app HTTP/1.1" 404 - - "AppEngine-Google; (+http://code.google.com/appengine)"
"my-project.appspot.com"
Other cron jobs that are working look like this (note that the last part shows the service name and not just the project name):
"GET /my-app HTTP/1.1" 404 - - "AppEngine-Google; (+http://code.google.com/appengine)"
"my-service.my-project.appspot.com"
Here is my cron.xml:
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/my-app</url>
<description>my app</description>
<schedule>every 1 minutes from 00:00 to 23:00</schedule>
<timezone>Europe/Paris</timezone>
</cron>
</cronentries>
And my web.xml:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>my-app</servlet-name>
<servlet-class>com.my.package.MyApp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>my-app</servlet-name>
<url-pattern>my-app</url-pattern>
</servlet-mapping>
</web-app>
And my servlet definition (this is a Cloud Endpoint app, which uses a Java servlet):
@WebServlet(
name = "my-app",
urlPatterns = {"/my-app"}
)
public class MyApp extends HttpServlet {
...
And my appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
....
<application>my-project</application>
<service>my-app</service>
....
</appengine-web-app>
Why isn't the cron job calling the service? The service is also correctly deployed.