Java GAE Task Queue CallNotFoundException

别等时光非礼了梦想. 提交于 2019-12-06 09:41:52

问题


When trying to implement a push queue, I am getting the following error:

com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call taskqueue.BulkAdd in a thread that is neither the original request thread nor a thread created by ThreadManager

Within my servlet's doPost() method, here is my task:

Queue queue = QueueFactory.getQueue("rating-queue");
queue.add(TaskOptions.Builder.withUrl("/addrating")
     .param("function", function)
     .param("user_id", Integer.toString(user_id))
     .param("item_id", Integer.toString(item_id))
     .param("is_user", Boolean.toString(isUser)));

In my web.xml file:

<servlet>
    <servlet-name>AddRating</servlet-name>
    <servlet-class>com.example.ExampleClass</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>AddRating</servlet-name>
    <url-pattern>/addrating</url-pattern>
</servlet-mapping>

Here is my queue.xml file in my WEB-INF folder:

<queue-entries>
    <queue>
        <name>default</name>
        <rate>5/s</rate>
    </queue>
    <queue>
        <name>rating-queue</name>
        <rate>5/s</rate>
    </queue>
</queue-entries>

I'm running my servlet locally. There are no task queues visible in my app engine console.

来源:https://stackoverflow.com/questions/43354788/java-gae-task-queue-callnotfoundexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!