I am testing a cron job. It gets uploaded fine, but fails on the
dashboard. Can't really figure out what the problem is.
I created a cron.xml file in WEB-INF and put this in :
<cronentries>
<cron>
<url>/cron/mycronjob</url>
<description>Simple Cron Job that announces that it got invoked</
description>
<schedule>every 1 minutes</schedule>
</cron>
</cronentries>
In the web.xml I included this:
<servlet>
<servlet-name>ScrapCronServlet</servlet-name>
<servlet-class>com.scrapbook.ScrapCronServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ScrapCronServlet</servlet-name>
<url-pattern>/cron/mycronjob</url-pattern>
</servlet-mapping>
And in the cron servlet:
public class ScrapCronServlet extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
try {
// _logger.info("Cron Job has been executed");
String mesg=" Cron job was executed ";
ScrapMailServlet.sendEmail(mesg);
//Put your logic here
//BEGIN
//END
}
catch (Exception ex) {
//Log any exceptions in your Cron Job
//_logger.info("Cron job hasnt worked");
}
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req, resp);
}
}
Has anyone else had this problem?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.