Patrice,

Thanks,

Ken
On Jun 30, 2015, at 7:52 AM, Patrice (Cloud Platform Support) 
<[email protected]> wrote:

> Hi Ken!
> 
> If you want to call that method and log the time when you call this? yes 
> definitely, this is what you want, and then you just hit that servlet 
> whenever you want that logged.
> 
> Cheers!
> 
> On Monday, June 29, 2015 at 6:56:06 PM UTC-4, Ken Bowen wrote:
> Hey Patrice, 
> 
> It’s my mistake. All I really wanted to do was execute the java method 
>         public static void crontest1(){ 
>                 final DateTimeFormatter fmt = 
> Constants.YMDHMS_DATETIME_FORMATTER; 
>                 String now = fmt.print(System.currentTimeMillis()); 
>                 logger.warn("############## crontest1() ############: " + 
> now);       
>         } 
> 
> The jsp/js was just going to be a stepping stone to this, but now I 
> understand the fact that cron isn’t going to execute that jsp “headless”. 
> 
> o am I correct that the right way to do this is to write a simple servlet, 
> something like this: 
> 
>         public class CronTest1Servlet extends LoggedHttpServlet { 
>                 private static Logger logger = 
> Logger.getLogger(CronTest1Servlet.class.getName()); 
>                 @Override 
>                 public void doGet(HttpServletRequest request, 
> HttpServletResponse response) throws ServletException, IOException 
>                 {         final DateTimeFormatter fmt = 
> DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss z"); 
>                         String now = fmt.print(System.currentTimeMillis()); 
>                         logger.warn("############## CronTest1Servlet 
> ############: " + now); } 
>                 } 
> 
> Thanks much, 
> —Ken 
> 
> On Jun 29, 2015, at 11:41 AM, Patrice (Cloud Platform Support) 
> <[email protected]> wrote: 
> 
> > Hey Ken, 
> > 
> > I'm a bit unclear on your issue, so if you could clarify, it would be 
> > helpful. 
> > 
> > You have a cronJob on the /admin/cron/crontest1 URL that creates a js and 
> > displays it. When you hit the url yourself, it goes through... but when the 
> > job autoruns, it fails... right? 
> > 
> > If this is the behavior you're experiencing, I'd say it's to be expected... 
> > how would a scheduled cron job running on the backend display anything? 
> > 
> > Let me know if I'm the one not understanding your issue properly here. 
> > 
> > Cheers! 
> > 
> > On Monday, June 29, 2015 at 12:02:20 AM UTC-4, Ken Bowen wrote: 
> > 
> > I have a simple test cron job which does not succeed in running on GAE.  
> > The target url runs correctly when invoked from a browser (when I’m logged 
> > in as admin),  but cron is not successfully running the job.  The GAE Cron 
> > Jobs page shows: 
> > 
> >    /admin/cron/crontest1    every 2 hours (America/New_York) 
> >    Initial simple test                   2015/06/28 23:18:03 2 secs late 
> > Failed 
> > 
> > Here’s the cron.xml: 
> > <?xml version="1.0" encoding="UTF-8"?> 
> > <cronentries> 
> > <cron> 
> >    <description>Initial simple test</description> 
> >    <timezone>America/New_York</timezone> 
> >    <url>/admin/cron/crontest1/</url> 
> >    <schedule>every 2 hours</schedule> 
> > </cron> 
> > </cronentries> 
> > 
> > In web.xml, the <url-pattern>/admin/*</url-pattern> gets the   
> > <security-constraint>: 
> >         <auth-constraint> 
> >             <role-name>admin</role-name> 
> >        </auth-constraint> 
> > 
> > The target url /admin/cron/crontest1/ assembles a very simple jsp page 
> > equivalent to: 
> > <head> 
> >    <script type='text/javascript' 
> > src='/admin/cron/crontest1/crontest1.js'></script> 
> >    <script> 
> >         $(document).ready(function() { 
> >             crontest1init(); 
> >         }); 
> >    </script> 
> > </head> 
> > <body> 
> > <h1>CronTest1</h1>   
> > </body> 
> > 
> > where crontest1.js is just: 
> > 
> > function crontest1init() 
> > { 
> >         AdminIntf.crontest1(); 
> > } 
> > 
> > And AdminIntf.crontest1() is just a DWR (Direct Web Remoting) call to this: 
> > 
> > public static void crontest1(){ 
> >            final DateTimeFormatter fmt = 
> > Constants.YMDHMS_DATETIME_FORMATTER; 
> >        String now = fmt.print(System.currentTimeMillis()); 
> >        logger.warn("############## crontest1() ############: " + now); 
> > } 
> > 
> > When I am logged in as admin and issue the url 
> > 
> > http://[my.project].appspot.com/admin/cron/crontest1/ 
> > 
> > the result is a page showing 
> > 
> > CronTest1 
> > 
> > and the logs show: 
> > 
> > ……/dwr/call/plaincall/AdminIntf.crontest1.dwr 200 …blah,blah 
> > I 2015-06-28 21:10:18.026 org.directwebremoting.util.CommonsLoggingOutput 
> > info: Exec: AdminIntf.crontest1() 
> > W 2015-06-28 21:10:18.064 com.strongbrain.admin.AdminIntf crontest1: 
> > ############## crontest1() ############: 2015-06-29 03:10:18 UTC 
> > 
> > The url action returns 200, but, as noted at top, cron doesn’t successfully 
> > run this.  Clearly I’m missing something essential, but I can’t see what. 
> > Any help will definitely be appreciated. 
> > Thanks in advance, 
> > Ken Bowen 
> > 
> > 
> > -- 
> > 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/3OjCkOL2jhI/unsubscribe. 
> > To unsubscribe from this group and all its topics, send an email to 
> > [email protected]. 
> > To post to this group, send email to [email protected]. 
> > Visit this group at http://groups.google.com/group/google-appengine. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/google-appengine/e49bc100-aeda-475c-94d4-0dc9b3ef94b8%40googlegroups.com.
> >  
> > For more options, visit https://groups.google.com/d/optout. 
> 
> 
> -- 
> 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/3OjCkOL2jhI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-appengine.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/google-appengine/c2d8444c-84a3-4693-979c-5b30fdca4cf7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/27119D19-D0AF-4B55-95A0-9E34B2F91D7F%40form-runner.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to