Cron tasks not uploaded using Google Cloud Tools for Eclipse

406 views
Skip to first unread message

Daniel Garrido

unread,
Mar 14, 2017, 5:35:19 PM3/14/17
to Google App Engine
Hi all,

I have tried to create a cron task using cron.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
  <cron>
    <url>/save</url>
    <description>daily summary job</description>
    <schedule>every 2 minutes</schedule>
  </cron>
</cronentries>

When I deploy my app to app engine using Google Cloud Tools for Eclipse, the cron task is not being created (it doesn't appear in the console).

I tested the same example using the old Eclipse plugin and it worked.

It seems that the cron.xml file is not being uploaded. Documentation (https://cloud.google.com/appengine/docs/standard/java/config/cron) says that I have to upload cron tasks using appcfg. This is automatically performed by the eclipse plugin.

Finally, I used appcfg and the cron task was created.

I am wondering if I can do the same using the new Google Cloud Tools in an automatic way.

Best regards,
Daniel.

Nicola Spreafico

unread,
Mar 15, 2017, 6:23:46 AM3/15/17
to Google App Engine
If you're using a Maven-based project, by default implementation of the Maven Plugin only the app.yaml file (the application itself) is deployed.

If you need to deploy the cron, queue and index as well, you need to configure the deployables configuration with all the files
Please see this issue where I posted a configuration example.

With the default configuration of the Maven plugin, your configuration will be something like this:
<deployables>
     <param>target/appengine-staging/app.yaml</param>
     <param>target/appengine-staging/cron.yaml</param>
<param>target/appengine-staging/queue.yaml</param>
<param>target/appengine-staging/index.yaml</param>
</deployables>

Daniel Garrido

unread,
Mar 15, 2017, 4:17:12 PM3/15/17
to Google App Engine
Thank you very much Nicola,

It worked with minor modifications! My final configuration is as follows:

        <configuration>
            <deploy.promote>True</deploy.promote>
            <stage.enableJarClasses>true</stage.enableJarClasses>
            <stage.stagingDirectory>${java.io.tmpdir}/appengine-staging</stage.stagingDirectory>
           <deployables>           
            <param>${java.io.tmpdir}/appengine-staging/app.yaml</param>
            <param>${java.io.tmpdir}/appengine-staging/cron.yaml</param>
        </deployables>
        </configuration>

By the way, anybody knows what's the difference between using the option "Deploy to app engine standard..." and using "Run as / Maven build / UpdateApplication appengine:deploy

I used the second option and it worked. If I use the first option, then cron.xml is not deployed.

Best regards,
Daniel.

Nicholas (Google Cloud Support)

unread,
Mar 23, 2017, 1:35:12 PM3/23/17
to Google App Engine
It seems like the first option does not consult your configuration with specified deployables.  It is thus likely consulting a different maven goal.

Jason

unread,
Mar 31, 2017, 9:18:41 PM3/31/17
to Google App Engine
What if you are not using a Maven-based project? I created a non-maven project and it is not uploading my queue.xml or cron.xml either.

Brian de Alwis

unread,
Mar 31, 2017, 11:59:48 PM3/31/17
to google-a...@googlegroups.com
Jason, 

This will be fixed in the next release of Cloud Tools for Eclipse.

In the meantime you should be able to use the `appcfg.sh` command [1] to upload your cron.xml (`appcfg.sh help update_cron`) and `queue.xml` (`appcfg.sh help update_queues`).  You'll need to use the `-A` argument to specify your Project ID if you don't have an `<application/>` element in your appengine-web.xml.

Brian.

[1] appcfg.sh is from the App Engine SDK for Java  and not included in the Google Cloud SDK.  But it's a simple wrapper around a jar that is included in the Google Cloud SDK:

$ java -cp $GOOGLE_CLOUD_SDK_HOME/platform/google_appengine/google/appengine/tools/java/lib/appengine-tools-api.jar com.google.appengine.tools.admin.AppCfg [args]


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/735dac15-28f2-4b86-893f-6c9f103768d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

my self lky

unread,
Apr 1, 2017, 9:59:05 AM4/1/17
to Google App Engine
hii Brian!! my corn job is not getting uploded! my corn.xml cornservlet.java and web.xml are fine! im not able to get how to trigger corn service?? ! im not getting uploding corn job message in my console page!! what should i do?? i even dont know how to run appcfg.sh command and where to run this command?? im using gwt and eclipse!! do i need to call that corn servlet from other class to make it work?/ please help me!! im new to gwt and gae!! thanx in advance!!

my self lky

unread,
Apr 1, 2017, 9:59:22 AM4/1/17
to Google App Engine
hi daniel!! same thing is happening with me!! corn job not being uploded!! what to do?? where to run this appcfg command in eclipse?? im using eclipse!! its a gwt project!! please tell me how to make it work? thanx in advance!

Daniel Garrido

unread,
Apr 4, 2017, 6:08:23 AM4/4/17
to Google App Engine
Hi,

I ran appcfg from the command line. You will have to use appcfg.cmd included in the java app engine sdk. It seems that it is not included in the cloud sdk. At least, I wasn't able to find it. This point doesn't seem very clear in the documentation.

Inside eclipse, I followed the recommendations from Nicola and it worked for me, but you will have to use maven. In your case, you're talking about gwt project. I'm not sure how it will work.

Regards,
Daniel.

my self lky

unread,
Apr 4, 2017, 6:12:41 AM4/4/17
to google-a...@googlegroups.com
Thanks Daniel!! i ran this appcfg command!! but my cron job is not getting uploded!! i dont know why!!

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/W0BR08R8FnM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

Daniel Garrido

unread,
Apr 4, 2017, 6:13:16 AM4/4/17
to Google App Engine
I skipped this information from Brian. How to run appcfg from the command line:


[1] appcfg.sh is from the App Engine SDK for Java  and not included in the Google Cloud SDK.  But it's a simple wrapper around a jar that is included in the Google Cloud SDK:

$ java -cp $GOOGLE_CLOUD_SDK_HOME/platform/google_appengine/google/appengine/tools/java/lib/appengine-tools-api.jar com.google.appengine.tools.admin.AppCfg [args]


Luckyy

unread,
Apr 4, 2017, 6:49:44 AM4/4/17
to google-a...@googlegroups.com
thanks a lot for your help man!! now it running !! :-)

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/W0BR08R8FnM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.

GCP Microloan

unread,
Jul 26, 2019, 9:05:39 AM7/26/19
to Google App Engine
Hello Daniel ,

I am trying to deploy appengine-web.xml and cron.yaml together PFB my pom.xml

<configuration>
        <deploy.project>portaldata</deploy.project>
        <deploy.promote>False</deploy.promote>
        <stage.enableJarClasses>true</stage.enableJarClasses>
        <stage.stagingDirectory>${java.io.tmpdir}/appengine-staging</stage.stagingDirectory>
        <deployables>
            <param>E:/git_Collection_Portal/Collections-app-server/JavaPortal-1/src/main/webapp/WEB-INF/appengine-web.xml</param>
            <param>E:/git_Collection_Portal/Collections-app-server/JavaPortal-1/src/main/resources/cron.yaml</param>
        </deployables>
    </configuration>

i am facing issue while deploying above code via maven can you please help me with same 
EXCEPTION:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.711 s
[INFO] Finished at: 2019-07-26T17:11:45+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy (default-cli) on project JavaPortal-1: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy failed: Non zero exit: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Regards,
Mayuri 

On Wednesday, March 15, 2017 at 3:05:19 AM UTC+5:30, Daniel Garrido wrote:

Harmit Rishi (Cloud Platform Support)

unread,
Jul 29, 2019, 10:39:00 AM7/29/19
to Google App Engine
Hello, 

In an attempt to isolate the issue, would you be able to set "app_start_timeout_sec" to the max? The max is 1800, you may try it again once set. Also, this will help rule out if the issue is due to app initialization or not. You may find further information about this here.

Look forward to hearing from you.
Reply all
Reply to author
Forward
0 new messages