1

In Eclipse 3.6 with Plugin v1.4.0 AppEngine 1.3.8 GWT 2.1.0 Local Task Queues no longer get executed.

To reproduce:

Create a new GWT and AppEngine project (I called the package "test2" below)

Add the following to GreetingServiceImpl greetServer() method before the return line:

final Queue queue = QueueFactory.getDefaultQueue();
queue.add(TaskOptions.Builder.url("/taskrunner").param("id",
UUID.randomUUID().toString()));

Create a class in the server package "TaskRunner" with the following:

public class TaskRunner extends HttpServlet {

   @Override
   public void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
System.out.println("TaskRunner");
   }

   @Override
   public void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
System.out.println("TaskRunner");
   }

}

Add the following to web.xml

<servlet>
 <servlet-name>taskRunner</servlet-name>
 <servlet-class>test2.server.TaskRunner</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>taskRunner</servlet-name>
  <url-pattern>/taskrunner</url-pattern>
</servlet-mapping>

Run the project and click the GWT button. After about 10 seconds you will get the following exception on the console:

[ERROR] Job default.task1 threw an unhandled Exception:
        com.google.apphosting.api.ApiProxy$ApplicationException:
        ApplicationError: 2: Received exception executing http method POST
        against URL http: //0.0.0.0:8888/taskrunner: No route to host: connect
               at
        com.google.appengine.api.urlfetch.dev.LocalURLFetchService.fetch(LocalURLFetchService.java:
        239)
               at com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue
        $UrlFetchServiceLocalTaskQueueCallback.execute(LocalTaskQueue.java:
        471)
               at
        com.google.appengine.api.labs.taskqueue.dev.UrlFetchJob.execute(UrlFetchJob.java:
        77)
               at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
               at org.quartz.simpl.SimpleThreadPool
        $WorkerThread.run(SimpleThreadPool.java:520)
        [ERROR] Job (default.task1 threw an exception.
        org.quartz.SchedulerException: Job threw an unhandled exception. [See
        nested exception: com.google.apphosting.api.ApiProxy
        $ApplicationException: ApplicationError: 2: Received exception
        executing http method POST against URL http: //0.0.0.0:8888/taskrunner:
        No route to host: connect]
               at org.quartz.core.JobRunShell.run(JobRunShell.java:214)
               at org.quartz.simpl.SimpleThreadPool
        $WorkerThread.run(SimpleThreadPool.java:520)
        * Nested Exception (Underlying Cause) ---------------
        com.google.apphosting.api.ApiProxy$ApplicationException:
        ApplicationError: 2: Received exception executing http method POST
        against URL http: //0.0.0.0:8888/taskrunner: No route to host: connect
               at
        com.google.appengine.api.urlfetch.dev.LocalURLFetchService.fetch(LocalURLFetchService.java:
        239)
               at com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue
        $UrlFetchServiceLocalTaskQueueCallback.execute(LocalTaskQueue.java:
        471)
               at
        com.google.appengine.api.labs.taskqueue.dev.UrlFetchJob.execute(UrlFetchJob.java:
        77)
               at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
               at org.quartz.simpl.SimpleThreadPool
        $WorkerThread.run(SimpleThreadPool.java:520)

Remove GWT from the project and it works! To test this:

Add server class

 public class TaskRunnerTest extends HttpServlet {

 public void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {

  final Queue queue = QueueFactory.getDefaultQueue();
  queue.add(TaskOptions.Builder.url("/taskrunner").param("id", UUID.randomUUID().toString()));

}
  }

Add to web.xml

 <servlet>
   <servlet-name>taskRunnerTest</servlet-name>
  <servlet-class>test2.server.TaskRunnerTest</servlet-class>
 </servlet>
 <servlet-mapping>
   <servlet-name>taskRunnerTest</servlet-name>
   <url-pattern>/taskrunnertest</url-pattern>
   </servlet-mapping>

Remove GWT from the Project (uncheck use GWT) and hit http://127.0.0.1:8888/taskrunnertest - no exception is thrown. (With GWT enabled that url throws the exception).

This used to work with GWT enabled. Please can someone advise a fix as its cost me 2 days so far.

Thanks!

Andy
  • 11
  • 2

1 Answers1

0

I was getting the same error, it turned out to be because I was running on a USB 3G mobile broadband stick. It changes something in the way the networking on my laptop works.

Basically the http://0.0.0.0 url did not resolve for me anymore, localhost still did which is why I could still browse the app running locally - but the taskqueues on the dev server use 0.0.0.0 it seems.

Ashley Schroder
  • 3,826
  • 1
  • 21
  • 16
  • Did you ever figure out what the something was in the way the networking works? I'm hitting this same problem. – Riley Lark Nov 06 '11 at 18:00